Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

COMP313 - Test 3 - Model

Virtual Memory & Scheduling

Question One [20]


Paging is an operating system mechanism that enables processes to use the CPU even though only a
part of its address space is loaded into memory at that time.

1.1) Define the following terminology in the context of Paging:

a) demand-paging [3]

only the missing page is fetched from auxiliary memory and page replacements only occur when
memory is full

b) forward-distance [3]

the distance to the first reference of page x after time t

c) reference frequency [3]

the number of references to page x up to time t

1.2) Consider a machine with three (3) page frames and eight (8) pages that is processing the
following reference string W.

W = 0, 1, 7, 5, 2, 6, 4, 5, 3, 6, 3, 2, 5, 4, 0, 5, 7, 7

Note: memory is initially empty.

Note: Show all working (i.e. show the memory state after each replacement).

a) How many page faults will occur when using the Least
Frequently Used paging algorithm? Use First In First Out (FIFO)
is the tie-breaking rule. [4]

017
517 F
527 F
526 F
426 F
456 F
453 F
653 F
623 F
523 F
524 F
504 F
507 F
12 faults

b) How many page faults will occur when using Belady’s optimal
algorithm? [4]

017
057 F
052 F
652 F
654 F
653 F
652 F
654 F
650 F
657 F

9 faults

c) Though Belady's algorithm is optimal, explain why it is theoretical,


and cannot actually be implemented. [3]

Question Two [10]


Consider a system with one processor, using preemptive round-robin scheduling. The time-slice
is 4 units. In this system, new tasks are added to the end of the ready queue. Now consider the
following tasks:

Task Arrival Time Burst Time


p0 0 3
p1 2 5
p2 3 6
p3 4 8
p4 6 9
(a) Create a Gantt chart illustrating the execution of these tasks. [5]

| p0 | p1 | p2 | p3 | p4 | p1 | p2 | p3 | p4 | p4 |
0 3 7 11 15 19 20 22 26 30 31

(b) What is the average throughput time for the tasks? [5]

p0 - 3

p1 - 17

p2 - 15

p3 - 15

p4 - 16
13.2 (ave throughput time)

Question Three [10]


Consider a system with three processors, using LPT scheduling. In this system, new tasks are added
to the end of the ready queue. Now consider the following tasks:

Task Processing Time


p0 5
p1 2.5
p2 6
p3 2.5
p4 1.5
p5 2.5
p6 1.5

(a) Create a Gantt chart illustrating the execution of these tasks. [5]

p2 p6
p0 p5
p1 p3 p4

(b) What is the total throughput time for the tasks? [5]

7.5

You might also like