Department of Computer Science
Colorado State University / FALL 2017
URL:
INSTRUCTOR: Yashwant K Malaiya
HW3
DUE DATE: Mon Oct 2, 2017 5 PM. No late submissions accepted, since we want to share the solution. Submit PDF file using Canvas.
Problem 1 (4+4+4+8 =20 points) Specify true or false, or fill in the blank
- It is possible to have multiprogramming when you have a single processor. True __ False __
- For a process, the following is a valid transition: Waiting → Ready True __ False __
- Process creation using fork() results in a copy of the parent’s memory image. Assume that a new program is not loaded into the child using the exec() command. After the fork() operation, when a variable is changed in the parent process, this change is not reflected in the child process. True__ False __
- Consider the code below.
main(intargc, char **argv) {
inti;
for (i=0; i < 3; i++) {
fork(); printf("hello\n”);
}
} /
- What will be the total number of processes? Answer: ___
- How many times “hello” message will be printed? Answer: ______
Problem 2 (20 points) We had seen the exponential averaging used to predict the length of the next CPU burst. In a certain system the actual CPU burst time ti and the initial guess τi are given as in the table below. If the value of α is chosen to be 0.25, find the successive guesses.
CPU burst time ti / 6 / 4 / 6 / 4 / 13 / 13 / 13Guess τi / 10
Problem 3 (20 points) A system is running ten I/O-bound tasks and one CPU-bound task. The I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing and that each I/O operation takes 10 milliseconds to complete. Also assume that the context switching overhead is 0.1 millisecond (which does not count as the CPU being utilized) and that all processes are long-running tasks. What is the CPU utilization for a round-robin scheduler when:
- The time quantum is 2 millisecond
- The time quantum is 8 milliseconds
Answer:
Problem 5 (40 points) A system has five processes, all submitted around the same time arriving in the order P1, P2, P3, P4, P5 with the burst durations of 20, 12, 8, 16, 4 milliseconds.
- Give the Gantt diagrams for FCFS, SJF and RR (with q=4).
- Calculate the response time and the turnaround time for each process and obtain the average value for each scheduling approach. Use the tables formatted this way.
Answer:
Gantt Charts:
Response time:
Job / FCFS / SJF / RRP1
P2
P3
P4
P5
Average
Turnaround Time:
Job / FCFS / SJF / RRP1
P2
P3
P4
P5
Average