Operating System, Application and Utility Software
Senior 3 · ICT
Operating System, Application and Utility Software
Lesson 2 of 5
25 min
Open Task Manager on a school laptop that is only showing a browser and a word processor, and you will usually count well over a hundred running processes. The laptop may have only four processor cores and a few gigabytes of memory. Something must decide which program uses the processor next, where in memory each one lives, and who gets the printer when two people press Print at once. That is the operating system's daily work. This lesson takes its four main jobs in turn: managing the processor, the memory, the input and output devices, and the applications.
Definition
Process: a program that is running. It is the program's instructions loaded into memory together with its current data and state. Example: each open browser tab may be a separate process.
Scheduler: the part of the OS that decides which ready process uses the processor next, and for how long.
Time slice (or quantum): the short, fixed period, often a few milliseconds, for which a process may use the processor before the next one gets a turn.
Interrupt: a signal to the processor that an event needs attention now, such as a key press, a finished disk read or the end of a time slice. The OS pauses the current work and runs a small routine to handle it.
A processor core carries out one process at a time, so the OS shares it out. Every process moves between a few states:
Figure 1. Process states. A ready process is given the CPU; when its time slice ends it goes back to the queue. If it has to wait for a device, such as the disk or the keyboard, it waits without using the CPU, and another process runs.
One simple scheduling method is round robin: the ready processes stand in a queue, each gets one time slice, and any process that is not finished goes to the back of the queue.
Worked example 1: round-robin scheduling
Three processes arrive together in the order A, B, C. A needs 30 ms of processor time, B needs 10 ms and C needs 20 ms. The time slice is 10 ms. When does each finish?
Figure 2. The timeline. The total is ms, and the short job B finishes first even though it arrived second.
Every running process needs a share of main memory (RAM). The OS:
Definition
Virtual memory: part of the storage drive that the OS uses as if it were extra RAM. Blocks of memory called pages that are not being used right now are moved out to a file on the drive (the page file or swap) and brought back when needed. Example: a laptop with 4 GB of RAM can still open programs that need 5 GB, but it slows down.
Thrashing: the state in which the OS spends more time moving pages between RAM and the drive than running programs, so the computer almost freezes.
Worked example 2: will it fit in RAM?
Mugisha's laptop has 4 GB of RAM. Windows uses 1.5 GB, a browser with many tabs 1.8 GB, a word processor 0.4 GB and a photo editor 1.2 GB.
About 0.9 GB must be held in virtual memory on the drive. Reading from a drive is far slower than reading RAM, so the laptop becomes slow each time it switches between programs. Fixes: close the browser tabs and programs he is not using, or add more RAM.
Definition
Device driver: a program that lets the operating system control one particular hardware device. Example: the driver for an HP or Canon printer model.
Buffer: an area of memory that holds data for a short time while it moves between two devices or programs that work at different speeds.
Spooling: placing jobs for a slow device, usually a printer, in a queue on the drive so the device can take them one at a time while the computer does other work.
The OS loads each program from the drive into memory and starts it, closes it when you exit, and stops it if it stops responding (End task). It also gives every application the same ready-made services through an application programming interface (API): the Save dialog, the Print dialog, copying and pasting, and access to the network all come from the OS, which is why they look alike in different programs. Finally, it controls permissions: Windows and Android ask you before a new app may use the camera, the microphone or your location.
The OS also manages files (folders, names and the file system on each drive, which you used in S1), security (user accounts, passwords and privileges, from S2) and the user interface (Lesson 1).
CrashCourse: Operating Systems, Crash Course Computer Science #18 (about 13 minutes). Watch for batch processing, device drivers, multitasking, virtual memory and memory protection, and match each one to a function in this lesson.
Tip
Memory hook: "PMDA". The OS is the school's head teacher: it timetables the Processor (who teaches when), allocates Memory (who sits in which classroom), manages Devices (who borrows the projector) and supervises the Applications (who may enter). In an exam, give each function with one concrete example.
Warning
Do not end processes you do not recognise. In Task Manager, use End task only on an application you opened yourself that has stopped responding. Ending a system process can freeze Windows or lose unsaved work.
Practice
Sources and credits
This lesson adapts CC BY-SA material and is shared under CC BY-SA 4.0.