Week 7 - Persistence

This week felt very jam packed due to it being sort of the last week of class before the final. The material that was covered were I/O devices, hard disks, and persistence with file systems. Learning about I/O devices has been interesting as we look at the model of the memory and I/O architecture. I have learned there are two different I/O devices, one being the block devices such as the hard disk and character devices such as printers, mouses and keyboards. The structure of I/O devices resembles parts that are in a computer such as CPU, memory, special purpose chips, though the biggest piece is the hardware interface which has a set of registers. These registers are the status register which correlates to the device status, command register which tells the device to do something like read or write, and data register which it uses to pass data to/from the device. The devices interact with the CPU in multiple ways such as polling, when it writes to a disk block it sits in a while loop waiting for the device to be done and this can potentially waste CPU cycles. Another way to interact with the CPU is through interrupts where if the device is writing to a disk, it can instead allow another device to do something while it waits for the previous device to finish. Though the problem with it, is the handling of interrupts which imposes kernel mode transitions such as context switching which would cause much more overhead. In some cases polling may be faster than interrupts if the device is fast. The last method is through direct memory access, there is a special piece of hardware called the DMA engine that copies from main memory to device. In this case the CPU gives DMA the memory location of the data, in a read an interrupt will be raised after the DMA completes, in a write the disk starts writing after DMA completes.

Other materials that were covered this week that stood out to me were learning about disk drives and their performance. I've learned how to calculate the average rotational delay, access delay, transfer delay and the total disk access delay. In addition the lecture covered the different disk scheduling involving different ways the disk scheduler decides the order in which disk requests may be processed. One way is the shortest seek time first or SSTF. It decides that the closest track where the head is currently at will be the next request. The problem is that starvation may happen to the requests far from the current position of the head. The other methods are the elevator/SCAN algorithms. In an elevator scan, the head will sweep from outer to inner then inner to outer. The problem with this one is that the middle tracks will be requested more often then the outer and inner tracks. In the C-Scan the sweep will only go in one direction which is from outer to inner then it circles back to the outer and starts again. This way it won't favor the middle track more and be a bit fair. The F-scan freezes the queue while scanning. Lastly to wrap up the week was learning about the file system and how a file and directory are created and how they exist on disks. A simple file system contains a data region, an inode table, inode bitmap, data bitmap, and a superblock. 

This week went by very quick and the final is underway so I have to squeeze as much as I can from this weeks material. It will be quite difficult but I think I will manage. 

Comments