Está en la página 1de 7

MOI UNIVERSITY

OFFICE OF THE CHIEF ACADEMIC OFFICER

UNIVERSITY EXAMINATIONS
2010/2011 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 (1) IS COMPULSORY. ATTEMPT ANY OTHER FOUR QUESTIONS

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

COE 251: Operating Systems

Semester I

Academic year: 2010/11

Question One (Compulsory)


a) The diagram below is a simplified representation of process transition from user to kernel mode.

i)

Identify the mode bits x and y.


[1 mark] [1 mark]

ii) What are the mode bits for the kernel and user mode? iii) List two file system calls associated with this transition.
[1 mark]

b) The following table contains a list of computer instructions. Indicate which of the given instructions should be done in user mode and which ones should be done in the privileged mode.

[4 marks]

c) List three key differences between processes and threads.


[3 marks]

d) Ideally, many CPU-scheduling algorithms are parameterized. For example, the MFQ require parameters to define the number of queues etc. These algorithms are thus really sets of algorithms. One set of algorithms may include another. What (if any) relation holds between the following pairs of algorithm sets? i) ii) iii) iv) Priority and SJF Multilevel feedback queues and FCFS Priority and FCFS RR and SJF
[4 marks]
2

COE 251: Operating Systems

Semester I

Academic year: 2010/11

e) Suppose the following two processes, foo and bar are executed concurrently and share the semaphore variables S and R (each initialized to 1) and the integer variable x (initialized to 0).

i) Determine a sequence for concurrent execution of these two processes in which one or both of them can be blocked forever.
[2 marks]

ii) Determine a sequence for concurrent execution of these two processes in which there is indefinite post ponement of one of them.
[2 marks]

Question Two
a) Explain how the combination of I/O bound processes with CPU-bound processes aid in maximizing system utilization. Why was this particularly important in batch systems?
[3 marks]

b) Suppose that at time 5, no system resources are being used except for the processor and memory. Now, consider the following events:
At time 5: P1 executes a command to read from disk unit 3. At time 15: P5's time slice expires. At time 18: P7 executes a command to write to disk unit 3. At time 20: P3 executes a command to read from disk unit 2. At time 24: P5 executes a command to write to disk unit 3. At time 28: P5 is swapped out. At time 33: An interrupt occurs from disk unit 2: P3's read is complete. At time 36: An interrupt occurs from disk unit 3: P1's read is complete. At time 38: P8 terminates. At time 40: An interrupt occurs from disk unit 3: P5's write is complete. At time 44: P5 is swapped back in. At time 48: An interrupt occurs from disk unit 3: P7's write is complete.

For each time 22, 37, and 47, identify which state each process is in. If a process is blocked, further identify the event on which is it blocked.
[3 marks]

COE 251: Operating Systems

Semester I

Academic year: 2010/11

c) The table below shows five processes with their indicated number of run time units, answer the questions that follow. Assume that the processes arrived in numerical order at time 0.

i) Show the scheduling order for these processes under FCFS, SJF and RR scheduling (quantum = 1).
[3 marks]

ii) For each process in each schedule above, indicate the wait time and turnaround time. Present your answers in the following format:

[3 marks]

d) What Unix system calls are used for process creation and execution respectively?
[1 mark]

Question Three
a) Briefly describe the following concepts as used in Interprocess Communication: i) Race condition ii) Critical section iii) Lock
[3 marks]

b) Below is an implementation of a monitor. Explain how the algorithm achieves mutual exclusion.
monitor account { int balance := 0 function withdraw(int amount) { if amount < 0 then error "Amount may not be negative" else if balance < amount then error "Insufficient funds" else balance := balance - amount } function deposit(int amount) { if amount < 0 then error "Amount may not be negative" else balance := balance + amount } } [3 marks]
4

COE 251: Operating Systems

Semester I

Academic year: 2010/11

c) List any three conditions necessary for deadlocks to occur.


[3 marks]

d) If deadlock is controlled by the Banker's algorithm, explain why: i) Decreasing Available (removing resources) may bring about deadlock. ii) Increasing the number of processes makes the state safe
[4 marks]

Question Four
a) Explain the difference between logical and physical addresses. Why are logical addresses important?
[3 marks]

b) Suppose a fixed partitioning memory system with partitions of 100K, 500K, 200K, 300K, and 600K (in memory order) exists. All five partitions are currently available. i) Using the best fit algorithm, show the state of memory after processes of 212K, 417K, 112K, and 350K (in request order) arrive.
[2 marks]

ii) At the end of part i), how much internal fragmentation exists in this system?
[2 marks]

c) Consider the following factors: i) Internal fragmentation, ii) Process table size, iii) I/O overhead, iv) Locality of reference. Which of these factors could be used to argue for a large page size, and which could be used to argue for a smaller page size? Why?
[4 marks]

d) Consider a logical address space of eight pages of 1024 bytes each, mapped onto a physical memory of 32 frames. i) How many bits are there in the logical address? ii) How many bits are there in the physical address?
[2 marks]

Question Five
a) State three factors that affect the choice of a virtual memory page size.
[3 marks]

b) Distinguish between the resident set and the working set of a process.
[2 marks]

c) Consider a demand paged memory management system with the following characteristics:
Page size = 4K = 212 bytes; Physical address space = 224 bytes Logical address space = 232 bytes; TLB size = 26 bytes
5

COE 251: Operating Systems

Semester I

Academic year: 2010/11

i)

How many bits are needed to specify a logical address? Give the number of bits for the page number and offset.
[1 mark]

ii) How many page table entries can fit in the TLB if each entry only contains the data needed for logical to physical translation? Show your work.
[2 marks]

iii) How many page table entries are needed when a program uses its full logical address space?
[1 mark]

d) Briefly describe the concept of thrashing clearly showing its cause, detection and what the system can do to eliminate this problem.
[4 marks]

Question Six
a) Describe one problem that could occur if a system allowed a file system to be mounted simultaneously at more than one location.
[2 marks]

b) Give an example of an application in which data in a file should be accessed in the following order: i) Sequentially ii) Randomly
[2 marks]

c) A file currently consists of 100 blocks. Assume that the file-control block (and the index block, in the case of indexed allocation) is already in memory. Calculate how many disk I/O operations are required for contiguous, linked, and indexed (single-level) allocation strategies, if, for one block, the following conditions hold. In the contiguousallocation case, assume that there is no room to grow at the beginning but there is room to grow at the end. Also assume that the block information to be added is stored in memory. i) The block is added at the beginning. ii) The block is added in the middle. iii) The block is added at the end. All your workings MUST be shown.
[6 marks]

d) List any three file operations.


[3 marks]

COE 251: Operating Systems

Semester I

Academic year: 2010/11

Question Seven
a) Explain how DMA increases system concurrency. How does it complicate hardware design?
[4 marks]

b) An operating systems disk controller software has the following set of pending disk requests: 26, 37, 100, 14, 88, 33, 99, 12 These requests are listed in the order in which they were received. Assume that the disk head is initially positioned over 26. Compute the number of head movements for the following disk scheduling policies: i) First-Come First-Served (FCFS) ii) Shortest Seek Time First (SSTF) iii) C-SCAN All your workings MUST be shown.
[6 marks]

c) Ignoring CPU overhead, what are the three primary components of disk access time? Considering the transfer of a single sector, rank them according to their relative average cost.
[3 marks]

También podría gustarte