CST334 week 7 (31/100)

 This week we discussed persistence and I/O. We reviewed the two types of i/o devices, block devices and stream devices. Block devices are like hard drives that have a fixed size of data that can be accessed randomly. Stream devices generate a stream of bytes that are not addressable; they come in a stream and are ephemeral. Each i/o device has its own hardware that is like a computer and has 3 registers. Status register is read to check the device state, command register to execute read, write or seek commands, and data register to actually transfer data.


There are three ways to interact with devices: polling, interrupt-driven, and DMA. Polling put the cpu in a tight loop checking the status register and when the device is idle, executing a command and transferring data. It has the least latency. Interrupt driven uses less cpu because instead of a loop it puts the thread or process to sleep while waiting for the device. DMA uses special hardware to copy data from a device to a memory location all at once and only raises a single interrupt when the transfer is done. This is very efficient for large transfers from block devices.


We learned about hard disk drives and how to access them. CHS is the old school way that I learned in the 80s. LBA is modern and virtualizes the physical location to a linear addressing scheme. We studied how to calculate access times which takes into account the physical properties of a spinning disk and moving head, breaking that wall of virtualization. Sometimes we can’t escape physics.


We studied files and directories. Files hold data and are referenced by an inode. Directories hold the files’ names, and are also referenced by an inode. Hard links and symlinks were discussed and the differences between them. Also reviewed the file and directory system API that gives the crucial functions necessary to interact with files and directories.


File system implementation study focused on calculations to translate between inode and a location on disk using the disk address, block number, offset in block, and finding the inode index in the block, so we only need to load one block instead of scanning the whole inode table.


Lastly we used the VSFS simulation to study how different API commands impact the inodes and data. 


Sharing I/O devices is a necessary role of an operating system. Especially hard drives because they offer persistence. Access to I/O devices highlights the other two major concerns of an operating system. The physical devices are virtualized and they can be accessed concurrently. 


Comments

Popular posts from this blog

Week 2/100

week 15-16/100

week 8/100