操作系统中的文件系统和访问方法

文件 (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.

文件具有许多属性,因此要对文件属性进行脱污,操作系统会提供许多可以在文件上执行的信息。 文件有许多简单易用的操作,例如创建,删除,更新以及其他一些操作,例如重命名。

  1. 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.

    创建文件 -要创建任何文件,主要有两个步骤,首先是系统中有可用空间,其次是必须在目录中输入新文件。

  2. 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.

    写入文件 -为了写入文件,系统调用指定文件的两个名称以及写在文件上的信息。 当给定文件名时,系统在目录中搜索该文件,写指针指向下一次写操作发生的位置,并且写指针被更新。

  3. 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.

    读取文件 -为了读取文件,系统调用还指定了文件的两个名称和读取指针。 在目录中搜索给定的条目,系统跟踪读取的指针。 一旦读取完成,读取指针就会更新。 对文件的读写操作使用相同的指针。

  4. 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.

    删除文件 -首先要搜索文件,然后搜索目录,然后删除目录。 之后,我们释放空间,以便其他文件可以重用该空间。

  5. 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值