COMP3230-无代写
时间:2024-10-03
COMP3230 Principles of Operating Systems
Problem Set #1
Due date: 23:59 pm, October 4, 2024
Total 7 points
(version: 1.0)
Note: This assignment weights a total of 7 points in the final marks of this course. However, just like each
process has its own private virtual address space, this assignment also has its own virtual score space of
100 points, which is mapped to 7 points of physical marks. The below points for each question are given in
the said virtual score space.
Question 1 – Process (18 points)
(This question is related to ILO2a – “explain how OS manages processes/threads”.)
Consider an Operating System that adopts the following five-state process model. Answer the
following questions.
1) If this operating system is implemented on a computer system with 8 cores, how many
processes can be in progress at any time in this system? Please justify your answer.
2) Is this operating system suitable for managing a desktop computer? Please justify your
answer.
3) Of the scheduling algorithms covered in the lecture, which one(s) would be appropriate for
this operating system? If there are multiple options, which one is the most suitable in terms of
throughput? Please justify your answer.
Question 2 – Context Switch (22 points)
(This question is related to ILO2 – “explain the principles behind the core function: Process Management”,
and ILO 4 – “demonstrate knowledge in applying system software and tools”.)
Consider a single-core computer with only 2 user processes P1 and P2. The OS employs a
priority-based scheduling policy and selects the process of the highest priority to run whenever it
has a chance to schedule. P1 has a higher priority than P2. Assume P1 is currently running and P2
is in the ready queue. Further assume the machine doesn’t have a timer device for timer interrupts
and all the system calls are successful. Answer the following questions.
1) Consider that P1 makes a system call to read a file from the disk. Describe the major OS
behaviors from when the system call is made to the time when the call completes and returns.
Write down the key events (e.g., mode switches, context switches, etc) as bullet points.
2) Assume P2 is a process with the following pseudo code. When P2 is scheduled to run, what
would be the possible resulting values of x upon the completion of P2? Please explain your
answer.

3) Following 2) and given the above settings, do you think P2 would run to completion without
being de-scheduled once it starts executing on the CPU (i.e., the first time it is scheduled)?
Why or why not?

Question 3 – OS Architecture (20 points)
(This question is related to ILO 1 –discuss the characteristics of different structures of the Operating
Systems and identify the core functions of the Operating Systems.)
Compare the modular monolithic architecture and microkernel architecture to determine which
one better meets the following requirements. Provide a brief justification for your choice. If both
architectures are equally suitable, explain the rationale behind your answer.
1) Porting the operating system to a new computer architecture.
2) Modification of kernel components.
3) Security and reliability.
4) Providing efficient performance.

Question 4 - Process Scheduling (40 points)
(This question is related to ILO 2a - "discuss the mechanisms and policies in efficiently sharing of CPU
resources" and ILO 3 – “analyze and evaluate the algorithm and explain the performance issues”.)
Consider there are seven processes running on a single-core processor machine. The following
table shows the arrival times and CPU burst times of the seven processes. Assume new processes
always be inserted to the ready queue just before the arrival time, e.g., at t=7, B has been added to
the end of the ready queue.
Process Arrival Time CPU Time
A 0 25
B 7 10
C 12 8
D 20 6
E 36 30
F 53 3
G 70 16
1) Suppose a system uses Round Robin (RR) scheduling policy with a time quantum of 4 time
units, and the context switching time is 1 time unit.
a. Draw the Gantt (timeline) diagram illustrating the execution of these processes under this
RR policy.
b. What is the average turnaround time for the processes?
c. What is the average waiting time for the processes?
d. What is the average response time for the processes?
2) Consider another system using a variant of the Multilevel Feedback Queues (MLFQ)
scheduling policy. This MLFQ system adopts the following set of rules:
• It has 3 priority levels with level 3 as the highest priority and level 1 is the lowest.
• For level 3, its time quantum is set to 4 time units; for level 2, it is set to 8 time units; for
level 1, it is set to 12 time units. Furthermore, assume the context switching time is 1 time
unit.
• Once a process uses up its time quantum at a given level, its priority is reduced (i.e., it
moves down one queue).
• Once a process is scheduled to be executed by the processor, it will only be switched out
by the scheduler if its time quantum has reached, i.e., it will not be preempted by the
arrival of higher priority processes.
a. Draw the Gantt diagram illustrating the execution of those processes under this MLFQ
policy.
b. What is the average turnaround time for the processes?
c. What is the average waiting time for the processes?
d. What is the average response time for the processes?

essay、essay代写