Define the terms hardware and software and understand the relationship between them.
An operating system (or 'OS') controls the general operation of a computer, and provides an easy way for us to interact with computers and run applications.
On some computers it is possible to run a choice of operating systems. Games consoles have their own unique operating systems.
There are a few common operating systems available:
- Mac OS X
- Android (based on Linux)
Functions of the operating system
The operating system performs several key functions:
- interface - provides a user interface so it is easy to interact with the computer
- manages the CPU - runs applications and executes and cancels processes
- multi-tasks - allows multiple applications to run at the same time
- manages memory - transfers programs into and out of memory, allocates free space between programs, and keeps track of memory usage
- manages peripherals - opens, closes and writes to peripheral devices such as storageattached to the computer
- organises - creates a file system to organise files and directories
- security - provides security through user accounts and passwords
- utilities - provides tools for managing and organising hardware
The OS provides a user interface (UI), an environment for the user to interact with the machine. The UI is either graphical or text-based.
Graphical user interface (GUI)
The OS on most computers and smartphones provides an environment with tiles, icons and/or menus. This type of interface is called the graphical user interface (GUI) because the user interacts with images through a mouse, keyboard or touchscreen.
Command line interface (CLI)
An OS also provides a method of interaction that is non-graphical, called the command line interface (CLI). This is a text-only service with feedback from the OS appearing in text. Using a CLI requires knowledge of the commands available on a particular machine.
Advantages of using the command line include:
- a faster way to get tasks done
- it is more flexible than a GUI
- it uses less memory
Some games, such as Minecraft, also make use of a command line tool which allows the user to bypass the main interface and alter the game’s mechanics or environment.
In each case, the OS performs the same sequence of steps:
- the program code is found on the storage drive
- a section of RAM is reserved for the program and space is allocated for the program's data
- the program code is copied from storage into the reserved space in the memory
- the CPU program counter is set to the memory location of the first instruction in the program, and execution begins
The OS makes it possible to run several programs at once. Several programs can be stored in RAM at the same time, however only one program at a time is processed by the CPU. Programs can be in one of three states:
Only one process can be running at any one time. CPUs are extremely fast, so if a program is processed for even a short time it can do quite a lot. The OS decides the best way to swap between running, runnable and waiting processes. It controls which process is being executed by the CPU at any point in time, and shares access to the CPU between processes. The job of working out when to swap processes is known as scheduling.
Swapping happens so fast that it appears that all processes are running at the same time. When there are too many processes, or some of them are making the CPU work especially hard, it can look as though some or all of them have stopped.
- how memory is shared between processes
- what happens when there is not enough main memory to get the job done
Different processes running at the same time must not interfere with one another. This means they have to use different parts of the computer’s memory.
The OS handles the transfer of data between processes. This is done by setting aside areas in memory where data values can be shared.
The OS uses buffering to set aside memory for the temporary storage of data. A process may output data and leave it in the buffer. This means that processes can each get on with their jobs at their own rate. It is only when the buffer is full that processes will need to wait.
Buffers are also used when you stream online content.
Each peripheral is programmed with its own machine code. Each has its own rules that dictate how it transmits data values between the computer and the device. These rules make up a protocol for controlling and communicating with the device.
The protocol dictates the structure, speed and timing of the messages that are sent and received.
The OS uses programs called device drivers to manage connections with peripherals.
A device driver:
- handles the translation of requests between a device and the computer
- defines where a process must put outgoing data before it can be sent, and where incoming messages will be stored when they are received
- wakes up the device when it is needed and put it back to sleep when it is not
An OS will have generic device drivers to enable it to connect to most common peripherals. Some peripherals, however, will have their own drivers that need to be installed before use.
Peripherals that use the same protocol may be controlled by the same driver. If a number of identical game controllers are plugged in, each device will store its data in a different place so they do not interfere with each other.
In order to retrieve data from a file, the computer needs to know:
- which storage device it is held on
- where it is stored on the device
- how files are organised on the device
- how much data is in it
- the protocol needed to communicate with it
It is the job of the OS to maintain this information for other programs, and it does this by providing a file system. The purpose of a file system is to provide programs with a uniform way of storing and retrieving data.
The OS manages how data is organised into files. This makes it easier for the user to see files using programs like the Windows File Explorer or Mac OS X Finder. The OS organises where and how files are stored, deleted, read, found and repaired. It detects errors such as missing disks or incorrect file names, and informs the user that errors have occurred.
Each file has a unique name and the OS maintains a set of look-up tables that relate file names to locations on storage drives.
File systems work in a similar way to the way that libraries organise books. Folders and directories correspond to different sections of the library. Inside each folder can be other folders (sub-sections within a subject) and files (the books themselves). If you need to access a specific file you just need to know how to look for it in the index which describes where each file is located.
Most file systems are hierarchical and contain directories that contain lists of other files. Hierarchical file systems usually have a special directory at the root. It can be imagined to be similar to a tree - the branch points are directories that lead to other files. Data files are at the ends of branches and these include files containing program code.
File systems can become corrupt if a computer is turned off before a program is copied to a new location.
The OS uses applications called utilities which allow the user to manage the computer. There are many different utility programs and they may vary across operating systems. They are often accessed via a special menu or control panel in the OS.
- Backup - This allows the user to restore the system to a previous state which is saved as a backup. This is only usually used if a system malfunctions.
- Disk cleaner - The storage drive is divided into a number of clusters. The table of contents serves as an address book, keeping a record of each file and the clusters used to store that file. When a file is deleted, the address to the location on the disk is removed.
- Disk defragmentation - When files are deleted, unused clusters become available for reuse. These can end up being distributed across a drive, especially if the original files were small. If a large file is then written to a drive, its data could be spread across different clusters leading to file fragmentation. Defragmentation involves rearranging the information on a disk so that files appear in continuous sequences of clusters. This will improve file access times. Most modern operating systems run this process automatically.
- Formatting - Storage drives need to be formatted to be compatible with an OS. The OS usually formats storage media when it is connected to the computer. It is often the case that a storage drive cannot be compatible with both Windows and Mac OS X.
- user accounts - allow the user to allocate specific users and protects personal files and programs from unauthorised access.
- encryption - can encrypt data when it is stored, or whenever it is transmitted over a network.
- anti-virus software - detects and blocks viruses.
- firewall - can be used to filter between trusted and untrusted networks and prevent programs from communicating through the use of ports.
Here are a few links to web sites and intersting things that you really should read in your own time. There may be a sentence or two in one of these sites that might spark a difficult concept or resolve a confusing idea or may simply be a better explanation that suits you and eanables you to fully understand the points that the examiner is trying to make.
A history of early programming that explains compilers and assemblers in more detail.