IAE Academy

Processes & threads formulas

Processes, threads and system calls. 4 formulas for GATE CS Operating Systems, each with when to use it. Each is explained in the topic notes.

All 4 Processes & threads formulas

TOTAL PROCESSES

F is the number of fork() calls that actually execute, summed over all processes; assumes every fork succeeds.

N UNCONDITIONAL FORKS IN A ROW

n fork() calls one after another with no condition and no exit; the same holds for a loop that runs n times with a fork in it and no break. New (child) processes created = 2^n - 1.

LINES PRINTED BY A PRINTF AFTER A FORK INSIDE AN N-ITERATION LOOP

For a loop body of fork(); followed by printf("...\n"); with every process continuing the loop and each printf appearing once per process that executes it: iteration k (counting from 1) is executed by 2^k processes.

CPU EFFICIENCY WITH CONTEXT-SWITCH OVERHEAD

q is the length of the useful time slice before each switch and s is the context-switch time, in the same unit; assumes every slice is used in full. If each process instead runs only for T < q before blocking, use T in place of q.

Where this was asked: 2020 (1), 2023 (2), 2024 (4), 2025 (1), 2026 (1). See the 9 previous-year questions on Processes & threads. This shows what was asked, not what will be asked.