Operating Systems Review.

Slides:



Advertisements
Similar presentations
Module 10: Virtual Memory
Advertisements

Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Basic Memory Management Monoprogramming Protection Swapping Overlaying OS space User space.
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Operating Systems Review.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
9.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory OSC: Chapter 9. Demand Paging Copy-on-Write Page Replacement.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement.
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
Gordon College Stephen Brinton
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
CMPT 300: Operating Systems Review THIS REIVEW SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Chapter 9: Virtual Memory Background.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved The Operating System Machine.
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
Computer Organization and Architecture
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
Memory Management 2 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
Operating Systems Review. Outline Intro –What is an OS, OS History Operating System Concepts –Processes, Files, System Calls, Shells Operating System.
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Lecture 21 Last lecture Today’s lecture Cache Memory Virtual memory
Silberschatz and Galvin  Chapters 3 and 5 Possible questions –Tracing a given program involving fork, exec, semaphores, and share memory –Wring.
CS 153 Design of Operating Systems Spring 2015 Final Review.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Virtual Memory.
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
1 Rutgers UniversityCS 416: Operating Systems Final exam details December 22, pm-3pm. Venue: SEC 118. Tips: Spend time reading the questions before.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Memory.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Chapter 9: Virtual Memory. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Background Virtual memory – separation of user logical memory.
MIDTERM REVIEW CSCC69 Winter 2016 Kanwar Gill. What is an OS? What are processes and threads? Process states? Diagram showing the state changes What data.
Chapters 3 and 5 Possible questions
UNIT–IV: Memory Management
Demand Paging Reference Reference on UNIX memory management
Section 10: Last section! Final review.
CSC 322 Operating Systems Concepts Lecture - 16: by
Module 9: Virtual Memory
Chapter 9: Virtual Memory
Demand Paging Reference Reference on UNIX memory management
Process management Information maintained by OS for process management
Chapter 9: Virtual-Memory Management
Chapter 6: CPU Scheduling
Chapter 15 – Part 1 The Internal Operating System
Computer Architecture
5: Virtual Memory Background Demand Paging
The Operating System Machine Level
Chapter 9: Virtual Memory
Computer Architecture
Operating Systems CMPSC 473
Lecture 41 Syed Mansoor Sarwar
CSE 542: Operating Systems
Module 9: Virtual Memory
COMP755 Advanced Operating Systems
Chapter 9: Virtual Memory CSS503 Systems Programming
Virtual Memory.
CSE 542: Operating Systems
Presentation transcript:

Operating Systems Review

Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?

Manages all system resources CPU Memory I/O Files Objectives: Security Efficiency Convenience

Questions What causes OS to change? What is multi-programming? What is time-sharing? Or, why aren’t we still running MS-DOS? What is a process? What is a thread? What is address space? What is a file?

Review What is (average) waiting time? Explain how SJF,FCFS,RR etc. works True or False: FCFS is optimal in terms of avg waiting time Most processes are CPU bound The shorter the time quantum, the better

Response time Turnaround time P1 20 P2 32 P3 P4 P5 40 56 60 FCFS P1 4 Estimate by time from job submission to time to first CPU dispatch Assume all jobs submitted at same time, in order given Turnaround time Time interval from submission of a process until completion of the process Assume all jobs submitted at same time P1 20 P2 32 P3 P4 P5 40 56 60 FCFS Have the students work the Response time & Turnaround time calculation for the RR, so they get some experience. P1 4 P2 12 P3 P4 P5 24 40 60 SJF P1 P2 4 P3 P4 P5 8 12 16 20 24 28 32 36 40 44 48 52 56 60 RR

Response Time Calculations Job FCFS SJF RR P1 40 P2 20 12 4 P3 32 8 P4 24 P5 56 16 Average 29.6 Response time is the same as waiting time for FCFS and SJF-- because each process only runs once, until completion.

Turnaround Time Calculations Job FCFS SJF RR P1 20 60 P2 32 24 44 P3 40 12 P4 56 P5 4 Average 41.6 28 42.4

Review What is a “race condition”? What are 3 properties necessary for a correct “critical region” solution? mutual exclusion, progress, bounded waiting What is Peterson’s Solution? Why is semaphore better than Peterson’s solution and TSL?

