Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMPS267F
Operating Systems
PRACTICE ASSIGNMENT
The following is just to show the content that is similar to what you will see in the Take-Home
Assignment. It is not relevant to this Practice Assignment.
Important Notes about the Take Home Assignment
• This assignment is open book. Some questions are challenging, normally no perfect answer
will be expected. You should consider the time is never enough. Proficiency and efficiency
are part of the assessment.
• The plagiarism rules of the university are applied. The submitted work must be original, that
is, your own. The students will be disqualified if plagiarised materials are submitted. For
examples, students should not aid or attempt to aid another student or receive or attempt to
receive aid from another person, or interact on sharing platforms, or copy a part or the whole
answers from a source. Students committed plagiarism will be penalized.
• You should constantly check your email account for announcements
and updates.
• The final assignment is available for download at 09:00 on the scheduled date. The submission
time is 17:00. No late submission is allowed.
Important Notes about Working on the Assignment
• You should answer in English. Show steps in your answers that involves calculation.
• Write down your assumptions to supplement the information of a question if needed.
• Over-verbose answers and answers with contradictory content will be penalised.
• You should download the Answer Book Word template file. Type in or copy all your answers
into the designated space in the Answer Book.
Submission Method
• You should only submit the Answer Book (in PDF format) with your answers entered in the
answer boxes.
o Optionally you may submit also the original Word document of the Answer Book
• You are normally allowed to submit only once before the end of the prescribed deadline for
submission at the OLE.
Good Luck Students!
NOTES ABOUT THIS PRACTICE ASSIGNMENT
The aim of these exercises and practices is to show you the format of the short and long questions in the
take-home assignment so that you can be better prepared.
The sample questions shown here have no relation to the questions in the real assignment paper, both in
content and in difficulty level. The real paper is open-book and may contain more open-ended and
challenging questions which are not shown here. The open-ended questions may take you more time
(of course some may think otherwise).
The most challenging open-ended problem-solving questions are not included.
You should answer in the Answer Book in the actual take-home assignment
COMPS267F (PRACTICE ASSIGNMENT)
COMPS267F (2200) PRACTICE ASSIGNMENT Page 3 of 26
Part 1
(a) Write down any suitable performance requirement on desktop systems.
(b) Write down any service provided by typical operating systems in the aspect of process
management.
(c) Define CPU bound processes in the context of program execution.
(d) In a single-processor, single-programming system, three IO bound processes are created at the
same time and ready for execution. The turnaround time of each process is expected to be 20
ms in a single programming environment and each would spend 10% using the CPU. Assume
that there is no context-switching overhead.
(i) Apart from the New state and the Terminate state, which other three states would the
three processes spend time in?
(ii) Which of the three states would all three processes definitely spend the same amount of
time?
(iii) Which component of the operating system is responsible for selecting the process to
use the processor?
(iv) Estimate the best CPU utilization rate during the execution of the three processes.
(v) If the same three processes were executed in a single-processor, multi-programming
system, would the best CPU utilization rate change? Justify your answer.
(e) State a major difference between preemptive and non-preemptive scheduling (in fewer than 30
words). Give one example CPU scheduling algorithm that is based on preemptive scheduling.
(f) Compare the following two CPU scheduling algorithms. Describe which performance
aspect(s) would differ significantly. Justify your answer.
Algorithm A: Round-Robin (RR) with time quantum of 10 ms.
Algorithm B: Round-Robin (RR) with time quantum of 1 ms.
COMPS267F (PRACTICE ASSIGNMENT)
COMPS267F (2200) PRACTICE ASSIGNMENT Page 4 of 26
Part 2
(a) A barbershop consists of a waiting room with n chairs; and the barber room containing the
barber chair.
• If there are no customers to be served the barber goes to sleep.
• If a customer enters the barbershop and all chairs are occupied, then the customer leaves
the shop.
• If the barber is busy, then the customer sits in one of the available free chairs.
• If the barber is asleep, the customer wakes the barber up.
Fill in the blanks in the following program with the appropriate semaphores that coordinate the
barber and the customers.
Shared data structures:
var barber, wait: semaphore; {initially = 0}
entry: semaphore; {initially = 1}
count: integer; {initially = 0}
Code for the barber is:
repeat
wait(barber);
“shave”
until false;
Code for a customer process:
wait( __________ );
if count = n
then exit;
count := count + 1;
if count > 1
then
begin
signal( __________ )
wait( __________ );
end
else
signal( __________ );
signal( __________ );
“shave”
COMPS267F (PRACTICE ASSIGNMENT)
COMPS267F (2200) PRACTICE ASSIGNMENT Page 5 of 26
wait( __________ );
count := count – 1;
if count > 0
then
signal( __________ );
signal( __________ );
(b) The following table shows the current state information of different processes with the units of
resource allocated and demanded to complete the process.
Assume there is only 1 unit of resource available at the moment, state whether this is a safe state.
Justify your answer.
Process Allocation Max
P1 1 4
P3 4 6
P5 5 8
P7 0 2
(c) Access-List and Access-Group are two file access protection schemes. State their differences.
(d) Explain the meaning of a device independent I/O system. Discuss how it is related to the
concepts of logical and physical devices.
(e) Consider the following segment table.
Segment Base Length
0 219 600
1 2321 14
2 90 100
3 1230 580
4 1990 96
What are the physical addresses for the following logical addresses?
(i) (2, 90)
(ii) (3, 200)
(iii) (4, 100)
COMPS267F (PRACTICE ASSIGNMENT)
COMPS267F (2200) PRACTICE ASSIGNMENT Page 6 of 26
(f) Write down True or False for each of the following statements about threads.
[2]
(i) A thread can have many processes.
(ii) A thread has its own program counter.
(iii) Context switching between threads is more efficient than that of processes.
(iv) Kernel-level threads are managed directly by the operating system kernel.
COMPS267F (PRACTICE ASSIGNMENT)
COMPS267F (2200) PRACTICE ASSIGNMENT Page 7 of 26
Part 3
(a) First-come-first-serve (FCFS) is a relatively simple CPU scheduling algorithm. Consider that
there are two multi-programming systems A and B. System A executes mostly CPU bound
processes, and system B executes mostly IO bound processes. Which system would be best to
demonstrate the benefits of using FCFS? Explain your answer.
(b) Assume that the memory access time is 200 ns (i.e. 0.2 μs), and the page-fault handling time is
20 ms. Assume that the page fault rate is 0.00001, evaluate the effective memory access time.
(c) Chris has found that his computer has a problem. Anders suggests that the problem is called
thrashing, and he recommends to Chris to execute fewer programs at the same time. Chris asks
you to explain further to him about thrashing, and to tell him if Anders' solution is correct.
(d) Suppose the effective memory access time is 20 ns on a cache hit and 100 ns on a cache miss.
Calculate the hit rate to achieve an average effective memory access time of 60 ns?
(e) What special hardware support is needed for the implementation of a segmentation-based
memory management system? Explain how this hardware is used in translating a logical address
with segment number S and offset D.
(f) Explain the reason why users can more likely use the most up-to-date software with software-
as-a-service (SAAS) cloud computing service.
(g) Describe any two benefits of Computer Clusters for mission critical systems such as the patient
management system of a hospital. Justify your answers.
(h) Define what is locality of references in memory access. Give an example of programming
structure or construct that leads to locality of references.