Weeks 30 & 31
And now here I am at the end of our fifth class in the program. I don't know whether or not its too early to say I'm past the 50% mark yet. I can't say I'm not nervous going forward with the program, I still have a foreign language requirement to consider, and the capstone is still something I have more questions than ideas for. Still, I have asked the questions about the language requirement, and I have a couple of potential questions about the capstone drafted to ask later, once the Operating Systems final is over and done with. There is something that's been settled: I'm using Sam's format for these journal posts going forward. So much more interesting to write about.
As for week 7's topics, we covered:
I/O Devices - Things like mice, disk drives, and keyboards and the various busses used to connect everything together. A fair bit of what was covered here had been seen, albeit briefly, elsewhere. Or, at least, I had seen it elsewhere, can't remember at time of penning this if it was early in this class or somewhere else. The topic also went into Programed I/O, sometimes called 'polling', and its inefficiencies, as well as a reintroduction with interrupts and how they help improve the efficiency of PIO by letting the CPU work on something else while waiting for a disk to perform the read, instead of just spinning wastefully. The book mentions a two-phased, or hybrid approach that uses a combination of PIO and interrupts to try and harness the best of both worlds, and the risk of a live lock, where only interrupts are being processed and not whatever program it was servicing before. Direct Memory Access (DMA), is an even more efficient method moving data. Without it, the CPU would need to need to copy data from memory to the device explicitly, one word at a time. Only when that copy is complete does the I/O begin on the disk, freeing the CPU to work on something else. If a DMA engine is involved, then the OS would only need to tel it wher the data is in memory, how much to copy, and where to send it to. Once that's done OS swaps to a new process while the DMA handles the copy work. When the DMA finishes, it raises an interrupt, saying it's done, and the OS swaps back. There was also a section on device drivers in general and how to make OSs "device-neutral", which I took as "keeping the details of device interactions on a need-to-know basis," and, as such, as another way abstraction is used in an OS.
Hard Disk Drives - The primary form for persistent memory storage in computers, and have been for decades. This chapter, admittedly, didn't have very much that was new to me. Perks of having a father who worked with computer hardware for a living. The mathematics that went into calculating an HDD's performance, however, were more interesting, this chapter being the first time I've seen integrals since I got my transfer degree. Then came the section on Disk scheduling, which isn't to much different from the task scheduling we did earlier in this class. Starting from Shortest Seek Time First (SSTF) which orders the queue of requests by track, picking the requests on the nearest track first. The host OS cannot see the geometry of the HDD, only an array of blocks. This is easily fixed with the Nearest Block First (NBF) policy which relies on block addresses instead, albeit at the cost of risking starvation. Then there's the "Elevator" algorithm and its cousins SCAN, F-SCAN, and C-SCAN. The name Elevator comes from the fact it behaves like one. The book uses the example of "going down from floor 10 to 1, and somebody got on at 3 and pressed 4, and the elevator went up to 4 because it was “closer” than 1." I would be annoyed if that was how it worked in real-life, but that wasn't the point of the example. The example was trying to demonstrate how the elevator algorithm prevented starvation, and I personally don't think it did that good a job. There was a mention of a policy called Shortest Positioning Time First, but it wasn't dwelled upon. At least I have a name for what its called when almost every question regarding trade-offs is "it depends": Livny's Law.
Files and Directories - This chapter wasn't particularly exciting. Like the one on HDDs, this was more of a trip down memory lane. Files, Directories, Directory Trees, Sub-directories, Absolute pathnames. It's all just what goes on in a computer's file explorer. Inodes on the other hand were a new subject, but were only briefly mentioned in this chapter of the book. I don't know whether to take the lack of new material here as a good thing or a bad thing, really. The book itself admits, that the UNIX file system interface is "seemingly quite rudimentary," but it does strangely come across as a "quick to learn, slow to master" sort of subject.
File Systems, Inodes, and Blocks - This is where the new material started turning up. The Inodes that were mentioned in the last chapter were expanded upon here. 'Inode' is shorthand for 'Index Node', and each one is implicitly referred to by a number (called the 'i-number', there's the genius naming conventions again), which can be used to calculate where on the disk the inode is. The chapter also covered metadata (previous chapter did, too. Chose to mention it here instead) which is the little extra bits and pieces of information about a file. What kind of file is it, who owns it, how big is it, when was it last modified. That sort of stuff. There was also a discussion on what the superblock was. The superblock, in layman's terms, is the table of contents for an entire disk. It stores metadata about the entire filesystem its for and has multiple backups in other places. That's for good reason. The OS needs the superblock so it knows how to interpret the filesystem. If something were to happen to the superblock, the entire filesystem could be rendered unusable!
With all the familiarity this week, I'm having more of a hard time coming up with what to say than I was with the material. Similar story with 'aha' moments, unless you count 'I've seen this before' moments alongside them.
Considering that this'll be the last blog post for the Operating Systems course, I don't have particularly many questions this time. There is the one: Would it be alright if I went and downloaded the textbook form the course modules? If not, Where can I get a copy for myself? I like style the textbook was written in. It's very entertaining on top of informative.
Comments
Post a Comment