Review What is deadlock? What is the four conditions for deadlock to happen?

Review of Banker’s Algorithm P = {P0, P1, …, P4}; R={A(10), B(5), C(7)} Snapshot at time T0: Allocation Max Available A B C P0 0 1 0 7 5 3 3 3 2 P1 2 0 0 3 2 2 P2 3 0 2 9 0 2 P3 2 1 1 2 2 2 P4 0 0 2 4 3 3 Can request for (1,0,2) by P1 be granted? Can request for (3,3,0) by P4 be granted? Can request for (0,2,0) by P0 be granted?

Review What is the Memory Management Unit? How does it work during a virtual—physical address translation?

Translate virtual address to physical address 20 4100 8300

Review A paging scheme uses a Translation Loo-aside Buffer (TLB) A TLB access takes 10 ns and a main memory access takes 50 ns. What is the effective access time (in ns) if the TLB hit ratio is 90% and there is no page-fault?

Multilevel Page Tables What is the PT1 and PT2 value for a virtual address 0x00403004? Figure 3-13. (a) A 32-bit address with two page table fields. (b) Two-level page tables. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639

? A computer has 32-bit virtual addresses and 4-KB pages. The program and data together fit in the lowest page (0-4095) the stack fits in the highest page. How many entries are needed in the page table if traditional paging is used? How many page table entries are needed for 2-level paging, with 10 bits in each part?

Review What is internal fragmentation? What is external fragmentation? What is compaction?

True or False With paging, a process’ logical address spaces is contiguous With paging, a process’ physical address spaces is contiguous Paging reduces the size of the possible address space used by a process

Review Does paging have fragmentation? No? Then why not? Yes? Then what kind? What are the overheads associated with paging?

Review True or False: Demand paging: The logical address space cannot be bigger than the physical address space Processes have big address spaces because they always need them Demand paging: Is unrelated to prepaging Brings logical pages into physical memory when requested by a process Increases memory requirements for a system

Review Page faults What is a Page Replacement Algorithm? What is a page fault? What does an OS do during a page fault? What is a Page Replacement Algorithm? What is “Belady’s Anomaly”? How does the Optimal algorithm work? How does Enhanced Second Chance work? What is thrashing? How do we fix it?

? A computer has four page frames. The time of loading, time of last access, and the R and M bits for each page are as shown below (the times are in clock ticks): Page Loaded Last Ref. R M 0 126 285 1 0 1 120 265 0 0 2 140 270 0 1 3 110 280 1 1 (a) Which page will NRU replace? (b) Which page will FIFO replace? (c) Which page will LRU replace? (d) Which page will second chance replace?

Cause of thrashing thrashing increases CPU utilization Degree of multiprogramming

? Array A[1024, 1024] of integer, each row is stored in one page Program 1 for j := 1 to 1024 do for i := 1 to 1024 do A[i,j] := 0; 1024 × 1024 page faults Program 2 for i := 1 to 1024 do for j := 1 to 1024 do A[i,j] := 0; 1024 page faults

First-In-First-Out (FIFO) 1,2,3,4,1,2,5,1,2,3,4,5 1 4 5 3 Frames / Process 9 Page Faults 2 1 3 3 2 4 How man page faults would we have if we had 4 Frames/Process?

? How long does it take to load a 64KB program from a disk whose average seek time and rotation time are 10 msec, and whose tracks hold 32KB. For 2KB page size? For 4KB page size? (10+10+2/32*20)*32=(20+1.25)*32=680 (10+10+4/32*20)*16=(20+2.5)*16 =360

The UNIX V7 File System (2) Figure 4-34. A UNIX i-node. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639

I-Node How many data blocks are there? If you added 3 more data blocks to the file, what would happen? 62 77 Disk blocks null null null null null

Review Directories: Aliases: Free space management: In what way is a directory different than a file? In what way is a directory similar to a file? Aliases: Describe a hard-link Describe a soft-link Free space management: If the size of a block is B bytes, then what is the biggest size of a group in ext2?

The UNIX V7 File System (3) Figure 4-35. The steps in looking up /usr/ast/mbox. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639