HCS114 Operating System - Main Paper - Create
HCS114 Operating System - Main Paper - Create
MAIN PAPER
INSTRUCTIONS TO CANDIDATES
Answer any four questions.
1
Question 1
a) Describe the two general roles of an operating system, and elaborate why these roles are
important. [4]
b) An operating system is a program that controls the execution of application programs and
act as an interface between applications and the computer hardware. It can be thought of as
having three objectives. Describe these objectives? [6]
c) With an aid of a diagram, discuss the process state model stating an event that might cause
such a transition. 10]
d) Describe how a multi-threaded application can be supported by a user-level threads
package. It may be helpful to consider (and draw) the components of such a package, and
the function they perform. [5]
Question 2
a) For the Producer-Consumer problem, solutions may be based on semaphores and message
passing. Briefly compare the benefits of the two techniques. [6]
b) Briefly explain the four conditions required for deadlock to occur? [4]
c) In LINUX, semaphores are numbered, and a process can ask for semaphores only in
ascending order. How does this help to prevent deadlock? [6]
d) Using an example, discuss the following allocation algorithms:
i. First fit; [3]
ii. Best fit; and [3]
iii. Worst fit. [3]
Question 3
a) Several popular microcomputer operating systems provide little or no means of concurrent
processing. Discuss the major complications that concurrent processing adds to an
operating system. [7]
b) Consider the following snapshot of a system:
2
Allocation Max Available
A B C D A B C D A B C D
P0 0 0 1 2 0 0 1 2 1 5 2 0
P1 1 0 0 0 1 7 5 0
P2 1 3 5 4 2 3 5 6
P3 0 6 3 2 0 6 5 2
P4 0 0 1 4 0 6 5 6
Answer the following questions using the banker’s algorithm:
i) What is the content of the matrix Need? [4]
ii) Is the system in a safe state? [10]
iii) If a request from process P1 arrives for (0,4,2,0), can the request be granted immediately?
[4]
Question 4
a) What are the two type of memory fragmentation and why should fragmentation be avoided?
[2]
b) One of the key design decisions in OS memory management is the choice between paging
and segmentation. Compare and contrast these two approaches to memory management,
making sure to identify the strengths and weaknesses of each. Define each of these terms, and
clarify their respective roles in OS memory management. [5]
c) In pure on-demand paging a page replacement policy is used to manage system resources.
Suppose that a newly-created process has 3 page frames allocated to it, and then generates the
page references indicated below:
ABCBADABCDABACBD
i) How many page faults would occur with FIFO page replacement? [6]
ii) How many page faults would occur with LRU page replacement? [6]
iii) How many page faults would occur with OPT page replacement? [6]
Question 5
a) Describe the following scheduling algorithms:-
i. First Come, First Serve
3
ii. Round Robin
iii. Shortest Job First. [6]
b) Given the following processes and burst times
Process Burst time
PR1 10
PR2 6
PR3 23
PR4 9
PR5 31
PR6 3
PR7 19
i. Draw four Gantt charts illustrating the execution of these processes using First
Come First Serve (FCFS), Shortest Job First (SJF) and RR (quantum = 8)
scheduling. [12]
ii. What is the turnaround time of each process for each of the scheduling
algorithms in part i? [3]
iii. What is the average waiting time of each process for each of the scheduling
algorithms in part i? [3]
Question 6
Consider and imaginary disk with 51 cylinders. A request comes in to read a block on cylinder
11. While the seek to cylinder 11 is in progress, new requests come in for cylinders 1, 36, 16,
34, 9, and 12 in that order. Assume max track is 50 and seek takes 5ms per cylinder moved.
Compute the total head movement and seek times of the following algorithms?
i) FIFO [4]
ii) SSTF [4]
iii) SCAN [4]
iv) C - SCAN [4]
v) LOOK [4]
vi) C - LOOK [5]
END