1. Gyanastra
  2. Operating Systems
  3. Contiguous Memory Allocation
  4. CPU Utilization and Degree of Multiprogramming
Free lesson, no account needed 7 min read 3 practice questions after it
Asked in past papers4 times
  • ISRO2011
  • UGC NET201420092008

Operating Systems · Contiguous Memory Allocation

CPU Utilization and Degree of Multiprogramming

Overview

CPU utilization measures how much of the time the CPU is actually running programs rather than sitting idle waiting for I/O. It depends directly on the degree of multiprogramming — the number of processes held in main memory — so memory management aims to keep as many processes in memory as possible.

Key concepts

  • CPU utilization: the fraction of time the CPU is busy running programs. If a process spends fraction pp of its time waiting for or doing I/O, it uses the CPU for the remaining 1−p1 - p fraction.
  • Degree of multiprogramming (nn): the number of processes that can be present in main memory at any one time.
  • Direct relationship: CPU utilization rises with the number of processes in main memory, because when one process waits for I/O the CPU can run another.
  • Idle condition: with nn processes, the CPU is idle only when all nn processes are doing I/O simultaneously; the probability of this is pnp^n.
  • Practical goal of memory management: with finite memory, use memory-management techniques to keep as many processes as possible in main memory, making finite memory behave as if it can hold many processes (mimicking infinite memory) to raise CPU utilization.
  • New issues with multiple processes in memory: how much memory each process gets, how memory is allocated, how it is deallocated, and how protection among processes is provided.
    The memory manager handles allocation, deallocation, and security/protection.

How it works

  1. A single process in memory uses the CPU for 1−p1 - p of the time and waits for I/O for pp of the time, so CPU utilization is 1−p1 - p.
  2. Adding main memory lets more processes reside in memory at once; the count is memory size divided by process size.
  3. With nn processes, the CPU is idle only when all nn wait for I/O at the same time, which happens with probability pnp^n; hence CPU utilization is 1−pn1 - p^n.
  4. As nn grows, pnp^n shrinks, so utilization rises — but each equal addition of memory yields a smaller gain.
  5. In the limit of infinitely many processes, utilization approaches 100%, but infinite memory is impractical because it is very costly.

Formulas

  • CPU utilization=1−pCPU\ utilization = 1 - p (one process in memory)

  • CPU utilization=1−pnCPU\ utilization = 1 - p^n (nn processes in memory)

  • pp = fraction of time a process waits for/does I/O, with 0<p<10 < p < 1

  • nn = degree of multiprogramming = number of processes present in main memory at the same time

  • pnp^n = probability/fraction of time all nn processes wait for I/O simultaneously, so the CPU is idle

  • 1−pn1 - p^n = fraction of time at least one process is able to use the CPU

  • Limiting case: as n→∞n \to \infty, pn→0p^n \to 0, so CPU utilization→1=100%CPU\ utilization \to 1 = 100\%.

Worked examples

Assumptions: process size = 4 MB; operating-system overhead is ignored, so the stated main memory is fully available for user processes; p=0.8p = 0.8.

Main memoryProcesses nn = memory / 4 MBpnp^nCPU utilization = 1−pn1 - p^nApproximate value
4 MB10.80.220%
16 MB40.84=0.40960.8^4 = 0.40960.5904about 60%
32 MB80.88=0.16780.8^8 = 0.16780.8322about 83%
48 MB120.812=0.06870.8^{12} = 0.06870.9313about 93%

