CST334 - Week 7

Week 7 Reflection

This week, we covered a lot about persistence, and how the OS interacts with files, directories, and I/O devices. 

I/O devices can range from memory buses to hard drives to keyboards. For a canonical I/O device, the canonical protocol is:

While (STATUS == BUSY)
; // wait until device is not busy (polling the device)
Write data to DATA register
Write command to COMMAND register
(Doing so starts the device and executes the command)
While (STATUS == BUSY)
; // wait until device is done with your request 

The basic protocol to interact with an IDE disk is:

  1. Wait for drive to be ready (polling).
  2. Write parameters to command registers.
  3. Start the I/O.
  4. Data transfer.
  5. Handle interrupts.
  6. Error handling.

I/O time, or TI/O, is calculated by the seek delay + rotational delay + transfer delay. In other words, 

TI/O = Tseek + TrotationTtransfer

The rate of I/O is the size of the transfer divided by the I/O time, or

Sizetransfer / TI/O

Disk scheduling is similar to job scheduling, however the length of a disk request (read: job) can be estimated by calculating the . Some disk scheduling approaches include SSTF (shortest seek time first), nearest block first (NBF), and elevator (sometimes known as SCAN or C-SCAN). To avoid resource starvation, elevator sweeps back and forth across a disk and handles requests if they haven't been serviced yet. Elevator queues requests that have already been handled behind the sweep.

Files and directories both include inode numbers, though directories use it in a pair with user-readable names first. An example would be: ("directory_name", "25").

 

Comments

Popular posts from this blog

CST300 - Week 4

CST300 - Week 2

CST300 - Week 5