Class 13 CS 202 10 March 2020 On the board ------------ 1. Last time 2. Midterm review, logistics for remote 3. Midterm review, class overview 4. Your questions --------------------------------------------------------------------------- 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 -- one of you asked about concurrent access to a page that is in the process of being evicted. Answer: page fault handler does these in order: - clears PTE_P entry in page table, then - TLB shootdown (clears VPN entry in all CPUs' TLBs), then waits for this to complete - then actually moves the page out of disk 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. - For proctoring, you will record yourself, your hands, and your computer the whole time with audio on. This is not the same as screen-sharing. To prepare for the recording, please: - free up 77 minutes of video-shooting ability on your phone. no phone? ask us. - you may need to set it to lower resolution - Make sure (ASAP) that your phone is able to record for this length.Some manufacturers limit the length of time you can record high resolution video, and hence figuring out how to do this is essential to preparing for the test. - PRACTICE THIS TONIGHT - at 3:30 PM precisely 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 (Note, in class I said Google forms, we are no longer using Google Forms. Instead we will give you a Google Doc template with instructions on how you should complete it and submit). 3. A URL where you can upload your video. - at 3:29 PM or so you'll turn on your camera and microphone: - point it at yourself holding your NYU id and say, "My name is [name], and this is the cs202 midterm" - point to your two-sided one-pager, front and back; hold the camera long enough in front that it's not blurred. - pan the camera around your room, including your full desk - pan to the computer screen web page where we release the exam so we can see that you're taking it, with the file you're typing in (that is, "your" copy of item 2 above) - the only things that can be on the screen are: - exam PDF, answer file, and the exam-specific Campuswire (see below) - prop it up; **you need to show the whole screen and your hands on the keyboard legibly** - Leave your microphone on the entire time. - at the end, submit the exam - show the file you're submitting again - pan the room you're in again, including your full desk - upload the video. you'll have ~15 minutes to upload the video. URL will be distributed when the exam is about to begin. - 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 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: https://campuswire.com/p/G7207B15D use enrollment code 3417 to join. - all posts on Campuswire should be marked as visible to only instructors and TAs. - Random interviews (oral exams) are guaranteed. We will use this as a secondary mechanism to confirm your understanding of the material, and ensure that the exam was taken as intended. - Random audits of the videos are guaranteed. We will be checking videos for any anomalies, including unauthorized materials and of course other people. - If you can't explain your answer, violate the required test conditions, or are found to have manipulated the video, 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 -- Pipes --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......