Asynchronous Physical Disk Module
Role in the System
The purpose of this module is to simulate a physical disk. This is implemented as reads and writes to UNIX files. The pertinent NACHOS files are disk.h and disk.cc. Since it is asynchronous, the class "disk" immediately returns and signals to the CPU (via an interrupt) that a read/write request has completed. This is done by the pointer "callWhenDone". The emulated disk is single-sided and divided into tracks; each track is further divided into sectors. Access to a disk location is done by sector numbers. The address is calculated as follows:
sectorNumber = track*SectorsPerTrack + offset
If the machine should unexpectedly fail, the contents of the disk are preserved. However, if the operating system is in the process of completing a file operation, the file system may potentially be corrupted. One of the assignments for NACHOS involves implementing a synchronized disk to control reads and writes more rigorously.
Uses Relation