Operating Systems 1

Tutorial 9 solutions

  1. UNIX has a daemon process which periodically writes dirty blocks from the block cache to disk. Why?
    Simply because otherwise blocks might remain in the cache indefinitely, and never be written out. If the system were to crash, the blocks on disk might be very out of date.
  2. What is the advantage of a journalled file system (or database)? Disadvantages?

    Advantages: every transaction (reads and writes) is written on the journal as it is made. In the event of a crash, no data whatsoever is lost, since the database or filesystem may be reconstructed from the last backup, and the transactions stored on the journal.

    Disadvantages: every transaction must be stored, which slows down transactions, and may require large amounts of storage space to store the journal.

  3. Distinguish between a full backup and an incremental backup.
    Full backup copies all of the files on the filesystem to the backup medium. Incremental backup only copies the files which have changed since the last (full or incremental) backup.
  4. In UNIX, what are two differences between 'character devices' and 'block devices'?
    • Character devices are read and written a 'character' (actually a byte) at a time; block devices are read and written in units of blocks (typically a power of two bytes, such as 512 bytes, or 2K).
    • Character devices are serial access devices; block devices allow random access.
  5. Why is device independence an important goal for operating systems?

    It means that programs can be written which take or put data from or to any device or file. User software need not concern itself with the idiosyncrasies of physical devices.

  6. What's an advantage of a UNIX-style unified namespace for files and devices, over the MS-DOS approach of separate namespaces for each device?
    • Device-independence: difficult to tell from a name what device or file it refers to.
    • Flexibility for the user: users may configure the namespace by mounting devices and filesystems anywhere within the root filesystem.
  7. Describe the tradeoff in UNIX-style file protection bits, versus a full-blown protection matrix.

    UNIX protection bits: 9 bits stored with each file/device to say whether the (owner, group, everyone else) is allowed to (read, write, execute) it (plus a record of who the 'owner' is and what the 'group' is for the file). Protection matrix: store a big table which says for each file/device which users are allowed to do what with the resource.

    Protection matrix is far more general, but complicated to store, and potentially very large. Protection bits are very much simpler, smaller, and suitable for many purposes, though not fully general.

  8. What is an access control list?

    Lists for each resource (file, device) what users (strictly speaking, protection domains) have access to the resource, and what form of access they are allowed (read access? write access?...).

    It is equivalent to (stores the same information as) a protection matrix.