Candidate Number
THE UNIVERSITY OF SUSSEX
BSc SECOND YEAR EXAMINATION May/June 2016 (A2)
OPERATING SYSTEMS
Assessment Period: May/June 2016 (A2)
G6059
DO NOT TURN OVER UNTIL INSTRUCTED TO BY THE CHIEF INVIGILATOR
Candidates should answer TWO questions out of THREE. If all three questions are attempted only the first two answers will be marked.
The time allowed is ONE AND A HALF hours.
Each question is worth 50 marks.
At the end of the examination the question paper and/or answer book, used or unused, will be collected from you before you leave the examination room.
G6059
1. (a)
(b) (c)
(d)
OPERATING SYSTEMS
Briefly explain the three roles played by an operating system. [10 marks]
Explain the two abstractions provided by a Process. [10 marks]
What resources are used when a thread is created? How do they differ from those used when a process is created? [10 marks]
Consider the following set of processes, with the length of the CPU burst time given in milliseconds:
Process Burst Time Priority
P1 10 3 P2 1 1 P3 2 3 P4 1 4 P5 5 2
The processes are assumed to have arrived in the order P1, P2, P3, P4, and P5 , all at time 0.
i. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1).
ii. What is the turnaround time of each process for each of the scheduling algorithms in part (i)?
[20 marks]
2
2. (a)
(b) (c)
(d)
OPERATING SYSTEMS G6059
Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw(amount). These two methods are passed the amount that is to be deposited or withdrawn from a bank account. Assume that a husband and wife share
a bank account and that concurrently the husband calls the withdraw() method and the wife calls deposit(). Describe how a race condition is possible and what might be done to prevent the race condition from occurring. [20 marks]
Describe the four necessary conditions for deadlock. [10 marks]
Explain the difference between internal and external fragmentation. [10 marks]
Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs. [10 marks]
3 Turn over/
G6059
3. (a)
(b)
OPERATING SYSTEMS
Describe any three system calls that an operating system must provide to perform operations on files. Also explain what the operating system must do to perform these operations. [20 marks]
Write Java code to show how the swap() instruction can be used to provide mutual exclusion that satisfies the bounded-waiting requirement. [30 marks]
4 End of Paper