Programming Assignment 4 - File Management

Operating Systems, Fall 2001


Table of Contents

Due Date

This assignment is due on Wednesday, 12 December, no later than 2:00 p.m..

Introduction

In this fourth and last assignment, you will be implementing a simple file system.

Files

A file is a sequence of zero or more words; the size of a file is the number of words contained in the file. An empty file contains no words and has size zero. A file has no predefined maximum size; it may grow until there's no more disk space.

The words in a file of size n are addressed by the numbers 0 to n - 1. The first (or leftmost) word in the file is word 0; the last (or rightmost) word in the file is word n - 1. If two words are adjacent in a file and the first word is word i, then the second word is word i + 1; that is, word address increase consecutively and sequentially from the start of the file.

File Operations

A file pointer is a reference to a word in the file, or to the location just past the last word in the file, which is known as the end-of-file location.

When a file is opened, the file pointer references the first word in the file, or end of file if the file is empty. Read and write operations take place relative to the file pointer, and move the file pointer to reference the word after the data read or written, or the end of file.

There is one file pointer per opened file. If a file is opened more than once, it will have more than one file pointer; for example, a file opened three times will have three file pointers. File pointers are independent of one another; an operation affecting one of a file's file pointers doesn't affect any of the other file pointers.

The File System

The file system is a simple, flat file system. A file is identified by a 32-bit integer called the file tag.

System Calls

This assignment implements two new system calls - the seek system call and the delete system call - and extends the interpretation of the device system calls to cover files.

Interrupt Handlers

This assignment does not require any new interrupt handlers, although you'll probably have to add some code to your system-call interrupt handler.

Notes

Test Files

  1. pa4-basics.dsk - Runs through a bunch of simple file-io commands.

  2. pa4-stats.dsk - Stresses the file system by fulling it up and emptying it a few times. Prints statistics when it's done.


This page last modified on 24 November 2001.