Class 15 CS 202 22 March 2021 On the board ------------ 1. Last time 2. Midterm review, logistics for remote 3. Midterm review, class overview 4. Your questions https://scribbletogether.com/whiteboard/D41DA174-CBAA-46FF-B226-85165C3A52DF --------------------------------------------------------------------------- 1. Last time --finished virtual memory unit (we will revisit when we cover lab 4) --discussed uses of page faults, costs of page faults --discussed cache eviction policies, regarding RAM as a cache of the disk --the discussion about thrashing at the end: moral of the story is that if the workload is not cache-friendly, the policy is irrelevant. --> in that case, need to restructure computation, do less work, or buy more hardware 2. Midterm review, logistics --75 minute closed-book exam - This means no books, no IDEs, etc. - you should only have the exam PDF, the answer document, and the Campuswire link open. --You can use ONE two-sided sheet of notes; formatting requirements listed on Web page. --You will send us a selfie at the beginning and end of yourself with your id, answer sheet, and screen. --We may use Zoom. Be prepared to screenshare. --At class time, we will release URLs for: 1. exam PDF 2. A link to an answer document, and a Gradescope URL at which you can submit your answers. 3. A URL where you can upload your selfies --Contingencies: - If we have any doubt about your testing environment, we will interview you and then very possibly replace your exam with an oral exam. - If you claim connectivity issues or other failures (for example, a broken computer, a non functional camera) then we will interview you to determine what happened, and then rely on an oral exam. - Oral exams, if substituting for the regular one, are going to be significantly harder than the actual midterm. - Other items: - For responding to questions, we'll use campuswire with a separate instance - all posts on Campuswire should be marked as visible to only instructors and TAs. - If you can't explain your answer, violate the required test conditions, or are found to have manipulated photos, you will fail, no questions asked, and be referred to the Dean for an integrity violation. 3. Midterm review, class overview Material --Readings (see course Web page, the column called "Reading assignment") --Labs --Homeworks --Lectures --Operating systems: what are they? --goals, purpose -- Processes: -- process's view of memory and registers -- stack frames -- OS's view of processes -- system calls -- Process/OS control transfers -- Processes birth: fork()/exec() -- Shell -- File descriptors -- Redirection, pipelines --threads --concurrency --hard to deal with; abstractions help us, but not completely --critical sections --mutexes --spinlocks --condition variables --monitors --lots of things can go wrong: safety problems, liveness problems, etc. --> lack of sequential consistency makes the problem worse. --What's the plan for dealing with these problems? --safety problems: build concurrency primitives that get help from hardware (atomic instructions, turning off interrupts, etc.) and move up to higher level abstractions that are easy to program with --liveness problems: most common is deadlock, and we discussed strategies for avoiding it. other problems too: starvation, priority inversion, etc. --lots of trade-offs and design decisions --performance v. complexity --lots of "advice". some is literally advice; some is actually required practice in this class. --software safety (Therac-25) --scheduling --intro: when scheduling happens, which metrics, what costs --specific disciplines --lessons and conclusions --virtual memory paging virtual memory on the x86-64 virtual address: [0000 36bits 12bits] --entry in L1...L4 page tables: [40 bits more bits bottom 3 bits] --protection (user/kernel | read/write | present/not) what's a TLB? page faults mechanics costs uses page replacement policies (FIFO, LRU, CLOCK, OPT) thrashing [latter two topics more general than paging: applies to caching in general] 4. Now questions from you all......