COMP 314 - U3C10

Operating System Concepts, Seventh Edition

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 314 – Unit 3 Chapter 10 (File-System Interface) File Concepts (374) A file is a named collection of related information that is recorded on secondary storage. File Attributes A name is usually a string of characters, with case sensitivity varying between systems. A file's attributes vary, but typically consists of these: Name Identifier – Unique tag, usually a number, identifies the file within the file system; it is the non-human-readable name for the file. Type – This information is needed for systems that support different types of files. Location – This information is a pointer to a device and to the location of the file on that device. Size – The current size of the file (in bytes, words, or blocks) and possibly the maximum allowed size are included in this attribute. Protection – Access-control information determines who can do reading, writing, executing and so on. Time, date, and user identification – this information may be kept for creation, last modification, and last use. These data can be useful for protection, security, and usage monitoring. The information about all files is kept in the directory structure, which also resides on secondary storage. File Operations (375) A file is an abstract data type. An operating system can perform size basic file operations: Creating a file Two steps are necessary to create a file: First, space in the file system must be found for the file. Second, an entry for the new file must be made in the directory. Writing a file To write a file, we make a system call specifying both the name of the file and the information to be written to the file. The system searches for the file, given the file name. A write pointer is kept that points to the next location in the file to write to, which is updated whenever a write occurs. Reading a file To read from a file, we use a system call that specifies the name of the file and where (in memory) the next block of the file should be put. A read pointer is required to locate where the next read should be from. The current operation location can be kept as a per-process current-file-position pointer. Both the read and write operations use this same pointer. Repositioning within a file The current-file-position pointer is repositioned to a given value. Also known as a file seek. Deleting a file Find the file in the directory, and release all file space and erase the directory entry. Truncating a file The user may want to erase the contents but keep its attributes. Lets the file be reset to length zero and its file space released. These six basic file operations comprise the minimal set of required file operations. (376)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

COMP 314 - U3C10 - COMP 314 Unit 3 Chapter 10 (File-System...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online