Step-by-step:

  1. 4 MB memory: n=4/4=1n = 4/4 = 1; utilization =1−0.8=0.2=20%= 1 - 0.8 = 0.2 = 20\%. The CPU is idle 80% of the time because the only process is usually waiting for I/O.
  2. 16 MB memory: n=16/4=4n = 16/4 = 4; probability all 4 wait for I/O =0.84=0.4096= 0.8^4 = 0.4096; utilization =1−0.4096=0.5904≈60%= 1 - 0.4096 = 0.5904 \approx 60\%. Gain from the one-process case: about 20% to about 60%, roughly +40 percentage points.
  3. 32 MB memory: n=32/4=8n = 32/4 = 8; 0.88=0.16780.8^8 = 0.1678; utilization =1−0.1678=0.8322≈83%= 1 - 0.1678 = 0.8322 \approx 83\%. Gain from 16 MB to 32 MB: roughly +23 percentage points.
  4. 48 MB memory: n=48/4=12n = 48/4 = 12; 0.812=0.06870.8^{12} = 0.0687; utilization =1−0.0687=0.9313≈93%= 1 - 0.0687 = 0.9313 \approx 93\%. Gain from 32 MB to 48 MB: roughly +10 percentage points.
  5. Limiting case: for 0<p<10 < p < 1, as n→∞n \to \infty, pn→0p^n \to 0, so utilization →1=100%\to 1 = 100\%.

Comparison

Gain in CPU utilization is not linear with memory size (same memory added each time, p=0.8p = 0.8):

Memory stepUtilization changeGain
4 MB → 16 MBabout 20% → about 60%about +40 percentage points
16 MB → 32 MBabout 60% → about 83%about +23 percentage points
32 MB → 48 MBabout 83% → about 93%about +10 percentage points

Revision summary

  • With one process, utilization is 1−p1 - p; with nn processes, it is 1−pn1 - p^n.
  • pnp^n is the fraction of time all nn processes wait for I/O simultaneously — then the CPU is idle.
  • More memory means a higher degree of multiprogramming, which means higher CPU utilization.
  • The improvement is not linear: equal memory additions give smaller and smaller gains.
  • 100% utilization needs infinitely many processes in memory, which is impractical because infinite memory is very costly.
  • The model assumes the OS is not counted in memory and that process size is fixed (4 MB in the examples).
  • With multiple processes, the memory manager must also decide how much memory each process gets and provide protection among processes, not just allocation and deallocation.

Previous-year exam insights

  • CPU utilization can also be computed from the arrival rate and service time: if processes arrive at rate λ (per unit time) and each needs an average service time S, then utilization U = λ × S as a fraction (multiply by 100 for %).
    If λS ≥ 1 the single CPU is saturated and utilization is taken as 100%; make the units of λ and S consistent (e.g., convert processes per minute to processes per second).
    Asked inUGC NET 2014ISRO 2011
  • To find how many processes must be resident to reach a target utilization U, solve 1−pn≥U,i.e.n≥ln⁡(1−U)/ln⁡(p)1 - p^{n} \ge U, i.e. n \ge \ln(1 - U)/\ln(p) (take the ceiling); the required n grows rapidly as U approaches 1 because gains diminish.
  • The degree of multiprogramming is the number of processes resident in main memory, not the total number of processes in the system (processes swapped out or waiting on disk do not count).
    If the OS occupies part of memory, n = floor((main memory − OS resident size)/process size);
    for processes of unequal size, memory is packed until no further process fits.
  • The relation utilization = 1−pn1 - p^{n} assumes that the n processes' I/O waits are independent (so the probability all are waiting is exactly pnp^{n}) and that memory is the only constraint.
    If the I/O waits are correlated or synchronized the actual utilization is lower than 1−pn1 - p^{n}, and as p → 1 the utilization tends to 0 for any finite n.
  • The monotonic rise of CPU utilization with n holds only while the system is not thrashing: with demand paging/virtual memory, increasing the degree of multiprogramming beyond a point raises the page-fault rate, so utilization drops instead of approaching 1 — 1−pn1 - p^{n} is an idealised model ignoring paging overhead.
  • CPU utilization and CPU idle time are complements: with n processes, idle time fraction = pnp^{n} (all waiting for I/O) and busy time fraction = 1−pn1 - p^{n};
    for one process these reduce to p and 1 - p, and neither pnp^{n} nor (1−p)n(1 - p)^{n} is the utilization of an n-process system.
    Asked inUGC NET 2008
Pages 1–2 of 2