NJORO CAMPUS
FIRST SEMESTER 2012/2013
SECOND YEAR EXAMINATION FOR THE AWARD OF THE DEGREE BACHELOR OF COMPUTER SCIENCE
COMP 206:  OPERATING SYSTEM (OS)
STREAM:								TIME: 2 HOURS
DAY:		TUESDAY, 12, 00 – 2.00 PM			DATE 30/4/2013
INSTRUCTIONS

1.	Answer Question ONE and any other two questions
2.	Answer on both sides of the answer sheet
3.	Begin each question on a fresh page

Question One – Compulsory question (30 Marks)

a)	i) What is an Operating System? 					(2 Marks)
ii) What do you understand by the term Privilege state with reference to the Kernel. 								(2 Marks)
iii) Give the three major goals of an operating system. 		(3 Marks)

b)	Mention at least two activities of an OS with regard to the following:
i)	Process management 						(2 marks)
ii)  Main Memory management 					(2 Marks)
iii) File management 							(2 Marks)
iv) Secondary storage Management 					(2 Marks)

c)	Illustrate the general data structure (relevant matrices) for detecting deadlock for a system with multiple resource instances.			 	(5 marks)

Question Two (20 Marks)

a)	i) What is a process? 							(2 Marks)
ii)	What does a process state consist of? 				(4 marks)

b)	State four principle events that lead to process creation 		(4 Marks)
c)	i) What is a thread and how does it differ from a process? 		(4 Marks)
ii) What is context switching? 					(2 Marks)
iii) With the help of a suitable diagram show the contents of the PCB. 											(4 Marks)
Question Three (20 Marks)
a)	i) Mention four general strategies for dealing with deadlocks and describe at least two of them. 							(6 marks)

b)	 i) Assuming the operating system detects the system is deadlocked, what can the operating system do to recover from deadlock?			(3 marks)
ii) Describe the general strategy behind dealock prevention, and give an example of a practical deadlock prevention method.				(3 marks)
iii)	Below is an example of multiple resource allocation. Show how deadlock can be detected. 					(8 marks)

E = ( 5 1 5 3 ), A = ( 2 0 2 1 ), 

C =  R = 

Question Four (20 Marks)
a)	Mention at least four page replacement algorithms.			(4 marks)

b)	i) What is swapping with reference to MMUs?			(2 marks)
ii)	Illustrate memory management with Bit maps and linked lists for five processes as described in the table below.			(4 marks)
location	Process/Hole	Start position	Size (Bits)	
1	P1	0	5	
2	H1	5	3	
3	P2	8	6	
4	P3	14	4	
5	H2	18	2	
6	P4	20	8	
7	P5	28	6	
8	H3	34	4	

iii) Illustrate how space is allocated for growing data segment or for growing stack and data segment.						(4 marks)
c) Briefly explain how the following algorithms work: 
i) Not Recently Used page replacement 				(3 marks)
ii) Second chance replacement algorithm 				(3 marks)

Question Five (20 Marks)
a)	i) Define and briefly explain the working of Semaphore. 		(4 Marks)
ii) When are resources said to be either pre-emptable or non-pre-emptable. 									(4 Marks)
b)	i) Briefly describe at least three Disk scheduling algorithm.		(6 marks)
ii) Given that the cylinder request queue (FIFO ordering) has the following details: 38, 67, 43, 6, 75, 54, 77 and that the disk head position is at cylinder 60, show the seek pattern under SSTF and C-SCAN strategies. 		(6 marks)
 
**************************