Im not sure calculate the percentage of CPU utilization for cpu scheduling algorithms. I got the formula which is
total service time of the processes / total service time + idle time. Im stuck on how exactly to calculate the idle time? Thanks for any help
Time is time, whether real or simulated.
if 10 seconds (real actual seconds, or simulated) passed, and 3 seconds of that was used to process stuffs, 7 seconds were idle.
Also percents are percents.
if you spent 30% of your time doing something, then you spent 70% of your time not doing that.
A real CPU has some internal fubars that eat a small % of the time, such as context switching, so the two times are probably not exactly 100% of a real CPU. A modeled simplified CPU may be exact.
i get what you mean but would you mind showing an example on how to calculate cpu utilization using round robin scheduling algorithm? that would be really helpful
process 1 is loaded and gets say 100 ms of processing time. In that time it sleeps for 10ms waiting on something. 90 ms is used, 10 is not.
process 2 is loaded and gets 100 ms, and uses 100 ms
process 3 is loaded and gets 100 ms, but finishes after 20 (80 idle)
process 1 is loaded again and gets 100 ms and uses it all.
400 ms elapsed, 90 was not used.
310/400 is 77.5% used. 1- .775 is 22.5% idle.
two things that catch me off guard here
1. How can you know how long process 1 sleeps or u just made that up? If you did make it up, how would we find how much time a process sleeps(idle)?
2. process 3 finishes fast because the burst time of it is <= time quantum (100ms)?
Assuming i still dont get it ( almost there ..) Use this example. Hopefull, this will clear up my confusion. Thanks
Time quantum of 1
Process 1 arrives at time 0 with a burst time of 3
Process 2 arrives at time 3 with a burst time of 5
Process 3 arrives at time 4 with a burst time of 7
its made up. I have no idea what you are actually doing. You need OS level libraries to watch a process on a real computer's CPU. I don't know which ones; its not something I ever needed to do, but maybe the opensource version of Linux's top would be a place to look.
2) its made up. A process can finish really fast on a modern pc, consider something like the make directory command at the console, its done before your finger leaves the enter key. Again, I assumed fixed time slices, which isn't necessary but I needed something to show you a % that wasn't 100, right?
assuming burst time is cpu time...
process 1 enters and exits clean.
process 2 enters and runs clean for 1 time slice.
process 3 enters and runs for 1 time slice
process 2 runs another slice
process 3 runs another slice
... until 2 finishes and then 3 burns out its last couple