Purposes of an Operating System (OS)

Computer Science A2 · System Software. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science A2 topics

The idea

The operating system shares the processor, memory and devices so that none is left idle, and it hides the hardware behind a user interface: the user clicks Save and the OS finds the disk blocks.

A process is a program being executed. With multi-tasking, several processes seem to run at once because the processor is switched between them quickly. Each process is running, ready (waiting for the processor) or blocked (waiting for input or output). A scheduling routine chooses which ready process runs next; the kernel does the switch when an interrupt arrives.

Virtual memory uses part of the disk as extra memory, so programs larger than the free RAM can run.

In simpler words

The operating system shares the processor, memory and devices between programs. A running program is called a process. Each process is running, ready or blocked. Ready means it could run now. Blocked means it is waiting, for example for input. The scheduler picks the next ready process. Virtual memory uses part of the disk as extra memory, so bigger programs can run.

An everyday comparison

Scheduling is like one teacher helping a class. The pupil being helped is running. Pupils with hands up are ready. A pupil who has gone to fetch a book is blocked: even if the teacher is free, they cannot be helped until they return. The comparison stops working because the scheduler follows a set rule, such as round robin, not who looks most in need.

Rules to remember

Common mistake

Students confuse ready and blocked. A ready process could run now and is only waiting for the processor; a blocked process cannot run even if the processor is free, because it is waiting for an event such as input.

In the exam

Use the three state names and give the cause of each change, for example running to ready when the time slice ends. State that blocked to running is not possible. Name the scheduling routine and describe it with one benefit and one drawback, such as round robin being fair with a good response time. For memory, define paging with pages, page frames and the page table. Explain a page fault and what disk thrashing means, using the exact terms from the syllabus.

Worked example

Processes P1, P2 and P3 need 5, 3 and 1 units of processor time. All arrive at time 0 in that order. Round robin is used with a time slice of 2 units. At what time does each process finish?

  1. P1 runs 0 to 2 (3 left), P2 runs 2 to 4 (1 left), P3 runs 4 to 5 and finishes.
  2. P1 runs 5 to 7 (1 left), P2 runs 7 to 8 and finishes.
  3. P1 runs 8 to 9 and finishes. Check: 5 + 3 + 1 = 9 units in total.

Answer: P3 finishes at time 5, P2 at time 8 and P1 at time 9.

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← Boolean Algebra and Logic CircuitsTranslation Software →Take a Computer Science A2 test