Você está na página 1de 6

MOI UNIVERSITY

OFFICE OF THE CHIEF ACADEMIC OFFICER

UNIVERSITY EXAMINATIONS
2007/2008 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. ATTEMPT ANY FIVE QUESTIONS FROM THIS PAPER

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

Question one
(a) Most computer users have had some experience with an operating system, but it is difficult to pin down precisely what an operating system is. Part of the problem is that operating systems perform two basically unrelated functions i.e. as an extended machine and as a resource manager. Briefly comment on these functions. (i) Explain the terms monolithic and microlithic kernels. (2 marks) (ii) List two advantages associated with microlithic kernels. (2 marks) (c) Distinguish between kernel and user operation. Explain why different modes of operation are desirable. (4 marks) (d) Evaluate the following concepts by indicating whether each of them is true or false. (i) Program status word contains state information on a program in the event of interrupt or trap. (1 mark) (ii) To obtain a service from the operating system, a user program must make a system call. (1 mark) (iii) Microkernel operating systems provide file services through Inter-process communication (IPC) (1 mark). (iv) Changing memory management register is a case of instruction in user mode. (1 mark) (2 marks) (b) Modern operating system design tends to favour microlithic kernels over monolithic kernels.

Question two
(a) State one example of an operating system that is: (i) Single process single threaded.(1 mark) (ii) Multi-process single threaded. (1 mark) (iii) Multi-process multithreaded. (1 mark) (b) On a system using non-preemptive scheduling, processes with expected run times of 6, 17, 10 and 13 are in the ready queue. In what order should they be run to minimize wait time? (c) For the processes listed in the table below: (i) Draw a chart illustrating their execution using determine their execution using Round Robin (quantum =2). (ii) Determine turnaround time. (2 marks)

Process A B C D

Arrival time 0.000 2.001 3.001 3.002

Processing time 4 7 2 2

(4 marks)

(d) UNIX implements process creation and termination using the fork and exec supervisor calls. Use the following code segment to describe how fork and exec calls work in UNIX. (5 marks)
#include <sys/types.h> #include <sys/wait.h> #include <stdio.h> int main(int argc, char *argv[]) { pid_t whichone, first, second; int howmany; int status; if ((first=fork())==0) { printf("Hiya, I am the first child, " "and my id is %d\n", getpid() ); sleep(10); exit(0); } else if (first == -1) { perror("1st fork: something went bananas\n"); exit(1); } else if ((second=fork())==0) { printf("Hiya, I am the second child, " "and my id is %d\n", getpid() ); sleep(15); exit(0); } else if (second == -1) { perror("2nd fork: something went bananas\n"); exit(1); } printf("This is the parent\n"); howmany=0; while (howmany < 2) { whichone=wait(&status); howmany++; if (whichone==first) printf("First child exited "); else printf("Second child exited "); if ((status & 0xffff)==0) printf("correctly\n"); else printf("incorrectly\n"); } return 0; }

Question three
(a) (i) Define concurrency as used in interprocess communication. (2 marks) (ii) Complete the following signalling primitive to show how interprocess communication is achieved. (4 marks) a_signal(b, c) d_signal(e, c) (b) Clearly explain the concept of no indivisibility. Show how it relates to access to critical section. (3 marks) (c) Show that the TestAndSet (ts) solution presented below guarantees mutual exclusion. (5 marks)

Question Four
(a) Define each of the following resource types and State one example of each type. (i) A preemptive resource. (2 mark) (ii) A non preemptive resource. (2 mark) (b) List three typical computer applications where deadlock is a serious problem. (3 marks) (c) Explain Dijkstra's Bankers algorithm. What does it seek to solve? (5 marks) (d) Consider the following resource allocation graphs and determine which of them is deadlocked and which one is not. (2 marks)

(i)

(ii)

Question Five
(a) Explain the following terms: Relocatable code, base register and logical address. (3 marks) (b) (i) Why are page sizes always a power of two? (3 marks) (ii) On a simple paging system with 224 bytes of physical memory, 128 pages of logical address space, and a page size of 28, how many bits in the physical address specify the page frame? (3 marks) (c) (i) how does segmentation offer better memory management than multiple variable partition? (2 marks) (ii) Consider the following system using simple segmentation. Compute the physical address for each of the logical addresses, given the following segment table. If the address generates a page fault, indicate so.

Segment 0 1 2

Base 320 866 101

Length 114 201 89

At segment 0, Length of 87. (1 mark) At segment 2, length of 68. (1 mark) At segment 1, length of 255. (1 mark)
4

Question Six
(a) Define virtual memory, clearly stating the requirements for such a system. (4 marks) (b) Given references to the following pages by a program, 0,1,4,2,0, 2,6,5,1,2, 3,2, How many page faults will occur if the program has three page frames available to it and uses: (i) FIFO replacement? (ii) Optimal replacement? Show all your workings. (6 marks) (c) What is the link between thrashing and locality of reference? Show how they affect system performance. (4 marks)

Question Seven
(a) Show how the following directory structure satisfies the requirements of nondirectory objects with multiple names. (3 marks)

(b) In each of the following cases, determine the number of records a program must read to input into the next record according to the respective instructions given. (i) A program has just read the first record in a direct access file. It next wants to read the tenth record. (1 mark) (ii) A program has just read the tenth record in a sequential access file. It next wants to read the sixth record. (1 mark) (c) List three major options for implementing file locking. (3 marks) (d) (i) what is the difference between buffer and cache? (2 marks) (ii) Write short notes on the following I/O organization: Busy wait. (2 marks) Direct memory access. (2 marks)

Você também pode gostar