Arlon's CSUMB Intro to Operating Systems CST-334 Module 4 Learning Journal #4/#28 for the week Wed 07/14-Tues 07/20, year 2021
Arlon's CSUMB Intro to Operating Systems CST-334 Module 4 Learning Journal #4/#28 for the week Wed 07/14-Tues 07/20, year 2021
This week in class we studied OS paradigms for memory management some more, which has to do with where the OS decides to put the actual memory while serving virtual memory addresses to programs and itself.
Journal spec: write a 1 - 2 paragraph description of what you learned this fourth week in CST 334 Topic: Memory Virtualization:
The way that the OS provides the illusion of private address spaces for each process is that there is an address translation with a page table each process generates - so that each program can get the same or relatively arbitrarily related labels for each process's virtual memory addresses while the OS translates the assigned labels to the actual RAM memory addresses using the page tables. The OS keeps a free list of available addresses so it knows where it can put what. There are various schemes used as to when to swap what pages- least recently & most frequently accessed, FIFO like lab, and even just random turns out to be one of the better swap algorithms for not having any edge cases.
The page table also can have various bits to designate the state of the page like valid/program running, protection (r/w/x), present(swapped out), accessed, dirty (modified), user/superuser, to help out the page replacement algorithm. (pg 190, 191, textbook)
Once you get the page in RAM, then the virtual addresses are encoded in the number of bits that is the log base 2 of the address space and by splitting off a page section and an offset section, the offset section being the size that is the log base 2 of the page size, the page section being the difference. To make translation fast, there is an address index cache called a TLB for common addresses. I felt like these points were blended in the book but they're whole different points. First get the page with the process's page table, then get the bit at that address, with a translation, looking at the TLB first, right?
I'm not positive I understand all the address translation games which did not seem to be explained well anywhere but I think that's because it's fairly simple - if they say the address space is 64 bytes think 2^6 and subsequently 6 boxes for the virtual address size, then if they say the page size is 16 bytes think 2^4 and subsequently 4 boxes split out of the address for the offset and the other two for the page number. (4=log2 16) And if you think about it, that does totally make sense because the maximum of that many boxes if you fill it out with 1's 1111 in binary is 15, the biggest number under 16 (so with 0, there's 16 addresses). So that's why you need 4 squares from 16 bit pages and 6 squares for a 64 byte address space (& etc, for all the other powers of two). And same with the page number 11, in binary is 3, giving room for four sixteen bit pages (0,1,2,3) of the 64 byte address space. I'm sort of summarizing what I get out of page 187 from the book here.
I think this is a little confusing - and I could be completely wrong about all of this - but I think because there's a similar data block that looks like the memory address within the page but that is the page address within the RAM or disk, ie you see the split block of bits page number/page offset in two contexts - one context for the getting the pages - another context for getting the memory addresses within the page. Please correct me if I'm wrong, this is just what I get out of all of this, I'm not saying I know for sure here, this is my current understanding.
I understand why the book adds incrementally complex conceptual information on top of simpler conceptual information but then when they keep going back saying that's not a good enough design, we can design it better, it seems like it becomes difficult to keep track of what parts of the design we're throwing out and what parts we're keeping, ie bouncing from segmentation to paging, to segmented paging to just paging without segmentation - it seems like it gets hard to keep track of all the details they want you to keep and which details they want to throw out, and that's with regard to several of these topics, at least for me.
This week I spent three days devouring the material, several hours writing down all the glitches, mistakes, inconsistencies and glaze-overs in the class lecture videos, three more days waiting for a response to my question in the discussion to grant enough detail to be included with the instructions for the assignment to even do anything with it, a half hour or so on the assignment once I got the instructions, and then several more hours writing about all kinds of problems with what is going on, several more hours redoing the assignment once more information about the spec was given by the students but never confirmed by the teacher. I learned that this class's instructions were so vague this week I don't know how the other students progressed. Luckily one student was able to give me the logic (I hope!) I needed to write the assignment, basically I needed something like "Pretend the integers from the file accesses.txt are pages - add to the skeleton file so it fills the array up, and also a queue at the same time - pretend that the array and the queue together are RAM - there's no swapping - just putting of the integer from the file into the queue and the array, or, removing the head one from the queue if there's no room left, since it's FIFO. Also you have to linear search the array to find the head of the queue in it, around the time you dequeue (simplest right before). The operating system would be moving vast amounts of data in and out of RAM, not just an integer, if the lab simulation were more true to what it was trying to simulate. " This is attempting to demonstrate the algorithm known as FIFO page replacement. And right now it's looking like the part about there being an array and a queue is wrong, but I asked that question in the discussion and it was ignored as almost everything is.
I had a blast actually completing the actual programming assignment. But I had to ask like 10 context questions before I could even begin, and then I've been second guessing the whole thing since it was assigned - was I guided wrong? Is there swapping? Does it stay in the queue? No. Otherwise why would they have told me to dequeue? Anyways I wouldn't be second guessing or spending all this time guessing what this assignment were about if it just had that one simple addition of instructions to the assignment - if indeed that's correct - which I wouldn't know because only other students are making realistic confirmations in the discussion, not the instructor.
As far as learning C this week or bash, ok, I picked out my anonymous function from last week's blog and used that for the linear search - I don't think I'm going to post it here because it's similar to last week's post, it's part of the homework, and I already spent enough time this week on stuff that didn't need to be done. I liked the bash loop testing script the teacher gave us on the side, it had some useful stuff in it. Yeah - and right now it's looking like there is no linear search, so all facets of that whole exerpt are a mute point. This is what I'm talking about with the vague and missing instructions. So much mis-communication has gone on this past week we could fill an encyclopedia with all wrong-stuff probably.
Making instructions non-existant or non-sensical doesn't teach people how to be good programmers and solve hard programming problems. Missing instructions is not a hard programming problem - that's missing instructions. A hard programming problem - there are tons of them - visit codesignal.com for thousands of examples. Every one of them has instructions. Leaving out the instructions doesn't make the easy problem hard it just makes it stupid impossible and exasperating.
Homework is supposed to be hard because you don't know how to do it yet, not because they're hiding the instructions from you and you don't get to know what the homework even is unless you beg for the instructions. That's next level to think that's a good way to teach discovery. We have to discover what it is you want us to discover on top of the thing that it is we're already discovering?
Comments
Post a Comment