SME
Operating Systems · Problem type
CPU use with I/O waits
Use this for “Each process waits for I/O 80% of the time. With 4 processes in memory, how busy is the CPU?”
This is an example. Type your own values to start a new problem.
I
%
=
100
×
p
U
%
=
100
−
I
%
Formulas
I
=
100
×
p
n
40.96
=
100
×
0.8
4
U
=
100
−
I
59.04 = 100 − 40.96
Assumptions
•
Each process waits for I/O the same share of its time, p, and the processes wait independently.
•
The CPU idles only when all n processes wait at once, which happens a share pⁿ of the time.
•
All n processes fit in memory, and switching between them costs no time.
Step-by-step
WE KNOW
p = 0.8, n = 4
FIND
CPU idle share (I), CPU use (U)
Step 1 · Find CPU idle share (I)
Use I = 100 × pⁿ
The
CPU
idles
only
when
all
n
wait
at
once;
independent
waits
multiply,
and
×
100
gives
a
percent.
I
=
100
×
0.8
4
I
=
100
×
0.4096
I
=
40.96%
Step 2 · Find CPU use (U)
Use U = 100 − I
Whenever the CPU is not idle, some process is ready to run, so the CPU is busy.
U
=
100
−
40.96
U
=
59.04%
Check
Put the numbers back in. Both sides should match.
40.96
=
100
×
0.8
4
✓
59.04 = 100 − 40.96 ✓
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.
Related lessons
Processes and threads
Main lesson
Cost of a context switch
Use this for “The time slice is 10 ms and a context switch takes 0.1 ms. What share of the CPU time does useful work?”
Processes after n forks
Use this for “A program calls fork() 3 times in a row. How many processes are there at the end, and how many are children?”