Premium Chapter

Processes, threads & scheduling

Computer Science & Applications (Paper 2) (Code 87) · Unit 5 · ~17 min read · Original chapter

Free previewPremium full chapter

Free preview

A process is a program in execution: code plus its own memory, open files and a program counter. A thread is a lighter unit inside a process, sharing the process's memory and files but with its own stack and registers — which is why creating a thread is far cheaper than creating a process. Worked example — FCFS scheduling: processes P1 (arrives 0, burst 8), P2 (1, 4), P3 (2, 9), P4 (3, 5) run in arrival order and finish at 8, 12, 21 and 26. Waiting times are 0, 7, 10 and 18, so the average waiting time is (0 + 7 + 10 + 18) / 4 = 8.75. The same four jobs under shortest-job-first finish faster on average — scheduling is the art of choosing the order, and the order changes everything.

Checking premium access…