Operating Systems · Cambridge syllabus 4.1 · Lesson 1 of 3
Operating System Functions
An operating system manages resources and provides services to applications and users. It schedules processing, manages memory and files, controls peripherals through drivers, supports interfaces and enforces access controls. Interrupts allow the CPU to respond to events.
By the end, you can
- Understand the purpose of an operating system.
- Explain how an operating system provides a user interface.
- Explain how an operating system manages memory.
- Understand the allocation of memory to programs.
- Explain why memory management is necessary.
- Explain how an operating system manages input and output devices.
- Understand the role of device drivers.
- Explain how an operating system manages files and folders.
- Understand file naming, organisation and access.
- Explain how an operating system can control access to resources.
- Understand how an operating system manages user accounts, with usernames, passwords and permissions.
- Explain how an operating system handles interrupts.
- Explain how an operating system manages multitasking.
- Explain how an operating system provides a platform for running applications.
User interface
An operating system is the software that manages the hardware and provides the environment every other program runs in. Without one, each application would have to drive the disk, the screen and the keyboard itself, and only one program could run at a time.
It sits between the user and the hardware, and between an application and the hardware. An application that wants to save a file asks the operating system, which knows where the file system is and how the drive works; the application never touches the drive directly.
Providing an interface is the part people see. The operating system gives the user a way to communicate with the computer: to start programs, open files and change settings, usually by pointing at windows, icons and menus on the screen, or by typing commands. It also passes what the user does to the program that needs it, and shows that program’s output.
The syllabus lists the functions an operating system carries out: managing files, handling interrupts, providing an interface, managing peripherals and drivers, managing memory, managing multitasking, providing a platform for running applications, providing system security and managing user accounts. The sections of this lesson take them in turn.
Worth remembering
- The operating system manages hardware and provides an environment for programs.
- It provides an interface so the user can communicate with the computer.
- Nine functions: files, interrupts, interface, peripherals, memory, multitasking, platform, security, user accounts.
Memory management
Several programs are in memory at once, and none of them may read or overwrite another. Memory management is the operating system deciding which part of RAM each program gets, keeping a record of it, and releasing it again when the program closes.
When a program starts, the operating system finds a free area large enough, allocates it, and loads the program in. It keeps a table of which areas are in use by which process, so it can reclaim the space afterwards and reuse it.
It also keeps programs apart. A process is allowed to access only the memory allocated to it, and an attempt to read outside that is refused. This is what stops one badly written program from corrupting another or reading its data, and it is a security measure as much as a housekeeping one.
When RAM runs out, the operating system uses virtual memory: parts of memory that have not been used recently are written out to a file on disk, freeing the RAM, and read back when they are needed again. This lets more programs run than would otherwise fit, but disk is far slower than memory, so a machine relying heavily on it becomes very slow.
Memory management is necessary because RAM is a limited shared resource that several programs need at once. Without it they would overwrite each other, and nothing would be reclaimed when a program ended.
Worth remembering
- Allocates memory to each program, tracks it, and frees it when the program ends.
- Keeps processes apart so one cannot read or overwrite another.
- Virtual memory swaps inactive pages to disk when RAM is full, at a cost in speed.
Peripheral management
Peripheral management is the operating system controlling the input and output devices attached to the computer, so that applications do not have to know anything about them.
It works through device drivers. A driver is a piece of software for one particular device that translates general operating-system requests into the specific signals that device understands. A program says print this document; the driver for that exact printer model turns it into the commands that printer needs. Plugging in a new device means installing its driver, and a device with no driver will not work however well it is wired in.
The operating system also decides which program may use a device at a given moment, so that two programs sending to the same printer do not mix their pages together.
The benefit is that an application is written once against the operating system rather than once for every model of printer in existence, and new hardware can be supported by adding a driver rather than rewriting programs.
Worth remembering
- Device drivers translate general requests into the signals one specific device needs.
- A device with no driver will not work, however well it is connected.
- The OS decides which program uses a device at a given moment.
File management
Secondary storage is a huge undivided space, and file management is the operating system imposing an order on it that both programs and people can use.
It provides the hierarchy of folders and files, and the naming rules: a file has a name and usually an extension that says what kind of data it holds, and a path through the folders that identifies it uniquely. It creates, opens, renames, moves, copies and deletes files on request.
Underneath, it tracks where each file physically is. A file is rarely stored in one continuous run of blocks, so the operating system keeps a record of which blocks belong to which file and in what order, and reassembles it on reading. It also knows which blocks are free, so new data can be written without overwriting anything.
It maintains metadata for each file — size, the date created and last modified, the type, and the access permissions — and enforces those permissions, so a user without read access simply cannot open the file.
Without file management a program would have to know the physical location of its data on the disk, and two programs could easily write to the same place.
Worth remembering
- Provides folders, file names, paths, and the operations on them.
- Tracks which physical blocks hold each file and which blocks are free.
- Stores metadata and enforces access permissions.
Security management
Security management is the operating system deciding who may use the machine and what each user is allowed to do once they are in.
It starts with authentication. Each user has an account with a username that identifies them and a password that proves they are who they claim to be; the system checks the password against a stored value — held as a hash rather than as the password itself — and refuses access if it does not match. Biometrics and two-step verification are stronger versions of the same step.
Then comes authorisation, which is a separate question. Each file and resource carries permissions saying which users may read it, write to it or run it, and the operating system checks them on every access. An ordinary account cannot install software or change system settings; an administrator account can, which is why day-to-day work should not be done in one.
It also keeps logs of who logged in, when, and what they changed, so that misuse can be traced afterwards, and it applies security updates that close known weaknesses.
The point to be clear about is that authentication and authorisation are different things: one establishes who you are, the other what that person is permitted to do. A system needs both.
Worth remembering
- Authentication establishes identity; authorisation decides what that identity may do.
- Permissions on files and resources are checked on every access.
- Logs record who did what, so misuse can be traced.
Interrupts, multitasking and applications
Handling interrupts is another function. An interrupt is a signal that something needs attention now, such as a key being pressed or a program trying to divide by zero. The operating system makes sure each interrupt is dealt with by the right routine and that the work that was interrupted can carry on afterwards. The Interrupts lesson in this topic explains how.
Managing multitasking lets several programs appear to run at the same time. A processor core can only carry out one instruction at a time, so the operating system gives each program a short turn on the processor and switches between them many times a second. It decides which program runs next and for how long, so that music can keep playing while a document is typed and a file downloads.
Providing a platform for running applications means that an application does not need to know how to control the hardware itself. It asks the operating system to open a file, draw a window or send data to the network, and the operating system does the work. That is why an application is written for an operating system, and why the same application can run on many different computers that have that operating system.
Worth remembering
- Handling interrupts: making sure each signal that needs attention is dealt with.
- Multitasking: switching the processor between programs so they appear to run together.
- A platform for applications: programs ask the OS instead of controlling the hardware.
Worked example
A print request is coordinated through the OS and printer driver while other applications can continue running.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
The OS allocates and tracks memory so programs can use it without improperly interfering with one another.
Check your method, units and explanation against it.
Marked practice
Set 1 of 5 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.