* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download HW1 solutions - Colorado State University Computer Science
Density matrix wikipedia , lookup
Quantum electrodynamics wikipedia , lookup
Many-worlds interpretation wikipedia , lookup
Measurement in quantum mechanics wikipedia , lookup
Quantum fiction wikipedia , lookup
Hydrogen atom wikipedia , lookup
EPR paradox wikipedia , lookup
Interpretations of quantum mechanics wikipedia , lookup
Symmetry in quantum mechanics wikipedia , lookup
Quantum teleportation wikipedia , lookup
Orchestrated objective reduction wikipedia , lookup
History of quantum field theory wikipedia , lookup
Canonical quantization wikipedia , lookup
Quantum key distribution wikipedia , lookup
Quantum machine learning wikipedia , lookup
Quantum computing wikipedia , lookup
Hidden variable theory wikipedia , lookup
CS 370: Operating Systems Department of Computer Science Colorado State University FALL 2015 URL: http://www.cs.colostate.edu/~cs370 INSTRUCTOR: Yashwant K Malaiya HW1 CPU Scheduling DUE DATE: Friday October 8 2015 5 PM. Submit PDF file using Canvas. Problem 1 (20 points) We had seen the exponential average expression used to predict the length of the next CPU burst. What are the implications of assigning the following values to the parameters used by the algorithm? 1. α = 0 and τ0 = 20 milliseconds 2. α = 0.99 and τ0 = 10 milliseconds Answer: a) τn +1= α * tn + (1-‐ α) * τn When α = 0 and τ0 = 20 milliseconds, the equation will be: τn +1= 0* tn + (1-‐ 0) * 20 = 20 milliseconds When α= 0 and τ0 = 20 milliseconds, the formula always makes a prediction of 20 milliseconds for the next CPU burst. b) τn +1= α * tn + (1-‐ α) * τn When α = 0.99 and τ0 = 10 milliseconds, the equation will be: τ1= 0.99* t0 + (1-‐ 0.99) * 10 = [ 0.99 t0 + 0.1] milliseconds τn +1= 0.99* tn + (1-‐ 0.99) * τn = [ 0.99 tn + 0.1 τn] milliseconds When α= 0.99 and τ0 = 10 milliseconds, the most recent behavior of the process is given much higher weight than the past history associated with the process. Consequently, the scheduling algorithm is almost memoryless, and simply predicts the length of the previous burst for the next quantum of CPU execution. CS 370: Operating Systems FALL 2015 Department of Computer Science URL: http://www.cs.colostate.edu/~cs370 Colorado State University INSTRUCTOR: Yashwant K Malaiya Problem 2 (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: 1. The time quantum is 1 millisecond 2. The time quantum is 10 milliseconds Answer: • The time quantum is 1 millisecond: Irrespective of which process is scheduled, the scheduler incurs a 0.1 millisecond context-switching cost for every context-switch. This results in a CPU utilization of 1/1.1 * 100 = 91%. • The time quantum is 10 milliseconds: The I/O-bound tasks incur a context switch after using up only 1 millisecond of the time quantum. The time required to cycle through all the processes is therefore 10*1.1 + 10.1 (as each I/O-bound task executes for 1 millisecond and then incur the context switch task, whereas the CPU-bound task executes for 10 milliseconds before incurring a context switch). The CPU utilization is therefore 20/21.1 * 100 = 94%. CS 370: Operating Systems Department of Computer Science Colorado State University FALL 2015 URL: http://www.cs.colostate.edu/~cs370 INSTRUCTOR: Yashwant K Malaiya Problem 3 (60 points) The processes in the table below are being scheduled using round-robin scheduling algorithm with preemption. Each process is has a numerical priority, with a higher number indicating a higher priority. In addition to the processes listed below, the system also has an idle task (which consumes no CPU resources and is identified as Pidle ). This task has priority 0 and is scheduled whenever the system has no other available processes to run. The length of a time quantum is 10 units. If a process is preempted by a higherpriority process, the preempted process is placed at the end of the queue. a. Show the scheduling order of the processes using a Gantt chart. b. What is the turnaround time for each process? c. What is the waiting time for each process? d. What is the CPU utilization rate? Thread P1 P2 P3 P4 P5 P6 Answer: Priority 40 30 30 35 5 10 Burst 20 25 25 15 10 10 Arrival 0 25 30 60 100 105 b) P1=20-‐0=20 , P2=80-‐25=55 , P3=90-‐30=60 , P4= 75-‐60 =15, P5=120-‐100=20 , P6=115-‐105=10 c) P1=0 , P2=0+10+20=30 , P3=5+10+15+5=35 , P4=0 , P5=0+10=10 , P6=0 d) CPU util= (20+25+25+15+10+10)/120 =105/120=87.5 %