Systems Architecture
121 Assignment 3
DUE 6pm Friday XXX, end of week `1

Rules

  1. The course rules on own work and plagiarism apply to this assignment. See the subject outline page for details. Your submission will be cross-compared to other student submissions to ensure that answers have not been shared.
  2. The due date for the assignment is a hard date. You will need to supply a good reason if an extension is required. Unless you have given me your written request for extension, and I have approved an extension (along with my signature), late submissions will not be accepted. This assignment is worth 15% of your final mark in this course.

Submission

Your answer to the assignment must be submitted electronically through the iLearn portal as a Zip or tar file containing all of the source code files: no other submission will be accepted. Instructions on how to create a Zip or tar file are given somewhere.
Please submit your Zip or tar file for the assignment through the iLearn submission area.

Question One - 3 marks

The Weirdnix OS uses this process priority mechanism:
  1. Process priorities range from 0 (best) to 16 (worst).
  2. The maximum timeslice for any process is 10ms.
  3. If a process uses all of or exceeds its timeslice, then its priority is lowered by one point.
  4. If a process is blocked before it uses all of its timeslice, then its priority is increased by one point.
  5. When a process is returned to a Ready queue, it is put on the tail of the Ready queue.
  6. At context switch time, the next process chosen to run comes from the head of the highest priority non-empty Ready queue.
The system currently has four processes. The following table lists their current priority, and the amount of CPU they will want to use before blocking.
Process Current Priority Future CPU Use
1 0 10, 5, 5, 8, 12
2 1 20, 20, 20, 20
3 4 20, 5, 20, 5, 20, 5
4 8 2, 10, 8, 8, 8, 8
i.e. Process 1 wants to do 10ms then block, 5ms then block, 5ms then block etc.
Which process will finish executing first? Which process will finish last? Write out the scheduling of each process in turn, with details of its priority as it is returned to the Ready queues.

Question Two - 3 marks

The Pentium has pages that are 4,096 bytes in size. The MMU is using the following page table:
Logical Page Physical Page Frame
0 27
1 41
2 invalid
3 12
4 28
5 44
6 12
Determine the physical address that will be referenced when a process reads from these logical locations:
  1. 560
  2. 12,290
  3. 24,575
  4. 8,000
If the process writes to logical address 15,000, determine what other logical address will be affected, and explain why this other address will be affected.

Question Three - 3 marks

A computer has five page frames. The time of loading, time of last access, and the accessed (A) and modified (M) bits for each page frame are as shown below (with times in clock ticks, smaller numbers are older numbers):
Frame Load Time Access Time A M
0 700 - 0 0
1 220 600 1 0
2 500 510 1 1
3 450 500 0 1
4 400 590 1 1
  1. Which page frame will NRU replace? Explain why.
  2. Which page frame will LRU replace? Explain why.
  3. Which page frame will FIFO replace? Explain why.
  4. Which page frame will Second Chance replace? Explain why.

Question Four - 3 marks

Semaphores are usually implemented by the OS, so that a process is blocked by the OS if it cannot acquire a semaphore, and made ready when it does acquire the semaphore.
An alternative method of implementing semaphores is to allow a process to turn off pre-emption to enter a critical section; this stops any other process from running, making the critical section atomic.
Suggest reasons why this method is generally never used to implement semaphores.

Question Five - 3 marks

Explain why context switching between threads in the same process is faster than switching between threads that belong to different processes. An OS designer might choose to prioritise context switches between threads in the same process; show how this can lead to CPU starvation for other threads.


File translated from TEX by TTH, version 3.85.
On 13 Jan 2012, 12:52.