An operating system provides the interface between the user and the hardware. The operating system provides a platform for the applications to run on. It will also provide its own user interface. Utility programs will often be built into the operating system. Another is loading programs into the memory so they can be executed as well as managing the memory. The operating system will also manage the storage of files in the memory. It also handles device drivers and interrupt handling.
One of the main things the OS does is multitasking which is where you have more than one program running at once. The operating system doesn’t actually run multiple instructions at once but it allocates a small amount of time to each process and cycles between them. As this happens so quickly it has the effect that they are running simultaneously.
The OS also handles file management where it will present a logical structure of files in folders.
The OS also handles the user management so allowing multiple users to log onto a computer with their own personal settings and files.
The OS handles the user interfaces which includes things such as showing the windows, icons, menus and pointers or a WIMP interface which is very simple to use and very intuitive.
One of the ways of managing memory while the computer is running is using paging where the memory is split up into fixed equal size spaces. They are made of fixed sections of memory and programs are split up into a given number of pages however this may become undesirable as certain instructions may be split up making it efficient.
The second way of organising the data is to use segmentation which is where the memory is split into segments which aren't necessarily equal size. They are complete sections of programs and are logical divisions
When main memory is full we need somewhere to store more instructions. We can access secondary storage and move not currently needed instructions into it. This is called virtual memory.
A computer performs the fetch decode execute cycle however while this occurs applications in the background may require the attention of the processer. This is called an interrupt.
When an interrupt occurs however this means the processer has to stop what it was doing to run it, this is called the interrupt service routine.
The ISR is simply a program that when carried out perform the actions of the interrupt. This means the contents of the program counter need to be changed to begin carrying out the interrupt.
A stack is used so that the processer can return to its original actions after the interrupt. Every time an interrupt occurs the current process in the processer is copied and pushed onto the stack and popped when the interrupt is complete. Interrupts have a higher priority over normal instructions.
Scheduling is the managing of the order for instructions to occur. This links to multitasking as it determines the order all the instructions that are needed to be carried out.
The first type of scheduling is the first come first serve which utilizes the queue data structure.
The next type of scheduling is shortest job first where the scheduler orders the jobs by shortest first
The next type of scheduling is round robin where you have a time slice and if the instruction is not completed within that time slice it goes to the back of the queue.
The next type of scheduling is shortest remaining time where if a job with a shorter completion time joins the queue the current instruction is suspended and replaced by it.
Another type of scheduling is Multi-level feedback queues are used when the CPU has multiple processers allowing for different queues with different priorities.
Scheduling summary - There are 3 pre-emptive types there is round robin where each process is given the same time slice in the processer then moved out. There is shortest time remaining where instructions with less remaining time replace instructions with more time. There is multi-level feedback where several queues are used with different priorities. There are two non pre-emptive one is first come first serve where the first instruction is the first carried out. There is shortest job first where jobs are sorted in the queue according to the estimated processer time.
If the scheduling type is pre-emptive it means the current instruction can be suspended and replaced if a higher priority one joins the queue.
There are 5 different types of operating systems we need to know about they are : Multi-tasking, Multi-user, Distributed, Embedded and real-time.
Multi-tasking is where programs are scheduled to receive tiny time slices in the processer making it appear they are happening simultaneously.
In a multi-user OS the computer will manage each users permissions and access rights when they log on.
In distributed computing the OS coordinates multiple computers presenting them as if they were one single system. This allows for multiple computers to handle a large load so it is spread out. An example of this could be a shopping website where one system handles your basket for example and others complete other actions.
Embedded OS tend to run on dedicated hardware so they run with maximum efficiency using low-powered processers and very little memory. They could run on things like washing machines or TV's.
Real time OS run in safety-critical environments such as aircraft systems and self drive cars. They have lots of redundancy built in so they can handle a large sudden inputs. They rarely run at high capacity.
The Basic Input Output System or BIOS is responsible for loading the OS when the computer is turned on.
The BIOS first checks all the required hardware is connected and working using a Power-On-Self-Test or POST. A boot loader program or (bootstrap) is used to load the OS kernel into memory. Then the OS can take over. There are multiple different settings that can be configured in the BIOS to determine where to boot the OS from.
Software that tells the OS how to communicate with a device is called a device driver.
Computers can output to a wide range of devices. You want the same output on any device but every device has different technology so a device driver is needed to translate the OS instructions into the instructions that hardware can understand.
A virtual machine is a program that effectively acts as a physical computer. Emulators trick a program into thinking it is running on native hardware when in reality its is running on a different machine.
Virtual machines can be used to have a large number of virtual servers that run on less physical servers. This means more can be added if the load gets too much or if one of the physical servers stops working the virtual servers can be moved to another.
An example of a virtual machine is the Java virtual machine. This very helpful as usually to run a program on multiple platforms you would have to specific language for each device but with the Java virtual machine on each device you can run the Java intermediate code which is halfway between the Java and the machine code it can be run on any device. This makes it highly portable.