操作系统中的文件系统和访问方法
文件 (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.
文件基本上是按字節(jié)順序組織的塊,任何機(jī)器都可以理解。 換句話說(shuō),存儲(chǔ)在輔助存儲(chǔ)設(shè)備中的相關(guān)信息的集合也稱為文件。 該文件是邏輯上相關(guān)的實(shí)體的集合。 根據(jù)用戶視圖,文件是邏輯輔助存儲(chǔ)的最小分配空間。 存儲(chǔ)與計(jì)算機(jī)上的計(jì)算機(jī)程序一起使用的數(shù)據(jù),信息,設(shè)置或命令的對(duì)象稱為文件。 在Microsoft Windows等圖形用戶界面(GUI)中,文件顯示為與打開(kāi)文件的程序有關(guān)的圖標(biāo)。
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.
通過(guò)使用軟件程序,我們可以在計(jì)算機(jī)上創(chuàng)建文件。 例如,要?jiǎng)?chuàng)建圖像文件,可以使用圖像編輯器,而可以使用文字處理器來(lái)創(chuàng)建文檔。 計(jì)算機(jī)文件存儲(chǔ)在驅(qū)動(dòng)器(例如硬盤(pán)),光盤(pán)(DVD)和軟盤(pán)(例如軟盤(pán))上,也可以包含在該介質(zhì)的文件夾(目錄)中。 信息保存在文件中。 文件位于輔助存儲(chǔ)上。 當(dāng)使用這種形式時(shí),必須對(duì)其進(jìn)行訪問(wèn)并將其帶入主主存儲(chǔ)器。 文件中的信息可以通過(guò)多種方式訪問(wèn)??。 它通常取決于應(yīng)用程序。
文件屬性 (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,
文件以其名稱來(lái)引用,名稱或字符串是字符的集合。 有許多系統(tǒng)可以區(qū)分字母的大寫(xiě)和小寫(xiě)。 以任何名稱保存文件時(shí),文件將獨(dú)立于用戶,并且文件名應(yīng)唯一。 系統(tǒng)不允許使用相同名稱的文件。 文件的屬性可能因一個(gè)操作系統(tǒng)而異。 以下是文件的一些屬性,
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.
標(biāo)識(shí)符 -標(biāo)識(shí)符是唯一的標(biāo)記號(hào),用于標(biāo)識(shí)文件系統(tǒng)中的文件。 人類無(wú)法讀取標(biāo)識(shí)符或標(biāo)簽號(hào)。
Type - type is needed for the system that supports different types of file.
Type-支持不同文件類型的系統(tǒng)需要type。
Size - In this attribute, the current or the maximum size of the file is included( in bytes, words, blocks).
大小 -在此屬性中,包含文件的當(dāng)前或最大大小(以字節(jié),字,塊為單位)。
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.
位置 -文件的此屬性是指向文件的指針以及文件在該設(shè)備上存儲(chǔ)文件的位置。
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.
保護(hù) -此信息確定控制權(quán)并分配讀取,寫(xiě)入和執(zhí)行的權(quán)限。 它還定義了誰(shuí)可以閱讀,寫(xiě)作。
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.
時(shí)間日期和用戶標(biāo)識(shí) -這種類型的數(shù)據(jù)可用于保護(hù),安全性和使用情況監(jiān)視。 它還定義了文件的最后創(chuàng)建,最后修改和最后使用。
文件操作 (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.
文件具有許多屬性,因此要對(duì)文件屬性進(jìn)行脫污,操作系統(tǒng)會(huì)提供許多可以在文件上執(zhí)行的信息。 文件有許多簡(jiǎn)單易用的操作,例如創(chuàng)建,刪除,更新以及其他一些操作,例如重命名。
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.
創(chuàng)建文件 -要?jiǎng)?chuàng)建任何文件,主要有兩個(gè)步驟,首先是系統(tǒng)中有可用空間,其次是必須在目錄中輸入新文件。
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.
寫(xiě)入文件 -為了寫(xiě)入文件,系統(tǒng)調(diào)用指定文件的兩個(gè)名稱以及寫(xiě)在文件上的信息。 當(dāng)給定文件名時(shí),系統(tǒng)在目錄中搜索該文件,寫(xiě)指針指向下一次寫(xiě)操作發(fā)生的位置,并且寫(xiě)指針被更新。
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.
讀取文件 -為了讀取文件,系統(tǒng)調(diào)用還指定了文件的兩個(gè)名稱和讀取指針。 在目錄中搜索給定的條目,系統(tǒng)跟蹤讀取的指針。 一旦讀取完成,讀取指針就會(huì)更新。 對(duì)文件的讀寫(xiě)操作使用相同的指針。
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.
重新放置文件 -首先,在目錄中搜索文件,并通過(guò)新位置更改文件的當(dāng)前位置。
檔案存取方式 (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,
該文件包含該信息,但是當(dāng)需要使用此信息時(shí),可以通過(guò)訪問(wèn)方法進(jìn)行訪問(wèn)并讀入計(jì)算機(jī)內(nèi)存。 某些系統(tǒng)僅提供一種訪問(wèn)方法,而某些系統(tǒng)提供的訪問(wèn)方式超過(guò)了訪問(wèn)文件的方式,
1. Sequential Access Method
1.順序訪問(wèn)方法
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.
順序訪問(wèn)是指按某種順序訪問(wèn)記錄的操作,即按順序處理文件中的信息,一個(gè)記錄接一個(gè)記錄。 這種訪問(wèn)方法是最原始的一種。
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.
順序訪問(wèn)的思想基于作為順序訪問(wèn)設(shè)備的磁帶模型。 我們認(rèn)為順序訪問(wèn)方法是最好的,因?yàn)槲募械拇蠖鄶?shù)記錄都將被處理。 例如,交易文件。
Example: Compilers usually access files in this fashion.
示例:編譯器通常以這種方式訪問(wèn)??文件。
2. Direct or Random Access Methods
2.直接或隨機(jī)訪問(wèn)方法
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.
有時(shí)沒(méi)有必要處理文件中的所有記錄。 不必按它們?cè)趦?nèi)存中出現(xiàn)的順序處理所有記錄。 在所有這些情況下,都將使用直接訪問(wèn)。
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.
磁盤(pán)是直接訪問(wèn)設(shè)備,它使我們能夠可靠地隨機(jī)訪問(wèn)任何文件塊。 在該文件中,包含物理塊和該塊的記錄的集合。
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.
例如。 數(shù)據(jù)庫(kù)通常是這種類型的,因?yàn)樗鼈冊(cè)试S查詢處理,該處理涉及立即訪問(wèn)大量信息。 所有預(yù)訂系統(tǒng)都屬于這一類。
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.
并非所有操作系統(tǒng)都支持直接訪問(wèn)文件。 在創(chuàng)建時(shí)定義文件的順序和直接訪問(wèn),并在以后進(jìn)行相應(yīng)訪問(wèn)。 不能直接訪問(wèn)順序文件,但是可以順序訪問(wèn)直接訪問(wèn)文件。
3. Index Access Method
3.索引訪問(wèn)方法
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.
索引文件是具有索引的計(jì)算機(jī)文件,該索引允許在給定其文件密鑰的情況下輕松隨機(jī)地訪問(wèn)任何記錄。 鍵是唯一標(biāo)識(shí)記錄的屬性。 我們可以說(shuō),如果存在多個(gè)索引,則其他索引是備用索引。 索引的創(chuàng)建由文件完成,但由系統(tǒng)維護(hù)。
4. Index sequential Access Method
4.索引順序訪問(wèn)方法
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.
索引順序訪問(wèn)方法是直接訪問(wèn)方法的修改。 基本上,它既是順序訪問(wèn)又是直接訪問(wèn)的結(jié)合。 此方法的主要思想是先直接訪問(wèn)文件,然后順序訪問(wèn)。 在這種訪問(wèn)方法中,必須維護(hù)索引。 索引不過(guò)是指向塊的指針。 可以直接訪問(wèn)索引來(lái)訪問(wèn)文件中的記錄。 從此訪問(wèn)獲得的信息用于訪問(wèn)文件。 有時(shí)索引很大。 因此,為了維護(hù)索引的所有這些層次結(jié)構(gòu),在其中索引的一個(gè)直接訪問(wèn)會(huì)導(dǎo)致另一索引訪問(wèn)的信息。
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.
這種訪問(wèn)方式的主要優(yōu)點(diǎn)是,借助此方法可以同時(shí)進(jìn)行文件的直接和順序訪問(wèn)。
翻譯自: https://www.includehelp.com/operating-systems/file-system-and-access-methods.aspx
總結(jié)
以上是生活随笔為你收集整理的操作系统中的文件系统和访问方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: mysql杨辉三角_两个经典的小例子:杨
- 下一篇: 北航计算机学院博士机试考试题,北航201