• Practice
  • About 13 min
  • 5 practice questions

Numerical OS questions: time slices, pages, frames and waiting time

Solve the four numerical question types that appear in operating system papers using a short fixed method for each.

If something looks wrong, please tell us.

Most operating system questions are definitions, but a few are small calculations. They look unfamiliar, yet each one follows a fixed method that takes under a minute. All the numbers here are illustrative practice values.

Type 1: the length of a round (time slices)

Method: round length = number of users or processes x time slice. The wait between two turns of one process = (number of processes - 1) x time slice.

Type 2: pages needed

Method: pages = program size / page size, rounded up. Unused space in the last page = pages x page size - program size. That wasted space is internal fragmentation.

Type 3: frames in RAM

Method: frames = RAM size / frame size. A frame holds one page, so a program of n pages needs n free frames if it is to be fully loaded.

Type 4: waiting and turnaround time (FCFS)

Method: list the processes in arrival order. A process's waiting time = the total burst time of those before it (when all arrive at time 0). Turnaround time = waiting time + its own burst time. Average = total / number of processes.

Four methods at a glance
TypeFormulaWatch out for
Round lengthusers x sliceUnits (ms or seconds)
Pagessize / page size, round upRounding down loses the last part
FramesRAM / frame sizeSame units for both numbers
Waiting timesum of earlier burstsOrder of arrival decides it

Worked example 1: round length

Twelve users share a time-sharing system with a time slice of 40 ms. One full round = 12 x 40 = 480 ms. A user waits between turns = (12 - 1) x 40 = 11 x 40 = 440 ms.

Worked example 2: pages and waste

A program of 50 KB is loaded with 8 KB pages. 50 / 8 = 6.25, so 7 pages are needed. Space allocated = 7 x 8 = 56 KB. Wasted in the last page = 56 - 50 = 6 KB. A common mistake is to answer 6 pages.

Worked example 3: frames

RAM is 256 KB and each frame is 16 KB. Frames = 256 / 16 = 16. If the program above needs 7 pages, there are 16 - 7 = 9 frames left for other programs.

Worked example 4: FCFS

Three processes P1, P2 and P3 arrive together with bursts 5, 4 and 2 ms in that order. Waiting times: P1 = 0, P2 = 5, P3 = 5 + 4 = 9. Average waiting = (0 + 5 + 9) / 3 = 14 / 3 = 4.67 ms. Turnaround times: P1 = 5, P2 = 5 + 4 = 9, P3 = 9 + 2 = 11. Average turnaround = (5 + 9 + 11) / 3 = 25 / 3 = 8.33 ms.

Round = users x slice. Pages = size / page, rounded up. Frames = RAM / frame. Waiting = bursts before it.

Common traps

  • Rounding a page count down instead of up.
  • Mixing KB and MB in one division.
  • Using (users x slice) for the wait between turns instead of (users - 1) x slice.
  • Counting the process's own burst in its waiting time.

Check your understanding

  1. 1. Ten processes share the CPU with a time slice of 30 ms each. How long is one full round?

    1. 300 ms
    2. 270 ms
    3. 30 ms
    4. 330 ms
    Show answer

    Answer: A. 10 x 30 = 300 ms.

  2. 2. A 30 KB program uses 4 KB pages. How many pages does it need?

    1. 7
    2. 6
    3. 9
    4. 8
    Show answer

    Answer: D. 30 / 4 = 7.5, rounded up to 8 pages.

  3. 3. RAM of 128 KB is divided into frames of 8 KB. How many frames are there?

    1. 8
    2. 16
    3. 32
    4. 12
    Show answer

    Answer: B. 128 / 8 = 16 frames.

  4. 4. Under FCFS, bursts 3, 6 and 1 arrive together in that order. What is the waiting time of the third process?

    1. 3 ms
    2. 6 ms
    3. 9 ms
    4. 10 ms
    Show answer

    Answer: C. It waits for 3 + 6 = 9 ms before it starts.

  5. 5. A program of 18 KB is loaded into 4 KB pages. How much space is wasted in its last page?

    1. 2 KB
    2. 3 KB
    3. 1 KB
    4. 4 KB
    Show answer

    Answer: A. 18 / 4 = 4.5, so 5 pages = 20 KB are allocated. Waste = 20 - 18 = 2 KB.

Privacy · Terms · Refunds · Delivery