Journal 29

 August 6 - August 12

After this Friday: FREEDOM (for two weeks)! I cannot put into words how bad I need a break from school. Hopefully my trip to D.C. will refresh me for the fall semester. The cooler weather along with the approach of Halloween will definitely lift my spirits. Not to mention, some places will have snow starting in October, so that is a big thing to look forward to. 
Anyways, for my final OSTEP summary of the course:

Chapter 36 focused on I/O devices and the specifics on how the OS interacts with input/output hardware. The hierarchical bus design contains quicker devices such as the memory bus close to the CPU, while slower ones such as USB are situated in the peripherals further away from the CPU. Per the canonical device model, the hardware interface contains the status register, command register, and data register. Internals might include the CPU, memory, and hardware-specific chips. I/O protocol typically goes as follows: poll the device until ready, send the data, send the command, and poll until done. However, polling wastes CPU cycles for slow devices. In order to improve efficiency, interrupts allow for the device to signal the OS when it is done, which is better for slow devices but can actually be worse for fast ones due to context switch overhead. Using hybrid polling along with interrupts allows for brief polling, then the use of interrupts. Direct memory access (DMA) offloads data transfers from CPU to the DMA engine, thus freeing the CPU for other tasks. 

Chapter 37 delved into hard disk drives structure and performance factors. The interface of which is an array of numbered 512-byte sectors, with only single-sector writes guaranteed atomicity. Physically, the structures consist of platters with magnetic surfaces, tracks of concentric circles of sectors for each surface, and a disk head on an arm that can move between tracks. The time spent waiting for a desired sector to rotate under the head is referred to as rotational delay, moving the head to the correct track is called seek time, and reading and writing once the head is in place is known as transfer time. For optimization, the text recommended track skewing to align data across different tracks, zoning outer tracks to have more sectors, and on-drive caches. The I/O time equation is key for this week's learning: TI/O= Tseek + Trotation + Ttransfer

Chapter 39 explained the abstraction and interface of files and directories in UNIX-like systems. Files are linear arrays of bytes with low-level IDs (known as inodes), and the OS stores them without interpreting the contents. Directories, on the other hand, map human-readable names to inodes and form a hierarchy starting at /. Some key system calls include open() with O_CREAT to create, read(), write(), close(), and lseek() to change current file offset. File descriptors are per-process integer handles to open files that point to system-wide open file table entries. The open file table tracks offset, permissions, and the inode pointer. Offset management grants sequential access updates that offset automatically. fork() and dup() can make processes share file table entries.

Chapter 40 introduced vsfs to illustrate core file system concepts. The on-disk layout contains the superblock (file system metadata), bitmaps (track free vs. allocated inodes and data blocks), inode table (array of inodes), and data region (stores file contents). Inodes are important as they store file size, ownership, timestamps, permissions, and block pointers. Direct pointers, of course, point directly to data blocks. Indirect pointers point to blocks that contain more pointers. The file access flow begins with a system call, locates the inode, follows block pointers, and reads the data blocks. Some design trade offs include pointer-based being flexible, although metadata-heavy, and extent-based being compact but much less flexible if the disk is fragmented.   

Comments

Popular Posts