(a) The need for, function and purpose of operating systems.
(b) Memory Management (paging, segmentation and virtual memory).
(c) Interrupts, the role of interrupts and Interrupt Service Routines (ISR), role within the Fetch-Decode-Execute Cycle.
(d) Scheduling: round robin, first come first served, multi-level feedback queues, shortest job first and shortest remaining time.
(e) Distributed, embedded, multi-tasking, multi-user and Real Time operating systems.
(f) BIOS.
(g) Device drivers.
(h) Virtual machines, any instance where software is used to take on the function of a machine, including executing intermediate code or running an operating system within another.
Definition: Operating System
An operating system is a low level piece of software that manages the computer’s hardware & software, and provides an interface between the user and the computer.
Most people use computers because they want to use application software(such as word processing, internet browsing) however these applications only work inside of an operating system environment. The operating system is the software that controls, manages, and runs all of the applications on the computer.
The functions of an operating system include:
Loading a software interface for the user to interact with (usually a GUI or CLI)
Managing hardware resources such as memory and devices
User management
authentication & security
File management
When a user is using a computer they are either interacting directly with the operating system ( e.g. logging in to the computer) or via an application (e.g. saving a word processing document)
Retro Video - Operating System (28mins)
https://archive.org/details/computerchronicles a great website where you can check out lots of computer related information Shows were shown between - 1983 - 2002
Types of Operating Systems
A type of network OS
Client/Nodes (devices) are connected to the network and processing is shared between them
This maintains the efficiency of the processor- used across all nodes
No shared memory, since it would be inefficient to search the memory of all client/nodes on the network to locate something
E.g. Google’s server warehouses
Built for one specific task
Does not have the hardware or instruction set to do anything beyond what is intended (this would be wasted)
E.g. the OS in an individual traffic light
Contains a processor that can process billions of instructions per second
multiple programs can run at once; it seems as if they are being processed simultaneously
Time slicing is used: each process is allocated a certain (very small) amount of processing time before moving on to the next
Running programs are separated into individual windows
E.g. playing music whilst typing an essay
Data is processed immediately after it is received
Outputs are constantly produced based on the inputs received
Used in systems where responses to inputs must occur immediately
E.g. Machines in A&E, airbag systems in vehicles
Task
Read the presentation about features of Operating Systems (Click Here)
Basic Input / Output System (BIOS)
BIOS Software stored in ROM since it will never need to change and should not be changed to maintain data security and may provide alternate boot/hardware management options for users (e.g. altering fan speed). BIOS tends to be specific to the motherboard and contains details of attached hardware
The BIOS runs the Power-On Self-Test (POST): (beep sounds when you start your computer help indicate any errors). The diagnostic testing sequence is run by the BIOS when the device is powered on.
Quick summary explaining what is BIOS
Device Drivers
Device Drivers are the Instructions used by the OS to operate with a peripheral such as a mouse, keyboard, printer etc. They provide settings to configure the hardware for use with the OS. Hundreds of peripherals come preinstalled on the operating system and specific ones can be downloaded. The drivers for a specific device are stored within a file known as a registry or directory. The drivers convert general inputs/outputs from the operating system into code that will run on the intended device (and vice-versa)
Virtual Machines
Computers vary in the hardware they use, and run different programs and operating systems. Sometimes we might want to have the functionality and capability of another computer system running on our own computer. It may be that the hardware for the other system no longer exists or is unavailable.
We can use software to emulate the other computer system so that our computer can behave like that system. This emulation is known as a virtual machine.
The process of creating and running a virtual machine is known as virtualisation. The computer that runs the virtual machine is known as the host. The virtualised system is known as a guest.
Virtualisation software, known as an emulator, creates a virtual implementation of the guest system on the host computer, providing the host with the functions and programs of the guest. The emulator translates the instructions of the guest computer so that the host computer can understand them. The emulator also provides a bridge that allows the virtual machine to use the user interface, via the host operating system (I/O – input/output), allowing the user to interact with the software running on the virtual machine.
Task
Why not try to create your own virtual system machine using the free software download called virtualbox https://www.virtualbox.org/ or https://www.oracle.com/uk/virtualization/technologies/vm/downloads/virtualbox-downloads.html
Please note that this video content was originally created for Cambridge Technicals in IT, however, stills demonstrates the same things for OCR A-Level Computer Science
Recall - memory
To help understand Paging and Segmentation its important to make sure we understand memory management, below are a some key terms to help recall.
RAM (volatile)
Temporarily stores instructions and data of running programs
Faster than Secondary Memory
Backing storage (non-volatile)
Stores permanent data
Larger but slower than primary
Paging
• Main memory is partitioned into physical divisions called ‘pages’. When a computer is running short of primary memory, it uses parts of secondary memory as primary memory (so programs don’t have to be shut down completely) – this is known as virtual memory
• The memory manager tries to make primary and secondary memory appear continuous/seamless. This allows more programs to be able to run simultaneously on a device. This also allows programs that are larger than primary memory’s capacity to run, since the idle parts of the program can be stored in virtual memory
• When primary memory is almost full, inactive pages are moved temporarily from primary to virtual memory. When an application needs data held on a page in virtual memory, it will be swapped back into main memory and another inactive page may take its place
• To manage these pages, a ‘page table’ is created by the memory manager to store the starting address of each page (where the first byte of the page is located in physical memory)
• All pages are the same size
• Pages do not need to be continuous (stored one after the other)
Segmentation
Primary memory is partitioned into logical divisions that hold sections of program data. These ‘segments’ of memory do not have fixed sizes.
Stack segment:
Starts from the top and grows downwards
Holds variables
Free memory:
Free space allows the stack to grow and shrink
Data segment:
Where data used by the running code (e.g. variables) are stored
Code segment:
Where the program code itself is stored
Paging VS segmentation:
Similarities:
Both split primary memory into smaller sections
Both aim to maximise the use of primary memory
Neither requires an entire program to be loaded into primary memory; more can be called upon when it’s needed
Both use indexing
Differences:
Only segments vary in size
Pages: physical memory divisions (each page is a separate area of memory) - does not change in size
Segmentation: logical memory divisions (e.g. storing all instructions together) - changeable size
Task
Using the presentation template create a presentation that explains: (CLICK HERE) Please make a copy if your teacher has not provided you a copy in your Google Classroom.
What is Paging?
What is Segmentation?
What are the differences /similarities?
Interrupts
Interrupts are signals (from either attached devices or programs running within the OS) that cause the CPU to pause,
consider the signal and act accordingly. Most modern computers are interrupt-driven – they execute whatever is next in the queue instead of waiting for (slower) I/O devices to respond (which would waste time).
• An interrupt may instruct a new program to run
• An interrupt handler (part of the scheduler (further down)) prioritises interrupts and saves them in a queue, should multiple occur at once
• An interrupt can occur at any point during the execution of an instruction. When this occurs, the following steps are taken to ensure that the cycle can be resumed once the interrupt has been dealt with:
Suspend the execution of the current instruction and move it back into the queue
Save the contents of registers in a stack so that they can be retrieved once the interrupt has been dealt with
Load the program counter with the address of the interrupt service routine and continue the cycle with a greater priority
Once the execution of the interrupt service routine is complete, the address of the next instruction in the queue (probably the one that was paused) is fetched and the cycle continues as normal
Scheduling
Scheduling: the way in which a multitasking OS orders tasks for the CPU (in terms of priority)
Processes: parts of programs loaded into memory that are potentially executed by the CPU
The purpose of scheduling:
Processes as many jobs as possible (in a certain time) to make maximum use of CPU time
Makes programs appear responsive to the user (so delays are not noticed)
Give fair CPU allocation to all current processes – leave none waiting for too long
Alter priorities of processes based on the scheduler algorithms used
Avoid ‘deadlock’, where nothing is processed because all processes are waiting for others
A process can be in one of three states:
1. Blocked:
Not running/not able to run
Waiting for a resource (e.g. interrupt, available memory, etc.)
2. Ready:
Ready to run but not currently active in the CPU (queued)
Will run when the CPU is free (and the process has the highest priority)
3. Running:
Code currently being processed in the CPU
The scheduler prioritises processes by the order in which they arrive, the first to arrive is the first to run in the CPU
Round Robin is a CPU scheduling algorithm where each process is assigned a fixed time slot, when the time slot has passes whilst processing the process is suspended and put to the rear of the ready queue.
They tend to be the most common form of scheduling processes and are seen as a fair process.
Processes with the shortest times are executed first
This improves user response times (since user inputs are simple and thus prioritised), making the user interface appear more responsive
Processes with the shortest times are executed first
This improves user response times (since user inputs are simple and thus prioritised), making the user interface appear more responsive
There are multiple queues with different priorities over one another
The queues may be organised (e.g. I/O processes, program processes, etc.)
Task
watch the short 8min video for further guidance/explanation regaling CPU scheduling from Craig N Dave.
Using google slides template (SCHEDULING) (you will need to make a copy if your teacher has not provided in your Google Classroom). create an animation that demonstrates each of the scheduling processes. The easy one has been done First come First Served as an example - Remember to turn in your work in the Google classroom.
PAST PAPER QUESTIONS
Try and answer the past paper exam questions -You can write your answers on paper or print out the exam paper - Mark Scheme is provided at the end of the paper questions. (try not to look at the answers before attempting all questions)