Programming Assignment 2 - Device Management

Operating Systems, Fall 2000


Table of Contents

Due Date

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

Introduction

This assignment extends the operating system developed in the previous assignment by adding device management features. This new version of the operating system gives user processes access to the disk and terminal devices, and lets the user process read and write data to and from the disk and terminal.

Device Allocation Policies

A device allocation policy determines how and when a user process may obtain access to a device.

Disk Allocation

The disk allocation policy provides unlimited concurrent access to the disk by allowing the disk to be opened by any number of processes. This means the open system call should never return device::device_busy.

Terminal Allocation

The terminal allocation policy provides exclusive access to the terminal by allowing the disk to be opened by at most one process. Any process that attempts to open the already opened terminal should receive the device::device_busy status code in response to the open system call.

Device Management Policies

A device management policy determines what a process may do to a device, and how the device behaves.

Disk Management Policy

The disk management policy presents the operating system's view of the disk to the user process. A user process' view of the disk is the same as the operating system's view of the disk; that is, the disk appears to a user process as an C-style array of disk blocks.

This policy is known as raw disk management, and is important for those application, such as data-base applications, that need to control all aspects of data movement between disk and primary store.

Terminal Management Policy

The terminal management policy makes the terminal appear to a user process as a character-oriented device which can read and write a variable-number of bytes in one operation.

The terminal management policy also specifies the terminal line discipline (or just "line discipline" when the terminal part is understood), which specifies how, if at all, the operating system should interpret the characters begin read and written from the terminal on behalf of the user process. The input line discipline applies to the characters being read from the terminal, and the output line discipline applies to the characters being written to the terminal.

The input line discipline in this project is simple: the operating system does not interpret any of the bytes read from the terminal except for the device::eof_char end-of-file character, which, whenever it appears in the input stream, should be removed and presented to the user process as the end-of-file.

The output line discipline is even simpler than the input line discipline: there is none. All bytes from the user process are passed along to the terminal without interpretation.

System Calls

The test programs your operating system will execute now make six system calls: sleep, exit, open, close, read, and write. This assignment implements the last four system calls (open, close, read, and write).

Interrupt Handlers

This assignment also implements the last two remaining interrupt handlers: illegal instructions and the terminal interrupts. If a user process throws an illegal-instruction interrupt, your operating system should terminate it, recovering any resources it may hold.

Test Device Files

Because this assignment involves two devices (the disk and the terminal), the device files come in pairs: one for the batch disk and the other for terminal input. There are two device-file sets one (pa2-one.tty and pa2-one.dsk) and two (pa2-two.tty and pa2-two.dsk). You should run your operations system on each file in a pair, as in
my-os -t pa2-one.tty -d pa2-one.dsk

The programs in batch-disk set one are well-behaved; the programs in batch-disk set two are unruly. I recommend getting your operating system to work with set one before going on to set two. None of the programs in either set clobber the programs on the disk. None of the processes will increase or decrease the amount of space in Primary-Store they occupy while executing; a program that loads in n disk blocks will always occupy n disk blocks in Primary Store.

Because programs in both device-file sets write to devices, the simulator will create the result files results.dsk and results.tty.


This page last modified on 19 October 2000.