740 likes | 875 Views
4330/6310 FIRST ASSIGNMENT Summer 2014. Jehan-François Pâris jfparis@uh.edu. C. C. S Q. R Q. IN. SSD. The model. We have One dual-core CPU One SSD One input device Two queues CPU queue "ready queue" SSD queue. FIRST EXAMPLE. Start: Process 0 at t = 5 ms. C. C. S Q. R Q.
E N D
4330/6310 FIRST ASSIGNMENTSummer 2014 Jehan-François Pârisjfparis@uh.edu
C C S Q RQ IN SSD The model We have • One dual-core CPU • One SSD • One input device • Two queues • CPU queue "ready queue" • SSD queue
Start: Process 0 at t = 5 ms C C S Q RQ IN SSD NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Your program will display • Process 0 startsTime = 5 ms or • Process 0 starts at t = 5 ms
Process 0 grabs a core at t = 5 ms C C S Q RQ IN SSD First core busy until t = 105 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What happens next? C C S Q RQ IN SSD First core busy until t = 105 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 1 starts at t = 100 ms C C S Q RQ IN SSD First core busy until t = 105 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Your program will display • Process 1 startsTime = 100 msProcess 0 is WAITING or • Process 1 starts at t = 100 msProcess 0 is WAITING
Process 1 grabs a core at t = 100 C C S Q RQ IN SSD First core busy until t = 105 msSecond core busy until t = 120 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What will happen next? C C S Q RQ IN SSD First core busy until t = 105 msSecond core busy until t = 120 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 0 gets input at t = 105ms C C S Q RQ IN SSD Second core busy until t = 120 ms Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What happens next? C C S Q RQ IN SSD Second core busy until t = 120 ms Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 1 visits SSD at t = 120 ms C C S Q RQ IN SSD First core busy until t = 140 ms Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 1 grabs a core at t = 120 ms C C S Q RQ IN SSD First core busy until t = 140 ms Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What happens next? C C S Q RQ IN SSD First core busy until t = 140 ms Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 1 terminates at t = 140ms C C S Q RQ IN SSD Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Your program will display • Time = 140 msProcess 1 terminatesProcess 0 is WAITING or • Process 1 terminates at t = 140 msProcess 0 is WAITING
C C S Q RQ IN SSD The three process states • RUNNING meansexecuting on acore • READY means waiting for a core • WAITING meansbeing neitherRUNNING orREADY
What happens next? C C S Q RQ IN SSD Process 0 busy until t = 5105 ms NEW 5 CPU 100 INPUT 5000CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 0 grabs a core at t = 5105 ms C C S Q RQ IN SSD First core busy until t = 5185 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What happens next? C C S Q RQ IN SSD First core busy until t = 5185 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 0 visits SSD at t = 5185ms C C S Q RQ IN SSD SSD busy until t = 5186 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What will happen next? C C S Q RQ IN SSD SSD busy until t = 5186 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 0 grabs a core at t = 5186 ms C C S Q RQ IN SSD First core busy until t = 5216 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
What happens next? C C S Q RQ IN SSD First core busy until t = 5216 ms NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Process 0 terminates at t = 5216 ms C C S Q RQ IN SSD NEW 5 CPU 100 INPUT 5000 CPU 80 SSD 1CPU 30 NEW 100CPU 20 SSD 0 CPU 20
Your program will display (I) • Process 0 terminatesTime = 5216 ms or • Process 0 terminates at t = 5216 ms
Your program will display (II) • SUMMARY:Number of processes that completed: 2Total number of SSD accesses: 2Average SSD access time: 0.5 msTotal elapsed time: 5216 msCPU utilization: 4.79 percentSSD utilization: 0.02 percent
How to compute CPU utilization • Keep track of total time for all RUN requests: • 100 + 80 + 30 + 20 + 20 = 250 ms • Divide by elapsed time: • 250/5216 = 0.0479 (rounded) • Since there are two cores, the maximum CPU utilization is 2.0
How to compute SSD utilization • Keep track of total time for all SS requests: • 0 + 1 = 1 ms • Divide by elapsed time: • 1/5216 = 0.0002 (rounded) • SSD utilization is normally computed for each storage device, so it will never exceed 1.0
P 0 grabs a core at t = 5 ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms
What's next? C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms
P 1 grabs a core at t = 20 ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 70ms
What's next? C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 70ms
P 2 waits for a core at t = 30 ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 70ms
What's next? C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 70ms
P 1 visits SSD then waits at t = 70ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms
P 2 grabs core at t = 70ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 90ms
What's next? C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 90 ms
P 2 visits SSD then waits at t = 90ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 120 ms
P 1 grabs a core at t = 90 ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 140 ms
What's next? C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 105 ms Second core busy until t = 140 ms
P 0 visits SSD then waits at t=105 ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 Second core busy until t = 140 ms
P grabs a core at t=105 ms C C S Q RQ IN SSD NEW 5 CPU 100 SSD 0 CPU 30 NEW 20CPU 50 SSD 0 CPU 50NEW 30CPU 20 SSD 0 CPU 20 First core busy until t = 125 ms Second core busy until t = 140 ms
To be continued • …
SSD average access time • Not as simple to compute as before when there is SSD contention • Must compute difference between • SSD request time • SSD request completion time for each SSD request
The best way to implement it • Have two counters both initialized at zero • SSDcount • SSDtimes • When a SSD request is issued by a process • Add 1 to SSDcount • Subtract current time from SSDtimes • When a SSD request is issued by a process • Add current time to SSDtimes