Menu

Memory Management and Multitasking

Memory Allocation and Protection

RAM is limited, so the operating system has to share it carefully between all the programs that are open. Memory management is the operating system function that decides where each program and its data are placed in RAM: it allocates an area to a program that needs one, and frees that area when the program closes.

The operating system keeps a record of memory: which areas are in use, which program owns each area, and which areas are free. For example, on a laptop with a video call app open, the operating system itself sits in one area of RAM, the video call app sits in another, and a third area is still unclaimed.

Memory areaUsed byStatus
Area 1Operating systemIn use
Area 2Video call appIn use
Area 3NoneFree

Memory protection means each program's area is kept separate from every other program's. The operating system stops one program from writing into another program's memory area, so a program cannot overwrite another program's data, or read it and change it. If a program crashes, the operating system can stop it without damaging other programs, because their memory areas are separate.

When a program closes, the memory it was using is freed, and that area can then be allocated to another program. Holding each program in its own protected area is what makes multitasking work safely: several applications sit in RAM at the same time, each in its own space, and none can interfere with another.

Practise this

OCR GCSE Computer Science · Memory Management and Multitasking