Homework Assignment 5
Name: LiMu Student ID: 0987851 Score: _______
Due date: March 30, 2017 11:59pm
Please using MS word format to submit your homework.
Send your solution to
[email protected]
Or turn in printed pape
...
Homework Assignment 5
Name: LiMu Student ID: 0987851 Score: _______
Due date: March 30, 2017 11:59pm
Please using MS word format to submit your homework.
Send your solution to
[email protected]
Or turn in printed paper solution.
Do the following exercises on Chapter 5 in international edition
5.4(15),5.7(15), 5.8(20),5.10(10), 5.15(15), 5.16(15), 5.22(10)
5.4 (15) In this chapter, we discussed possible race conditions on various kernel data
structures. Most scheduling algorithms maintain a run queue, which lists processes
eligible to run on a processor. On multicore systems, there are two general options: (1)
each processing core has its own run queue, or (2) a single run queue is shared by all
processing cores. What are the advantages and disadvantages of each of these
approaches?
Answer:
(1) Each processing core has its own run queue:
Advantages: when the scheduler is running two or more processors at the same time,
they don’t need to content which one will run first or later.
Disadvantages: the load balancing between the different run queues would be a
problem.
(2) A single run queue is shared by all processing cores:
Advantages: scheduler only need to look no further than its private run queue.
Disadvantages: it must be protected with locks to prevent a race condition and a
processing core may be available to run a thread, yet it must first acquire the lock to
retrieve the thread from the single queue.
5.7 (15) Consider the following set of processes, with the length of the CPU burst
time given in milliseconds:
Process Burst time Priority
P1 2 2
P2 1 1
P3 8 4
P4 4 2
P5 5 3
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5 all at time
0.
a. Draw four Gantt charts that illustrate the execution of these processes using the
following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a smaller
priority number implies a higher priority), and RR (quantum = 1).
[Show More]