uocis  CIS 415 Operating Systems - Spring 2003

Discussion: Week 9

Solutions

File Organization

Consider the following types of files and classify them according to the given parameters.
In particular:
  • Is the file unsorted (U) or sorted by key field (K), chronologically (C) or by hash function on a key field (H)?
  • Does the file use fixed-length (F) or possibly variable-length (V) records?
  • How many indexes (N=none, S=single, M=multiple) are embedded in the file?
  • What type of index (P=partial, X=exhaustive, B=both) is most commonly used?
Sort[UKCH]Records[FV]Index(es)[NSM][PXB]
Pile    
Sequential    
Indexed Sequential    
Indexed    
Hashed    

What would be the best file organization to use for the following applications and why?

  • Output from a simulator

  • Large financial database

  • Phone book (common use - i.e. look up only by name)

  • Spell check dictionary (look up entries by how the word "sounds")


Just as a note, non-database files usually have a mix between pile and indexed organizations. The records are usually all of varying length and type (i.e. having different fields). The first few "header" records sometimes act as indexes to the other data records, but in other situations the records have a fixed order to them.

In this "binary" type of file, the OS does not know about the individual records and so just stores the file as one big, long string of 1's and 0's (similar to variable blocking with spanning).

File Storage

Consider a file whose records contain varying amounts of data. In this file, every even-numbered record (beginning with record 0) contains 100 bytes of data and every odd-numbered record contains 75 bytes of data. The file contains 100 records.

Suppose that the blocks on the hard disk are 550 bytes long.

How many blocks does this file occupy if Fixed Blocking is used?

...if Spanned Variable Blocking is used?

...if Unspanned Variable Blocking is used?


Created by: Tim Singer June 3, 2003