CSci 430/530 HOMEWORK 2 (60 points, Due on Fri Mar
4)
Problem 1: (20 points) In textbook, procedure chprio contains a serious design flaw if the process (whose priority is being changed) is in the ready queue.
(a) Find the design flaw, describe its consequences, and propose solution to fix it.
(b) If the process (whose priority is being changed) is in another state (other in the ready state), is there any problem. Justify your answer.
Problem 2: (15 points) Global variable numproc tells the number of active processes. Considering the code in kill can you tell whether the count in numproc should include the null process or not? A brief justification is required as a part of the answer.
Problem 3: (25 points)
Process Management
Suppose the ready queue of the running Xinu system contains the following list of processes.
|
process id |
priority |
|
0 |
0 |
|
2 |
20 |
|
3 |
10 |
|
7 |
15 |
|
9 |
12 |
(a) (15 points) Assume that
key next prev
|
0 |
0 |
|
|
|
1 |
10 |
8 |
10 |
|
2 |
20 |
|
|
|
3 |
10 |
|
|
|
4 |
20 |
11 |
8 |
|
5 |
20 |
101 |
2 |
|
6 |
25 |
1 |
10 |
|
7 |
15 |
|
|
|
8 |
15 |
4 |
1 |
|
9 |
12 |
|
|
|
10 |
MININT |
1 |
-1 |
|
11 |
MAXINT |
-1 |
4 |
|
|
… |
… |
… |
|
rdyhead ® 100 |
MININT |
|
-1 |
|
|
rdytail ® 101 |
MAXINT |
-1 |
|
|
|
|
… |
… |
… |
|
(b) (10 points) From the above table, can you determine the current process? If yes, what is the currently running process? Explain your answer in either case.