Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems Review.

Similar presentations


Presentation on theme: "Operating Systems Review."— Presentation transcript:

1 Operating Systems Review

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

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

4 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?

5 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

6 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

7 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.

8 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

9 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?

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

11 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?

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

13 Translate virtual address to physical address
20 4100 8300

14 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?

15 Multilevel Page Tables
What is the PT1 and PT2 value for a virtual address 0x ? Figure (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

16 ? 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?

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

18 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

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

20 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

21 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?

22 ? 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 (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?

23 Cause of thrashing thrashing increases CPU utilization
Degree of multiprogramming

24 ? 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

25 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?

26 ? 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? ( /32*20)*32=( )*32=680 ( /32*20)*16=(20+2.5)*16 =360

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

28 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

29

30 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?

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


Download ppt "Operating Systems Review."

Similar presentations


Ads by Google