UNISA Chatter – Operating System Concepts: Part 10 … File System Interface

See UNISA – Summary of 2010 Posts for a list of related UNISA posts. If you are not studying at UNISA you should probably give this materials summary post a miss 🙂

Last time we looked at virtual memory … today we get closer to the metal and start investigate the file system interface.

The File

A file is an abstract data type, a “thing”, which is defined and implemented by the operating system. The main task of the operating system is to map the logical file concept onto physical storage devices, such as disks or tapes.

A file

  • Has a type (.com,.bat,exe,…) which can either be known and managed by the operating system, or leaving the interpretation to the application process.
    • Some systems allow different file file operations based on type.
    • For general purpose systems it is more effective to implement only basic types and grant maximum freedom to the processes.
    • For specialized systems, i.e. a database system, it “may” be more efficient to implement the logic in the operating system.
  • Consists of a sequence of logical records, which can be of type byte, a fixed or variable length line, or a complex data type (structure).
    • The O/S becomes bulky and complex if it supports too many file structures.
    • Assuming a file to be an array of bytes and deferring interpretation to the applications ensures that the O/S is simplified.

Basic file operations

  • create .. find space for the file and make an entry in he directory.
  • open … find file and determine if it has already been opened. If not open search directory, cache information, add entry in per-process open-file table. If open check lock and cache information if lock can be acquired. Increment the open count.
  • close … decrement the open count and remove the file’s entry from the open-file table if count reaches zero.
  • read … read data from the file.
  • write … write data to the file.
  • delete … search directory, release file space and erase directory entry.
  • reposition … reposition the file position pointer. This is more commonly known as seek.
  • truncate … delete content of a file, but keep file properties.
  • lock … file locks provide concurrency control. A shared lock allows multiple “readers” to acquire a lock concurrently, while exclusive lock ensures only one “writer” can modify a file.
    With mandatory locking the operating system ensures locking integrity, while with advisory locking the application process ensures that the correct locking strategy is followed. The Windows operating system uses the mandatory locking strategy.

File access

  • Sequential … process files from beginning to end, in order, one record after the other. For example if we want to read a document from beginning to end, we typically start at the beginning and read page, by page until we reach the end. 
  • Direct … process file by accessing the content in no specific order. For example, if we only want to read page 1013 it makes sense to to reposition (seek) to page 1013 and read the page.

Directory Structures

A disk is typically partitioned, also known as slices and minidisks. The device directory or volume table of contents records and maintains the file properties such as name, size, type and location.

  • Single-Level Directory … all files are contained in the same directory, which can be a daunting directory structure as number of files increases. Using long filenames and using the character “.” we could (but really should not) simulate multi-level directory:
  • Two-Level Directory … each user has his own user file directory, which contains the files for each user. 
  • Tree-Structured Directory … an extension to the two-level directory to a tree of arbitrary height. Each directory can contain one or more directories and/or files.
  • Acrylic-Structured Directory … allows directories to share sub-directories and files. The sharing is achieved by creating links that point to another file or directory, implemented as an absolute or relative path.


  • Absolute path … begins at the root and follows a path down to a specified file.
    Example: c:\temp\x\demo\testing\hello.cpp
  • Relative path … defines a path from the relative path.
    Example: if we are located in c:\temp\x and relative path is ..\test\log.txt, then its absolute path would be c:\temp\test\log.txt

Consistency Semantics

The semantics specifies how multiple users of a system are to access a shared file simultaneously.

  • UNIX Semantics … writes to an open file are visible immediately to other users that have the file opened.
  • Session Semantics … writes to an open file are no visible to other users that have the file opened. Once closed, changes are only visible to subsequent sessions.
  • Immutable-Shared-Files Semantics … contents of a file are fixed and both its name and content are immutable.


Security and protection will be covered later. At this stage we will merely make the following notes:

  • Protection is concerned with keeping data safe from improper or unauthorized access and physical damage … the latter had me going on my desktop for weeks, when faulty memory resulted in the disk data being corrupted, technicians replacing disk, after disk and the problem not going away … until by chance, I decided to swap the memory as part of an error exploration.
  • We can control access to files, specifying who and how can read, write, execute, delete and list files.
  • Access control has a number of strategies:
    • Access control list (ACL) specifies user names or groups, and types of access.
    • Associate passwords and access control (read only, modify with tracked changes) per file.

Next time we will look at file system implementations … in other words putting theory (above) to practice. In a later post we will also look at distributed file systems … another topic that is relevant to the above.

Comments (5)
  1. vcl says:

    very good

  2. geeta says:

    very good , every topic is clearly explain…..

  3. deep. says:

    very good sir…thanx

  4. aver says:

    very nice,,,,

  5. sherif says:

    Great topic 🙂

Comments are closed.

Skip to main content