# A-level Computing/AQA/Paper 2/Fundamentals of computer systems/Role of an operating system (OS)

The operating system acts as an interface between the hardware and the programs requesting I/O. It is the most fundamental of all system software programs.
Responsibilities of the OS include:
* Hiding the complexities of hardware from the user.
* Managing between the hardware's resources which include the processors, memory, data storage and I/O devices.
* Handling "interrupts" generated by the I/O controllers.
* Sharing of I/O between many programs using the CPU.
There are two types of software:
* System Software - programs that manage the operation of a computer.
* Application Software - programs that help the user perform a particular task.

## User Interfaces

The User Interface is the interaction between the User and the Machine, letting the user send commands with the expected results. Two forms of the Interface User are the Command Line Interface and the Graphical User interface.

### Command Line Interface (CLI)

The more primitive User Interface, the user would type in a line of command or a single word followed by pressing the Return key. The computer then willingly follows that exact command, informing the user of its progress. For example, the user may want to type in the command to print a document. The user will type the statement Print, then the name of the Printer and finally the name of the file to be printed:
Pros
Cons

### Graphical User Interface (GUI)

The GUI is made up of boxes or Windows which will display as an array of usually colourful tiny blocks called Pixels, and a group of pixels is a called an image. The maximum number of colours that can be used are called the Graphics. This User interface will display a Main window (also known as the Desktop) which then can be accompanied by more windows. GUI is the most common of the User interfaces, and the most user friendly, made up of event driven software. This type of UI is best for users lacking in computer coding skills, since GUI only needs you to make use of the mouse's events. There are still some people who prefer the use of a Command Line Interface to a Graphical User Interface.
Pros
Cons
* Exercise: Operating System Interfaces
* Name the two types of Operating System Interfaces
* Answer:
* GUI - Graphical User Interface
* CLI - Command Line Interface
* (Note that you give the full name of both)
* Give two benefits and a draw back of using a CLI
* Answer:
* CLIs can run on simple hardware with limited resources
* Some commands may be simpler to perform in a CLI than in a GUI
* Learning the commands may make it not suitable for a new user
* Some commands may be harder to perform in a CLI than in a GUI
* Give two benefits and a draw back of using a GUI
* Answer:
* Simple and intuitive for new users
* Some commands may be simpler to perform in a GUI than in a CLI
* GUIs require system resources and more complex hardware than CLIs
* Some commands may be harder to perform in a GUI than in a CLI
* Why do some system administrators prefer to use Telnet (a CLI) instead of a GUI to control remote computers?
* Answer:
* Sending text commands over the internet is very fast as very little data needs to be sent and received. Using a GUI would take up a lot of bandwidth.
* Additionally, some commands might be faster to perform using a CLI than a GUI.

## Virtual machine

The Virtual Machine is presented by the Operating System to the user, hiding all the complexities of the hardware behind layers of OS software. The final layers of the operating system are the user Interface and the Application programming interface, which calls on the services of the Operating System. Here are the layers of the OS which hide all complexities from the user, from the Hardware to the final layers of the User Interface and the API:
* Hardware
* Kernel - the bridge between the Hardware components and the Applications
* Device drivers
* Processor management
* Memory management
* File management
* I/O management
* User Interface/API

## Application Programming Interface

Not all machines should be expected to have exactly the same setup. The Application Programming Interface (API) makes it possible for the same piece of program to be used on different computers. It is the layer of the software that allows the application programs to call on the services of the OS.

## Resource management

Being the most fundamental of all system programs, Operating Systems are trusted with the job of controlling and sorting through the hardware, and this includes all the main components of the computer. To ensure that there is little confusion, the OS programs managing the key resources are giving relatively simple names depending on the resource they manage:
| Key Resource | OS Program |
| Processors | Processor Scheduling |
| Storage | Memory management |
| I/O devices | I/O management |
| Data | File management |
Remember: Data is stored information, but Storage holds the information.

## Operating system classifications

There are several different operating system classifications you need to know. You need to be able to compare and contrast them, as well as to identify the correct system required for a given problem or situation.

### Interactive

