How can we compute how many processes should be in memory at a time to make CPU utilization max?

From the given formula, we can compute the CPU utilization:

CPU Utilization = 1 - P^n

Where p is the probability of I/O and n is the total number of processes.

E.g, If we were to find CPU utilization if the computer has enough room to hold four programs in its main memory. These programs are idle waiting for I/O half of the time. that would be:

CPU Utilization % = 1 - (.5)^4 = .93

But If CPU utilization was given e.g. 0.93 and probability of I/O e.g. 0.5 then how can I find n?

This is what I tried:

Log(CPU Utilization) = Log(1) - nLog(.5)

• Log(.93) / Log(.5) = n

But that gives me about

-0.10470

which is nowhere close to 4.

What am I missing?

1 Answer

Let $$U$$ indicate the CPU utilization in percent. What you have calculated is: $$\log(U) = \log(1 - P^n) \stackrel{!}= \log(1) - \log(P^n) = \log(1) - n \log(P)$$

However, the equality marked with an exclamation mark is incorrect since $$\log(a - b)$$ is, in general, not equal to $$\log(a) - \log(b)$$.

The correct line of reasoning is restating the original equality as $$P^n = 1 - U$$ and then: $$n \log(P) = \log(P^n) = \log(1 - U)$$ Thus: $$n = \frac{\log(1 - U)}{\log(P)}$$

(Of course, this all assuming $$P > 0$$ and $$U < 1$$; otherwise, there is no (unique) solution.)

Tip: when reformulating mathematical expressions, always do it one step at a time, and question every single step! Else you are bound to make mistakes. (Source: personal experience)