CS代考 COMP 3430 Operating systems – Chapter 13 and 15 reading notes

COMP 3430 Operating systems – Chapter 13 and 15 reading notes
Winter 2022
About these reading notes
Chapter 13: The abstraction: Address spaces

Copyright By PowCoder代写 加微信 powcoder

13.1Earlysystems………………… 13.2 Multiprogramming and time sharing . . . . . . . . 13.3Theaddressspace……………… 13.4Goals……………………. 13.5Summary…………………..
Chapter 15: Mechanism address translation
15.1Assumptions ………………… 15.2Anexample…………………. 15.3 Dynamic (Hardware-based) relocation . . . . . . . 15.4Hardwaresupport:summary . . . . . . . . . . . . 15.5Operatingsystemissues…………… 15.6Summary…………………..
…………….. 2 …………….. 2 …………….. 3 …………….. 3 …………….. 3
…………….. 4 …………….. 4 …………….. 5 …………….. 5 …………….. 5 …………….. 6

COMP 3430 Operating systems – Chapter 13 and 15 reading notes Winter 2022
About these reading notes
These are my own personal reading notes that I took (me, Franklin) as I read the textbook. I’m pro- viding these to you as an additional resource for you to use while you’re reading chapters from the textbook. These notes do not stand alone on their own — you might be able to get the idea of a chap- ter while reading these, but you’re definitely not going to get the chapter by reading these alone.
These notes are inconsistently all of the following:
• Mesummarizingpartsofthetext.
• Mecommentingonpartsofthetext.
• Measkingquestionstomyselfaboutthetext.
– …andsometimesansweringthosequestions.
The way that I would expect you to read or use these notes is to effectively permit me to be your in- ner monologue while you’re reading the textbook. As you’re reading chapters and sections within chapters, you can take a look at what I’ve written here to get an idea of how I’m thinking about this content.
Chapter 13: The abstraction: Address spaces
• Alright,filesystemswerefun,butlet’sgoallthewaybacktoprocessesnow.
13.1 Early systems
• Thinking about what your processes see in terms of address spaces, how does it differ from what’s presented in figure 13.1? Does it differ from what’s presented in figure 13.1?
• Theauthorsexplicitlystatethat“therewouldbeonerunningprogram”inthiskindofearlysys- tem. What do you think might happen if multiple processes were allowed to run in this environ- ment? What kinds of things could go wrong?
13.2 Multiprogramming and time sharing
• Yay,scheduling!
• Multiprogramming,yieldingtheprocessoronI/O,hooray!
• “The notion of interactivity became important” — can you imagine using a computer where
you had to write your programs entirely on paper, then encode them on some other kind of physical medium, then give the program to someone else to run?

COMP 3430 Operating systems – Chapter 13 and 15 reading notes Winter 2022
• “Inparticular,allowingmultipleprogramstoresideconcurrentlyinmemorymakesprotection an important issue” – it seems obvious that we wouldn’t want a process interacting with the memory that belongs to another process, but why not? What kinds of things do you think could happen if the OS were to allow that to happen?
• Before reading the next part, can you think of any issues with getting a process to figure out what its own memory region is? Noting specifically that the address space in figure 13.2 for (for example) process A does not start at 0.
13.3 The address space
• NOTE: address space != actual memory. We’re going to keep seeing this, but “it is the running program’s view of memory in the system”.
• “The code of the program (the instructions) have to live in memory somewhere”; this makes sense (a program is inert on disk, a process is running), but make sure that you can mentally convince yourself that this is true.
• Heapandstackareseparatedfromeachother.Whydoyouthinkthatis?
• In figure 13.3 we’re showing a 16KB address space. In terms of the first point here, that means
that actual memory might be much larger.
• Important:“…somehowtheOS,intandemwithsomehardwaresupport.”Thisisaverycom-
mon theme when talking about operating systems: Software itself can’t do everything, and nei- ther can hardware, so the two have to work together to get things done.
13.4 Goals
• Transparency:whenwasthelasttimeyoucaredaboutwhere,physically,inmemoryyourpro- gram was running?
• Efficiency:thisisatopicthat’sgettingintohardware(TLBs).
• Protection: the authors are using two different words here, “protect” and “isolate”. What’s the
difference?
13.5 Summary
• Tryactuallyrunningthecodelistingintheasideonpg7.Runitonthesamemachinemultiple times, run it on different machines (e.g., rodents and aviary and your own machine). Is the out- put always the same? Different? Based on the description here, what would you have expected?