In an interactive operating system, the user interacts directly with the operating system to supply commands and data as the application program executes and the user receives the results of processing immediately. The user is in direct two way communication with the computer.
Example: ATM.

### Real time

A real time operating system will give guaranteed feedback within a predefined set period of time, therefore taking away the unpredictability of the operation being carried out. This allows for the system to be mathematically modelled to allow the time needed for operations to be carried out to be determined, even under the predicted maximum stress levels. It allows deadlines to be set on operations being carried so as to provide a "best of" result within the time period able to be given for an operation.
Example: If a real time operating system was used to control a plane's rudders (via a RT application) it would need to set deadlines on the calculations used to calculate rudder movements. Without these deadlines a calculations results may be returned too late and cause the plane to crash.
One very important factor to remember about real time operating systems and applications is that "the right answer late is wrong". After all what is the point in having the correct answer to a planes rudder calculation if it comes too late and the plane has already crashed because the rudder angle was not changed earlier.

### Network

A layer of software is added to the operating system of a computer connected to the network. This layer intercepts commands that reference resources elsewhere on the network, e.g. a file server, then redirects the request to the remote resource in a manner completely transparent to the user.

### Device

Not all computers have operating systems. If a computer only needs to perform one task, then this can be done most efficiently with just one firmware program running all the time. It would be overkill to add an operating system, adding complexity where it isn't needed and increasing production costs.
Devices that carry out more than one task benefit from an operating system. Some of the benefits of an operating system are:
* the device is able to multi task.
* the device has the ability to operate in real-time when necessary.
* the hardware can be changed or upgraded without the application code needing to be changed.
* it is easier to add new applications.
* changes to the functionality of the system can be implemented by upgrading the operating system without the need to change the hardware.
* applications can be developed on the device or created on another device and then installed.
* the entire OS can be replaced by another e.g. replacing Windows with Linux.

#### Mobile devices

Mobile devices present their own limitations for the types of operating systems they can run. They have to be built with a consideration for the limited memory or processing power and also for the mobility of the device. They also need to be able to manage a network connection, predictive text keyboard, smaller display, phone dialler and limited battery capacity. They may include embedded and real-time elements as well.
Your standard mobile phone (i.e. not a smartphone) will run apps in what is known as a sandbox. A sandbox provides strictly controlled resources for a guest program to operate in where network access and the ability to read from the file system are usually not allowed.

##### Smartphones

Smartphones are able to run a complete operating system and provide a standardised interface and platform for app developers. The operating system must be able to support things like email and internet. We tend to take these things for granted on a phone these days, but smartphones today have more processing power than desktop computers 10 years ago.

### Embedded

Many pieces of everyday machinery contain computer systems, for example cars, washing machines and telephones. These systems are called embedded systems. An embedded system has a limited or non-existent user interface and is designed to operate completely, or mostly, independently from within other machinery. Embedded systems also have limited memory capacity. Operating systems for embedded systems are designed to work within the constraints of limited memory size and limited processing power.

### Desktop

All desktop computers have operating systems, the most common of these are Windows, Mac OS, and GNU/Linux. Desktop operating systems have to be able to support a wide range of tasks and manage many types of hardware and software. In order to do this they require large amounts of memory, multiple processors and large amounts of disk storage capacity. They also have the ability to read and write to optical disks and flash memory drives. Desktop operating systems also require real-time components for multimedia applications and are able to support a broad range of network protocols.
Desktop operating systems are written in a layered or modular way so that they can be updated easily. They support complicated GUIs and because of this they can have slow load times due to a large memory footprint. Desktop operating systems provide a virtual machine so that users do not have to interact directly with the hardware. In a client-server system the client computers usually use a desktop operating system.

### Server

Server Operating System is an operating system that provides its networked clients some specific services.
Server Operating system doesn't have GUI because:
* more expensive.
* it takes up processing power.
Client-server System is a system where services are requested by clients and these services are provided by other computers.

### Multiuser operating system

Multiuser operating system is the one in which more than one user can use the same system at the same time with each user interacting with the computer via a terminal. It is also called time sharing system. Example-windows, Linux, Mac, etc.