1 / 71

4330/6310 FIRST ASSIGNMENT Spring 2014

4330/6310 FIRST ASSIGNMENT Spring 2014. Jehan-François Pâris jfparis@uh.edu. C. C. C. C. D Q. R Q. I Q. TTYs. Disk. The model. We have one quad-core CPU one disk many TTYs A total of three queues CPU queue for RT processes CPU queue for interactive processes Disk queue.

sasson
Download Presentation

4330/6310 FIRST ASSIGNMENT Spring 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4330/6310 FIRST ASSIGNMENTSpring 2014 Jehan-François Pârisjfparis@uh.edu

  2. C C C C D Q RQ IQ TTYs Disk The model We have • one quad-core CPU • one disk • many TTYs A total of three queues • CPU queue for RT processes • CPU queue for interactive processes • Disk queue

  3. Why two CPU queues? • To favor Real-Time (RT) processes • When all four cores are busy, there may be RT and interactive processes waiting for the CPU • When one or more cores become free, no interactive process will get CPU time until no real-time processes remain in the RT queue • Actual operating systems use much more sophisticated algorithms

  4. FIRST EXAMPLE

  5. Start: P0 arrives at t = 0 ms C C C C D Q RQ IQ TTYs Disk INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  6. Your program will display • Process 0 startsTime = 0msClass = INTERACTIVE or • INTERACTIVE process 0 starts at t = 0ms

  7. Process 0 grabs a core C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First core busy until t = 10ms INTERACTIVE 0RUN 10TTY 1000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  8. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First core busy until t = 10ms INTERACTIVE 0RUN 10TTY 1000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  9. P1 arrives at t = 5ms C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First core busy until t = 10msSecond core busy until t = 25ms INTERACTIVE 0RUN 10TTY 1RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  10. Your program will display • Process 1 startsTime = 5msClass = REAL-TIME or • REAL-TIME process 1 starts at t = 5ms

  11. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First core busy until t = 10msSecond core busy until t = 25ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  12. P0 releases core at t = 10ms C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk Second core busy until t = 25ms P0 waits until t = 10010ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  13. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk Second core busy until t = 25ms P0 waits until t = 10010ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  14. P1 releases core at t = 25ms C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk P0 waits until t = 10010msDisk busy until t = 25 + 10 = 35 ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  15. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First process waits until t = 10010 msDisk busy until t = 25 + 10 = 35 ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  16. P1 releases disk at t = 35ms C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First process waits until t = 10010 msFirst core busy until t = 35 + 40 = 75 ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  17. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First process waits until t = 10010 msFirst core busy until t = 35 + 40 = 75 ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  18. P1 terminates at t = 75 ms C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First process waits until t = 10010 ms

  19. Your program will display • Process 1 terminatesTime = 75msClass = REAL-TIME or • REAL-TIME process 1 terminates at t = 75ms

  20. P1 terminates at t = 75 ms C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First process waits until t = 10010 ms

  21. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First process waits until t = 10010 ms

  22. P0 returns from TTY wait C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First core busy untilt = 10010 + 30 = 10040 ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  23. What happens next? C C C C C C C C D Q D Q IQ RQ IQ RQ TTYs TTYs Disk Disk First core busy untilt = 10010 + 30 = 10040 ms INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  24. P0 terminates at t =10040 ms C C C C C C C C D Q D Q RQ IQ IQ RQ TTYs TTYs Disk Disk INTERACTIVE 0RUN 10TTY 10000RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  25. Your program will display (I) • Process 0 terminatesTime = 10040msClass = INTERACTIVE or • INTERACTIVE process 0 terminates at t = 10040ms

  26. Your program will display (II) • SUMMARY:Number of RT processes that completed: 1Percentage of RT processes that missed their deadline: 0%Number of interactive process that completed: 1Total number of disk accesses: 1Average disk access time: 10msTotal elapsed time: 10040msCPU utilization: 0.01Disk utilization: 0.001

  27. How to compute CPU utilization • Keep track of total time for all RUN requests: • 10 + 30 + 20 + 40 =100ms • Divide by elapsed time: • 100/10040 = 0.01 (rounded) • Since there are four cores, maximum utilization is 4.0

  28. How to compute disk utilization • Keep track of total time for all DISK requests: • 10ms • Divide by elapsed time: • 10/10040 = 0.001 (rounded) • Disk utilization is generally computed for each individual disk, so it will never exceed 1.0

  29. INTRODUCING CONTENTION

  30. Start: P0 arrives at t = 0 ms C C C C D Q RQ IQ TTYs Disk REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First core busy until t = 20 ms

  31. What happens next? C C C C D Q RQ IQ TTYs Disk REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First core busy until t = 20 ms

  32. P1 arrives at time t = 5ms C C C C D Q RQ IQ TTYs Disk First core busy until t = 20 msSecond core busy until t = 25 ms REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  33. What happens next? C C C C D Q RQ IQ TTYs Disk First core busy until t = 20 msSecond core busy until t = 25 ms REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  34. P0 releases core at t = 20ms C C C C D Q RQ IQ TTYs Disk Second core busy until t = 25 ms Disk busy until t = 20 + 10 = 30ms REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  35. What is next? C C C C D Q RQ IQ TTYs Disk Second core busy until t = 25 ms Disk busy until t = 20 + 10 = 30ms REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  36. P1 releases core at t = 25ms C C C C D Q RQ IQ TTYs Disk Disk busy until t = 20 + 10 = 30ms P1 waits for disk REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  37. What is next? C C C C D Q RQ IQ TTYs Disk Disk busy until t = 20 + 10 = 30ms P1 waits for disk REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  38. P0 releases disk at t = 30 ms C C C C D Q RQ IQ TTYs Disk REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First core busy until t = 30 + 30 = 60ms Disk busy until t = 30 + 10 =40ms

  39. What is next? C C C C D Q RQ IQ TTYs Disk REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END First core busy until t = 30 + 30 = 60ms Disk busy until t = 30 + 10 = 40ms

  40. P1 releases disk at t = 40ms C C C C D Q RQ IQ TTYs Disk First core busy until t = 30+30 = 60ms Second core busy until t = 40+40 = 80ms REAL-TIME 0DEADLINE 80RUN 20DISK 10RUN 30ENDREAL-TIME 5DEADLINE 100RUN 20DISK 10RUN 40END

  41. To be continued • …

  42. Disk average access time • Not as simple to compute as before when there is disk contention • Must compute difference between • Disk request time • Disk request completion time for each disk request

  43. In our example • First disk request • Completed at t = 30ms • Duration is 10 ms • Initialized at t = 20ms • Second disk request • Initialized at t = 25ms • Completed at t = 40ms • Duration is 15 ms

  44. The best way to implement it • Have two counters both initialized at zero • diskcount • disktimes • When a disk request is issued by a process • Add 1 to diskcount • Subtract current time from disktimes • When a disk request is issued by a process • Add current time to disktimes

  45. In our example • diskcount = 1 + 1 = 2 • disktimes = – 20 – 25 + 30 + 40 = 70 – 45 = 25 • The average disk access time is 25/2 = 12.5 ms

  46. ENGINEERING THE SIMULATION

  47. Simulating time • Absolutely nothing happens to our model between two successive "events" • Events are • Arrival of a new process • Start of a computing step • Completion of a computing step • We associate an event routine with each event

  48. Arrival event routine • Process first request of process • It will always be a CPU request

  49. CPU request routine • current time is clockrequest time is crt • if a core is free : mark core busy until clock + crt else : enter process in appropriate CPU queue

  50. CPU request completion routine (I) • if both CPU queues are empty : mark core idleelif real-time queue is empty : pick first process P' in interactive queue crt' is request time for P' mark core busy until clock + crt' proceed with next request

More Related