COMP 3430 Operating systems – Chapter 13 and 15 reading notes Winter 2022
Chapter 15: Mechanism address translation
• Note:weskippedchapter14;it’sanoverviewoftheuseofthememoryAPI(mallocandfree). If you feel like you want a refresher on that, feel free to read this chapter. The one important nugget from chapter 14 is that malloc and free are explicitly not part of the operating system, but instead are part of the standard C library.
• Atthestartheretheauthorsarewritingaboutlettingsoftwarerundirectlyonthehardwarewith the aim of performance. What other options even are there? How else could software run, if it’s not running directly on the CPU? (hint: think about Java, think about emulators)
• Efficiency and flexibility are two main goals here. Efficiency is specifically related to “run it on the hardware”, and flexibility is “with OS support”.
• Before getting too far (e.g., while you’re still looking at pg 2): even thinking back to the basic idea that different processes get different spots in memory like in figure 13.2, based entirely on what you know about how processes get switched, try to theorize what the OS might need and what it might do to help hardware make sure that we can make these processes believe that they “start at 0”.
15.1 Assumptions
• “Goahead,laughallyouwant;prettysoonitwillbetheOSlaughingatyou”D:
• Do you think that the assumptions listed here are realistic? (e.g., contiguous block of memory,
and that address space is less than the size of physical memory)
15.2 An example
• objdump and otool are pretty cool programs, but you should also check out https://godbolt. org/, it is amazing.
• The sequence of what happens at the bottom of pg 3 starts with “Fetch instruction at address 128”. Remember how “instructions are stored in memory”? Yeah. That means that to run an instruction, you have to load the instruction from memory. Neat.
• In terms of transparency and figure 15.2, again, try to stop here and think about what an OS might need to do to help a program believe that its address space starts at 0.

COMP 3430 Operating systems – Chapter 13 and 15 reading notes Winter 2022
15.3 Dynamic (Hardware-based) relocation
• Virtual address: Remember that some addresses are set in a program when the program is compiled, and that virtual addresses start at 0. Other addresses are effectively generated at runtime (e.g., dynamic memory allocation).
• What do you think the OS is doing to help this all out? The hardware seems to have the main responsibility in dynamic relocation.
Example translations
• The authors describe the result of attempting to access a memory location out of bounds is a “fault, causing an exception to be raised”. What do you think is the role of the operating system
15.4 Hardware support: summary
• DoyouthinktheOSitselfneedstousethebaseandboundsregistersforitsownexecution?Or are they only for user programs?
• Do you think a user program has the ability to read from and write to the base and bounds registers? Why or why not?
15.5 Operating system issues
• The authors describe a “free list”, what do you think is the difference between tracking “free” space and “used” space? We sort of tracked both with file system bitmaps.
• Theauthorsmentionthatvariablesizedaddressspacesisaproblemforfuturechapters.What kinds of problems do you think there would be with variable sized address spaces? (hint: it’s also a problem with file systems).
• Ugh,they’rereferringtopage5onpage10,it’snoteasytofliparoundwithaPDFlikethis.
• “the OS must do some work when a process is terminated …, reclaiming all of its memory for
use in other processes or the OS.” – is this different from free?
• Inthemiddleofpg10istheanswertosomeabovequestions(when/howdoestheOSdealwith
base/bounds registers?)
• Figure15.5doesareallynicejobofshowing1)whenthingshappenastheOSandhardwareare
initialized, and 2) which of hardware or the OS is responsible for different parts of this initializa- tion.
– Figure15.6isanevenmoredetailedversionofthisdiagram.

COMP 3430 Operating systems – Chapter 13 and 15 reading notes Winter 2022
15.6 Summary
• Thisisallwellandgood,but,uh,surprise!Baseandboundsisnotwhatwe’redoingwithmod- ern hardware and operating systems. The authors have a few good reasons why on pg 13. Can you think of any others?

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com