文件 (File)
A file is basically a sequence of bytes organized into blocks that are understandable by any machines. In other words, the collection of related information that is stored in a secondary storage device is also called a file. The file is a collection of logically related entities. According to the users view a file is the smallest allots space of the logical secondary storage. The object that stores data, information, settings or commands used with a computer program on a computer is called file. In graphical user interface (GUI) such as Microsoft Windows, files display as icons that relate to the program that opens the file.
文件基本上是按字節順序組織的塊,任何機器都可以理解。 換句話說,存儲在輔助存儲設備中的相關信息的集合也稱為文件。 該文件是邏輯上相關的實體的集合。 根據用戶視圖,文件是邏輯輔助存儲的最小分配空間。 存儲與計算機上的計算機程序一起使用的數據,信息,設置或命令的對象稱為文件。 在Microsoft Windows等圖形用戶界面(GUI)中,文件顯示為與打開文件的程序有關的圖標。
By using a software program we can create a file on the computer. For example to create an image file you would use an image editor and create a document you would use a word processor. Computer files are stored on a drive e.g (hard disk), disc (DVD) and diskette (e.g floppy) and may also be contained in a folder (directory) on that medium. Information is kept in files. Files reside on secondary storage. When this formation is to be used, it has to be accessed and brought into primary main memory. Information in files could be accessed in many ways. It is usually dependent on an application.
通過使用軟件程序,我們可以在計算機上創建文件。 例如,要創建圖像文件,可以使用圖像編輯器,而可以使用文字處理器來創建文檔。 計算機文件存儲在驅動器(例如硬盤),光盤(DVD)和軟盤(例如軟盤)上,也可以包含在該介質的文件夾(目錄)中。 信息保存在文件中。 文件位于輔助存儲上。 當使用這種形式時,必須對其進行訪問并將其帶入主主存儲器。 文件中的信息可以通過多種方式訪問??。 它通常取決于應用程序。
文件屬性 (Attributes of file)
A file is referred by its name, a name or string is a collection of character. There are many systems which differentiate the upper and lower case of the alphabet. When a file is saved by any name it becomes independents for the user and file name should be unique. The system does not allow the files of the same types of name. The attributes of the file may vary from the one operating system to another operating system. Following are some attribute of the file,
文件以其名稱來引用,名稱或字符串是字符的集合。 有許多系統可以區分字母的大寫和小寫。 以任何名稱保存文件時,文件將獨立于用戶,并且文件名應唯一。 系統不允許使用相同名稱的文件。 文件的屬性可能因一個操作系統而異。 以下是文件的一些屬性,
Name - The name of any file is the information which is in readable form for the users.
名稱 -任何文件的名稱都是用戶可讀的信息。
Identifier - The identifier is a unique tag number which identifies the file within the file system. It is not possible for the human to read the identifier or tag number.
標識符 -標識符是唯一的標記號,用于標識文件系統中的文件。 人類無法讀取標識符或標簽號。
Type - type is needed for the system that supports different types of file.
Type-支持不同文件類型的系統需要type。
Size - In this attribute, the current or the maximum size of the file is included( in bytes, words, blocks).
大小 -在此屬性中,包含文件的當前或最大大小(以字節,字,塊為單位)。
Location - This attribute of the file is the pointer to the file and the location of the file where the file is stored on that device.
位置 -文件的此屬性是指向文件的指針以及文件在該設備上存儲文件的位置。
Protection - this information determines the control and assigns the power of reading, writing and executing. It also defines that who can do the reading, writing.
保護 -此信息確定控制權并分配讀取,寫入和執行的權限。 它還定義了誰可以閱讀,寫作。
Time date and user identification - This type of data is useful for the protection, security and usage monitoring. It also defines the last creation, last modification and last use of the file.
時間日期和用戶標識 -這種類型的數據可用于保護,安全性和使用情況監視。 它還定義了文件的最后創建,最后修改和最后使用。
文件操作 (Operations of the file)
A file has many properties so to defile the file property operating system provides a lot of information that can be performed on the file. There are many simple and easy operations of file like create, delete, update and some others like rename.
文件具有許多屬性,因此要對文件屬性進行脫污,操作系統會提供許多可以在文件上執行的信息。 文件有許多簡單易用的操作,例如創建,刪除,更新以及其他一些操作,例如重命名。
Creating a file - for creating any file there are mainly two steps first the free space is available in the system and second is the new entry of file must be made in the directory.
創建文件 -要創建任何文件,主要有兩個步驟,首先是系統中有可用空間,其次是必須在目錄中輸入新文件。
Writing a file - For writing a file the system call specifies the two things name of the file and the information that is written on the file. When the name of the file is given the system search that file in the directory, the write pointer point the location where the next write is to take place and write pointer is updated.
寫入文件 -為了寫入文件,系統調用指定文件的兩個名稱以及寫在文件上的信息。 當給定文件名時,系統在目錄中搜索該文件,寫指針指向下一次寫操作發生的位置,并且寫指針被更新。
Reading a file - For reading a file the system call also specifies the two things name of the file and the read pointer. The directory is searched for the given entry and system keep track on the read pointer. The read pointer is updated once the read is completed. The same pointer is used by both the read and write operation on the file.
讀取文件 -為了讀取文件,系統調用還指定了文件的兩個名稱和讀取指針。 在目錄中搜索給定的條目,系統跟蹤讀取的指針。 一旦讀取完成,讀取指針就會更新。 對文件的讀寫操作使用相同的指針。
Deleting a file - For deleting a file first we search for the directory and then erase the directory. After that, we release the space so that it can be reused by another file.
刪除文件 -首先要搜索文件,然后搜索目錄,然后刪除目錄。 之后,我們釋放空間,以便其他文件可以重用該空間。
Repositioning of the file - First, the directory is searched for the file and the current position of the file is changed by the new position.
重新放置文件 -首先,在目錄中搜索文件,并通過新位置更改文件的當前位置。
檔案存取方式 (File Access Method)
The file contains the information but when it required to used this information can be access by the access methods and reads into the computer memory. Some system provides only one access method and some provide more than on access method to access the file,
該文件包含該信息,但是當需要使用此信息時,可以通過訪問方法進行訪問并讀入計算機內存。 某些系統僅提供一種訪問方法,而某些系統提供的訪問方式超過了訪問文件的方式,
1. Sequential Access Method
1.順序訪問方法
A sequential access is that in which the records are accessed in some sequence, i.e., the information in the file is processed in order, one record after the other. This access method is the most primitive one.
順序訪問是指按某種順序訪問記錄的操作,即按順序處理文件中的信息,一個記錄接一個記錄。 這種訪問方法是最原始的一種。
The idea of Sequential access is based on the tape model which is a sequential access device. We consider Sequential access method is best because most of the records in a file are to be processed. For example, transaction files.
順序訪問的思想基于作為順序訪問設備的磁帶模型。 我們認為順序訪問方法是最好的,因為文件中的大多數記錄都將被處理。 例如,交易文件。
Example: Compilers usually access files in this fashion.
示例:編譯器通常以這種方式訪問??文件。
2. Direct or Random Access Methods
2.直接或隨機訪問方法
Sometimes it is not necessary to process every record in a file. It is not necessary to process all the records in the order in which they are present in the memory. In all such cases, direct access is used.
有時沒有必要處理文件中的所有記錄。 不必按它們在內存中出現的順序處理所有記錄。 在所有這些情況下,都將使用直接訪問。
The disk is a direct access device which gives us the reliability to random access of any file block. In the file, there is a collection of physical blocks and the records of that blocks.
磁盤是直接訪問設備,它使我們能夠可靠地隨機訪問任何文件塊。 在該文件中,包含物理塊和該塊的記錄的集合。
Eg. Databases are often of this type since they allow query processing that involves immediate access to large amounts of information. All reservation systems fall into this category.
例如。 數據庫通常是這種類型的,因為它們允許查詢處理,該處理涉及立即訪問大量信息。 所有預訂系統都屬于這一類。
Not all operating systems support direct access files. The sequential and direct access of the file is defined at the time of creation and accessed accordingly later. The direct access of a sequential file is not possible but Sequential access to a direct access file is possible.
并非所有操作系統都支持直接訪問文件。 在創建時定義文件的順序和直接訪問,并在以后進行相應訪問。 不能直接訪問順序文件,但是可以順序訪問直接訪問文件。
3. Index Access Method
3.索引訪問方法
An indexed file is a computer file with an index that allows easy random access to any record given its file key. The key is an attribute that uniquely identifies a record. We can say that If more than one index is present the other ones are alternate indexes. The creation of the indexes is done with the file but maintained by the system.
索引文件是具有索引的計算機文件,該索引允許在給定其文件密鑰的情況下輕松隨機地訪問任何記錄。 鍵是唯一標識記錄的屬性。 我們可以說,如果存在多個索引,則其他索引是備用索引。 索引的創建由文件完成,但由系統維護。
4. Index sequential Access Method
4.索引順序訪問方法
The index sequential access method is a modification of the direct access method. Basically, it is kind of combination of both the sequential access as well as direct access. The main idea of this method is to first access the file directly and then it accesses sequentially. In this access method, it is necessary for maintaining an index. The index is nothing but a pointer to a block. The direct access of the index is made to access a record in a file. The information which is obtained from this access is used to access the file. Sometimes the indexes are very big. So to maintain all these hierarchies of indexes are built in which one direct access of an index leads to information of another index access.
索引順序訪問方法是直接訪問方法的修改。 基本上,它既是順序訪問又是直接訪問的結合。 此方法的主要思想是先直接訪問文件,然后順序訪問。 在這種訪問方法中,必須維護索引。 索引不過是指向塊的指針。 可以直接訪問索引來訪問文件中的記錄。 從此訪問獲得的信息用于訪問文件。 有時索引很大。 因此,為了維護索引的所有這些層次結構,在其中索引的一個直接訪問會導致另一索引訪問的信息。
The main advantage in this type of access is that both direct and sequential access of files is possible with the help of this method.
這種訪問方式的主要優點是,借助此方法可以同時進行文件的直接和順序訪問。
翻譯自: https://www.includehelp.com/operating-systems/file-system-and-access-methods.aspx