Sunteți pe pagina 1din 7

MOI UNIVERSITY

OFFICE OF THE CHIEF ACADEMIC OFFICER

UNIVERSITY EXAMINATIONS
2011/2012 ACADEMIC YEAR
SECOND YEAR FIRST SEMESTER EXAMINATIONS

FOR THE DEGREE OF BACHELOR OF TECHNOLOGY IN COMPUTER ENGINEERING

COURSE CODE: COE 251 COURSE TITLE: OPERATING SYSTEMS DATE: TIME:

INSTRUCTIONS TO CANDIDATES
1. THIS PAPER CONTAINS SEVEN (7) QUESTIONS 2. QUESTION ONE IS COMPULSORY 3. ANSWER ANY OTHER FOUR (4) QUESTIONS

THIS PAPER CONSISTS OF (7) PRINTED PAGES PLEASE TURN OVER

COE 251: Operating Systems

Semester I

Academic year: 2011/12

Question One (Compulsory)


a) There exist two major design types for operating system kernels: monolithic kernels and microkernels. Which of these two design types satisfies each of the following requirements? Explain your answers. i) Convenient access to operating system data structures. ii) Addition of new operating system components. iii) Security and reliability.
[6 marks]

b) Using a simple system call as an example (e.g. getpid, or uptime), describe what is generally involved in providing the result, from the point of calling the function in the C library to the point where that function returns.
[4 marks]

c) A Multi-Level feedback Queues (MFQ) scheduler has the following characteristics:

Level 1 2 3

Time-Slice 10 sec 40 sec Unlimited

When dispatched

Only when level 1 is empty Only when levels 1 and 2 are empty

Assume that processes enter the scheduler in the level 1 queue and move down a level when their time-slices are exhausted. Processes do not move up levels. Preemption only occurs when the time-slice is completed. Now, consider the following set of processes and their CPU burst times.
Process A B C D E F Time-Slice 8 300 60 12 5 20

i) Show in a tabular form, the following: the order of process scheduling; the queue the process was selected from; and how long each process runs.
[3 marks] 2

COE 251: Operating Systems

Semester I

Academic year: 2011/12

ii) Identify one serious problem with this scheduler and indicate how it can be fixed.
[2 marks]

d) A semaphore consists of wait and signal operations which are defined as indivisible (or atomic) operations. i) Why must these operations be indivisible?
[1 mark]

ii) Given this atomic nature, explain whether or not other processes running on a multiprocessor system must stop when a wait or signal operation is executed
[2 marks]

Question Two
a) Describe the following scheduling algorithms showing the major strength and weakness of each algorithm. i) Non Pre-Emptive First Come First Serve ii) Round Robin
[6 marks]

b) Below is a C code fragment depicting process creation and execution in UNIX. The code creates and executes one child process is created and executed.
#include <sys/types.h> #include <sys/wait.h> #include <stdio.h> int main(int argc, char *argv[]) { pid_t whichone, first; int status; if ((first=fork())==0) { . . . . . . . } else if (first == -1) { . . . . . . . } howmany=0; while (howmany = 1) { . . . . . . . } return 0; }

COE 251: Operating Systems

Semester I

Academic year: 2011/12

i)

State one similarity between the parent and the child process.
[1 mark]

ii) Explain the use of the sys/types.h and sys/wait.h files in this construct.
[4 marks]

iii) What are the probable system call to exit() values for the if and the else if blocks of code?
[2 marks]

Question Three
a) Define the following concepts: i) Race condition ii) Bounded use iii) Busy waiting
[3 marks]

b) Below is Petersons algorithm, a concurrent programming algorithm for mutual exclusion that allows two or more processes to share a single-use resource without conflict, using only shared memory for communication.

Determine which of the following statements are TRUE and which ones are FALSE. i) If P0 is in its critical section, then flag[1] is 1 and either flag[1] is false or turn is 0. ii) If P0 is in its critical section, then flag[0] is 1 and either flag[1] is false or turn is 0 iii) P0 is granted Entrance to the critical section if P1 does not want to enter its critical section or
if P1 has given priority to P0 by setting turn to 0.

iv) A process will not wait longer than one turn for entrance to the critical section. v) A process will wait longer than one turn for entrance to the critical section.
[5 marks]

COE 251: Operating Systems

Semester I

Academic year: 2011/12

c) Describe Dijkstras bankers algorithm clearly showing what it seeks to achieve.


[5 marks]

Question Four
a) Consider the following diagram showing a common memory allocation scheme.

Determine the following: i) ii) iii) iv) The memory allocation scheme depicted in this diagram. The identity of addresses x and y The memory management operation represented by z. The value of y given the value of x as 346 and relocation register value as shown.
[4 marks]

b) i)

Explain the principles behind the buddy system as a memory management scheme .
[4 marks]

ii) Consider a PC with a memory size of 256K, initially empty. Requests are received for blocks of memory of 5K, 25K, 35K and 20K. Show how the buddy system would manage this string of requests, showing the memory layout at each stage and the status of the lists at the end.
[4 marks]

iii) What happens after the 25K process terminates and returns its memory?
[1 mark]

COE 251: Operating Systems

Semester I

Academic year: 2011/12

Question Five
a) Distinguish segments from pages.
[2 marks]

b) Describe the concept of a page fault clearly outlining the actions taken by the operating system when a page fault occurs.
[5 marks]

c) Suppose that pages in a virtual address space are referenced in the following order: 70120304230321201701 There are three empty frames available. Assume that paging decisions are made on demand, i.e., when page faults occur. i) Show the contents of the frames after each memory reference, assuming the LRU replacement policy is used. ii) How many page faults occur in this policy?
[6 marks]

Question Six
a) State four examples of le meta-data (i.e., le attributes) that are maintained in a typical le system (e.g., Linux or Windows).
[2 marks]

b) An operating system supplies system calls to allow you to copy, delete and rename a file. Discuss the differences between using copy/delete and rename to give a file new name?
[5 marks]

c) A system uses contagious allocation. How many read and write operations would be required to add a block to or remove a block from a 101 block file under the condition specified below? You may assume the following: The location of the first block of the file is already in memory The block of information to be added is already in memory In calculating the number of I/O operations, if the location of the first block of a file changes, do not include the output operations needed to rewrite that revised information to the directory entry on the disk There is room for the file to grow at the end of the file but not at the beginning The middle block is the 51st block Do not include any I/O operations needed to add a removed block to the free list.
6

COE 251: Operating Systems

Semester I

Academic year: 2011/12

i) Add a block at the beginning ii) Add a block at the end iii) Remove the middle block
[6 marks]

Question Seven
a) Why is it important for an operating system to schedule disc requests?
[4 marks]

b) Compare I/O based on polling with interrupt-driven I/O.


[3 marks]

c) A disk contains 100 cylinders (0 to 99). In order to move the read/write heads from one cylinder to the next, one time unit is required. At time 0 the heads are at cylinder 0 and no requests are pending. The following six requests arrive at the times shown in the table:

Time Cylinder

0 21

10 75

20 16

70 68

80 2

90 19

Note that once the heads are moving, the arrival of a new request will not alter the intended destination of the heads in that movement. Assuming that the rotational and transfer times are negligible, give the order in which the cylinders will be visited and the total time required for the elevator algorithm.
[6 marks]

S-ar putea să vă placă și