Operating Systems (H) - 2015 Exam

Section A

Memory

Regarding page replacement algorithms:

1. What is a page replacement algorithm?

2. When is a page replacement algorithm used?

You have been asked to select an appropriate page replacement algorithm for a high-performance computing cluster that supports a single CPU-intensive application consisting of many processes (1 per node in the cluster). Each process updates elements of a 2 GB array (on a 32-bit architecture machine) with good locality of reference.

3. Should this be a global or local algorithm?

4. What is the effect of page faults on the processes running on each node?

5. What would be a suitable and practical page replacement algorithm?

One equivalence class of page replacement algorithms consists of the second-chance algorithms.

Consider the clock algorithm:

Given a set of 8 pages with their reference bits set as follows:

Assume the victim hand is at P3 and the queue is traversed towards the right.

6. When a frame is needed, what will be the situation after the new page has been inserted?

Assuming the enhanced, two-handed clock second-chance algorithms

Given a set of 8 pages with their reference and modify bits set as follows:

Assume the victim hand is at P3 and the queue is traversed towards the right.

7. When a frame is needed, which page will be replaced?

8. Under which circumstances would the clock variant (two-handed clock second-chance algorithm) be preferred over the standard second-chance algorithm.

Section B

Synchronization of tasks in a constrained environment.

Semaphores are a concurrency control primitive which enable protection of critical sections.

9. Which is the correct pseudocode for two tasks using semaphores to perform mutual exclusion of a critical section.

10. Which is the correct pseudocode to synchronise two tasks. Include semaphore initialization.

11. Specify the possible order of the code executed by these two tasks on a uniprocessor system.

12. What Pthreads concept is provided to enable meeting such synchronization requirements? Select pseudocode for how a typical task uses this concept?

13.

Is the following system deadlocked?

Section C

Scheduling

Consider the following set of processes, with the length of the CPU burst given in milliseconds:

Which is the correct Gantt chart for the execution of these processes:

14. using First-Come First-Serve

15. Using Shortest Job First

16. Using non-preemptive Priority scheduling (a smaller priority number implies a higher priority) Here Burst Time for P4 = 3, for P3 = 1

17. Using Round-Robin (quantum = 1)

18. What is the average waiting time (over all processes) for the algorithm with minimal average waiting time?

19. What algorithm makes P5 finish the earliest?