+ All Categories
Home > Documents > Operating Systems Review. Questions What are two functions of an OS? From top to down, providing...

Operating Systems Review. Questions What are two functions of an OS? From top to down, providing...

Date post: 14-Dec-2015
Category:
Upload: reid-hayslip
View: 215 times
Download: 1 times
Share this document with a friend
Popular Tags:
31
Operating Systems Review
Transcript
Page 1: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Operating Systems

Review

Page 2: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Questions

What are two functions of an OS? From top to down, providing abstractions to

applications From down to top, resource manager,

multiplexing( sharing) resource

Page 3: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

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?

Page 4: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Questions

How does a shell work? Or … arrange the commands in order:wait()pid = fork()exec()gets()while(1) {}

Page 5: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review

Process Scheduling Explain how SJF,FCFS,RR etc. works True or False:

FCFS is optimal in terms of average turnaround time Most processes are CPU bound The shorter the time quantum, the better

Page 6: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

6

P1

20

P2

32

P3 P4 P5

40 56 60

FCFS

P1

4

P2

12

P3 P4P5

24 40 60

SJF

P1 P2

4

P3 P4 P5 P1

8 12 16 20 24

P2 P3

28

P4 P1 P2 P4

32 36 40 44 48

P1 P4

52

P1

56 60

RR

Response time 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

Page 7: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

7

Response Time Calculations

Job FCFS SJF RR

P1 0 40 0

P2 20 12 4

P3 32 4 8

P4 40 24 12

P5 56 0 16

Average 29.6 16 8

Page 8: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

8

Turnaround Time Calculations

Job FCFS SJF RR

P1 20 60 60

P2 32 24 44

P3 40 12 32

P4 56 40 56

P5 60 4 20

Average 41.6 28 42.4

Page 9: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review

What is a “race condition”? What are 4 properties necessary for a correct

“critical region” solution? mutual exclusion, no assumption, bounded

waiting, let others use when unusing What is Peterson’s Solution? Why is semaphore better than Peterson’s

solution and TSL?

Page 10: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review

What is deadlock?

What is the four conditions for deadlock to happen?

Page 11: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review of Banker’s Algorithm

Allocation Max Available

A B C A B C 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

P = {P0, P1, …, P4}; R={A(10), B(5), C(7)}

Snapshot at time T0:

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?

Page 12: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review

What is the Memory Management Unit?

How does it work during a virtual—physical address translation?

Page 13: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Translate virtual address to physical address1.202.41003.8300

Page 14: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

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?

Page 15: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639

Multilevel Page Tables

Figure 3-13. (a) A 32-bit address with two page table fields. (b) Two-level page tables.

What is the PT1 and PT2 value for a virtual address 0x00403004?

Page 16: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

? Suppose that a machine has 38-bit virtual

address ad 32-bit physical addresses. What is the main advantage of a multilevel page table

over a single-level one? With a two-level page table, 16-KB pages, and 4-byte

entries, how many bits should be allocated for the top-level page table field and how many for the next-level page table filed? To answer this question, consider the internal fragmentation resulting from page table size. For example, when a page table is less than 1 page in size, you have internal fragmentation that is unused and wasted memory.

Page 17: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

True or False

With paging, a process’ logical address spaces is contiguous

With paging, a process’ physical address spaces is contiguous

Page 18: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review

Does paging have fragmentation? No? Then why not? Yes? Then what kind?

What are the overheads associated with paging?

Page 19: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review True or False:

a) The logical address space cannot be bigger than the physical address space

b) Processes have big address spaces because they always need them

Demand paging:a) Is unrelated to prepagingb) Brings logical pages into physical memory

when requested by a processc) Increases memory requirements for a

system

Page 20: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Questions

What is static relocation? What is dynamic relocation? What is static linking? What is dynamic linking?

Page 21: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

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

Page 22: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

?

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?

Page 23: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Cause of thrashing

Degree of multiprogramming

CP

U u

tili

zati

on

thrashing increases

Page 24: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

?

Array A[1024, 1024] of integer, each row is stored in one page

Program 1for j := 1 to 1024 do

for i := 1 to 1024 doA[i,j] := 0;

1024 × 1024 page faults Program 2

for i := 1 to 1024 dofor j := 1 to 1024 do

A[i,j] := 0; 1024 page faults

Page 25: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

First-In-First-Out (FIFO)

1

2

3

3 Frames / Process

1,2,3,4,1,2,5,1,2,3,4,5

4

1

2

5

3

4

9 Page Faults

How many page faults would we have if we had4 Frames/Process?

Page 26: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

?

How long does it take to load a 64KB program from a disk whose average seek time and average rotation time are 10 msec, and whose tracks hold 32KB. For 2KB block size? For 4KB block size?

(10+10+2/32*20)*32=(20+1.25)*32=680 (10+10+4/32*20)*16=(20+2.5)*16 =360

Page 27: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Figure 4-34. A UNIX i-node.

The UNIX V7 File System (2)

Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639

Page 28: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

I-Node

How many data blocks are there?

If you added 3 more data blocks to the file, what would happen?D

isk

bloc

ks

i-node

null

null

null

null

null

62

77

Page 29: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.
Page 30: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Review

Directories: 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?

Page 31: Operating Systems Review. Questions What are two functions of an OS?  From top to down, providing abstractions to applications  From down to top, resource.

Figure 4-35. The steps in looking up /usr/ast/mbox.

The UNIX V7 File System (3)

Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639


Recommended