22 #include "copyright.h" 25 #define SectorSize 128 // number of bytes per disk sector 26 #define SectorsPerTrack 32 // number of sectors per disk track 27 #define NumTracks 32 // number of tracks per disk 28 #define NumSectors (SectorsPerTrack * NumTracks) 59 Disk(
const char* name, VoidFunctionPtr callWhenDone,
int callArg);
70 void WriteRequest(
int sectorNumber,
char* data);
82 VoidFunctionPtr handler;
90 int TimeToSeek(
int newSector,
int *rotate);
91 int ModuloDiff(
int to,
int from);
92 void UpdateLast(
int newSector);
int ComputeLatency(int newSector, bool writing)
Disk::ComputeLatency() Return how long will it take to read/write a disk sector, from the current pos...
Definition: disk.cc:236
The following class defines a physical disk I/O device. The disk has a single surface, split up into "tracks", and each track split up into "sectors" (the same number of sectors on each track, and each sector has the same number of bytes of storage).
Definition: disk.h:57
~Disk()
Disk::~Disk() Clean up disk simulation, by closing the UNIX file representing the disk...
Definition: disk.cc:79
Miscellaneous useful definitions, including debugging routines.
void HandleInterrupt()
Disk::HandleInterrupt() Called when it is time to invoke the disk interrupt handler, to tell the Nachos kernel that the disk request is done.
Definition: disk.cc:165
Disk(const char *name, VoidFunctionPtr callWhenDone, int callArg)
Disk::Disk() Initialize a simulated disk. Open the UNIX file (creating it if it doesn't exist)...
Definition: disk.cc:46
void ReadRequest(int sectorNumber, char *data)
Disk::ReadRequest/WriteRequest Simulate a request to read/write a single disk sector Do the read/writ...
Definition: disk.cc:119