1/89
UNFINISHED ( FINISHED INTERRUPTS MOVE TO SCHEDULING )
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Function of operating systems
The user needs to interact with hardware to produce an output. So, the operating system is used to allow interaction with the hardware.
Provides an interface for the user to use
Provides a platform on which application software can run.
Application software
Created to allow the user to perform various functions to interact with the operating system to interact with the hardware
usually involves a user interface so that the user is interacting with something familiar and easy to use.
Utility programs
built into the operating system that help to maintain the computer system including compression software, encryption software, and defragmentation software, and antivirus software
Memory/Resource management
a core function of the operating system which allows for programs to simultaneously run in main memory and virtual memory. With their data being managed
File management
Data is stored in files.
File extensions tell the operating system which application to load the file with
The operating system may present a logical structure of files in folders and allow the user to rename, delete, copy and move files.
The functions of operating systems are:
file management, memory / resource management, interrupt handling, user management / security, user interfaces
User management
allows multiple users to log into the same comptuer.
the operating system will retain settings for each user such as icons, backgrounds, and other computer settings
each user may have different access levels and rights to files and programs
a client-server network may impose a fixed or roaming profile for a user and manage login request to the network.
User interfaces
Allow the user to interact with the operating system which interacts with the hardware to produce an output.
GUIs, CLIs
WIMP - Windows, Icons, Menus, Pointers
Visual, Interactive, Intuitive, Optimised for mouse and touch gesture
Fixed / Roaming Profiles
Fixed profile means that each user will have the exact same settings
Roaming profile means that each user can have different settings and when they log into other computers, those settings follow them.
Memory Management strategies
There are two main strategies of memory management, both of which involve dividing the memory up into smaller sections:
Paging
Segmentation
Paging
Pages are a fixed size and are made to fit sections of memory
Pages are physical divisions
Programs are split up to fit into a given number of pages
Paging takes no account of how it splits the program, only that it splits it into fixed-sized pages
It could separate the instructions inside a looping condition so they are in different pages meaning that different parts of RAM would be jumped to which isn’t very efficient
It is better to keep those instructions together in memory
Segmentation
Segments are different sizes and are COMPLETE SECTIONS of a program / of programs.
Segments are logical divisons meaning the program is divided into complete parts and places them in the available free space leaving two smaller areas of free space
Paging and Segmentation Similarities
Both allow programs to run despite insufficient memory
Pages and segments are both stored on the disk
Pages and segments are transferred into memory when needed
Paging and Segmentation Differences
Pages are fixed size. Segments are different sizes
Pages are made to fit sections of memory. Segments are complete segments of a program
Pages are physical divisions, Segments are logical divisions.
Virtual memory
when the size of the programs being executed is larger than the available space in RAM, virtual memory is used.
Virtual memory is a section of secondary storage dedicated to run like RAM. It is slower than RAM but faster than secondary storage.
Data of programs that are not currently being used when the RAM is full is moved to virtual memory so that the program being executed can run in RAM which is faster.
When the data in virtual memory is needed again, it can be swapped out for a program in main memory that is not currently being used.
What is an interrupt
While the processor is fetching, decoding and executing instructions, other devices and applications may require the processor’s attention. This is when interrupts are used to signal to the processor that they require attention.
Fetch decode execute cycle becomes Fetch, decode, execute, check for new interrupts
What is the interrupt service routine
The processor needs to stop executing its current program to run code for the interrupt. This code is called the interrupt service routine.
The interrupt service routine is a program with a set of instructions that need to be fetched, decoded, and executed to carry out the operations of the interrupt. This means that the contents of the program counter need to be changed to point to the address for the first instruction of the interrupt.
What is the stack
When an interrupt is received, the values held in the registers are copied into the stack. These values are pushed into the stack in a stack frame saving them for later retrieval.
once the interrupt is completed, the stack frame is popped off the top of the stack allowing the processor to retrve the previous values for the original program, load them back into the registers, and carry on execution of the original program where it was left off.
the stack is a data structure in memory.
What happens when there is an interrupt
The currently running program is suspended, and the data in registers is pushed to the stack in a stack frame. The processor then handles the fetch, decoding, and executing of the interrupt service routine.
What happens if there is a higher priority interrupt while an interrupt is running
The interrupt service routine that was currently running is suspended and data stored in registers is pushed onto the top of the stack it then starts executing the higher priority interrupts’s service routine.
Once the higher priority interrupt service routine has completed execution, the frame of the previous program (ISR) is popped off the top of the stack retrieving the values for the program, loading them back into registers and continuing execution of the program from where it was left off.
After the first interrupt is handled, we pop the frame off the top of the stack for the original program so that the original data values are retrieved and put into registers and the program continues to execute where it was left off.
Example of hardware interrupt
Power supply failure, power button pressed, power down command
Example of User interrupt
Moving the mouse, clicking / tapping an icon to open a program, keyboard presses
Examples of software interrupt
illegal instructions encountered, arithmetic overflow, new log on request
Example of timer interrupt
data logging programs reading an input sensor every second, screen recording applications
Example of I/O interrupts
signal the completion of a data transfer to/from a device
printer ink supply notification
What is scheduling? What is a schedular?
A schedular manages which process to execuite next and the length of time the next process can execute for
How does scheduling work?
Processes move into the process ready queue given a time slice
Once the program currently executing in the CPU is finished, the next process will move into the CPU to be run
from here it will either finish execution and leave the system completely, get blocked as it requires an input or output command (cannot continue until more data is received), or run out of time - each process is given a certain amount of time it can run for - after which it is suspended and moved to the back of the ready queue
What is a scheduling algorithm
An algorithm that decides the order in which processes in the process ready queue run
First come first serve (FCFS)
Processes are executed in the order that they arrive
If a process takes a long time, the others behind simply have to wait or leave the CPU before they can be processed
NON PRE-EMPTIVE
Shortest job first (SJF)
Picks the process that takes the shortest amount of time and runs them until they finish
for this to work, the scheduler needs to know how long each process will take
(organises the process ready queue in order of largest → shortest assuming cpu is on the right.
NON PRE-EMPTIVE
Round robin (RR)
Each process is allocated a fixed amount of time known as a time slice / quantum.
if the process is not complete before the end of its time slice, it returns to the back of the ready queue
if time slice is 5, process A (10 ticks needed) will enter the running state and execute for 5 ticks before it is suspended and sent to the back of the queue. It will re enter the queue with 5 ticks remaining because 10-5=5
time slice values are global (if 5 then all processes run for 5 ticks)
PRE-EMPTIVE
what is a time slice
time slice is the amount of ticks the CPU will execute on each process in round robin
time slice values are global meaning if it is 5, ALL processes will run for 5 ticks
what is cpu burst time / execution time / processing time
The total number of CPU ticks required for a process to complete execution
total CPU time needed for a process to finish
Shortest remaining time (SRT)
Shortest remaining time allows for higher priority processes to go to the front of the ready queue
e.g. if process A runs for 4 ticks and becomes 6 and process B joins with 5 ticks process B will go to the front of the queue.
Shortest job first but allows for the shortest remaining time process to go to the front of the queue
PRE-EMPTIVE
Process Blocking
While a process is running, if it requires data from the hard disk, it will be blocked until this data has been received through an input request. The next process will go to run in the cpu while the first process is still waiting to receive the data
once the data is received, the process must generate an interrupt to let the scheduler know it is ready and can rejoin the ready queue
Multi level feedback queues (MLFQ)
a pre emptive CPU scheduling algorithm used used by operating systems
balances responsiveness for short/interactive tasks and fairness for longer CPU-bound tasks
Multiple priority queues, new processes start in the highest priority queue
processes can move down if they use too much CPU time
processes may move up if they do not use all of their allocated time slice or frequently wait for inputs/outputs
higher priority queues are always serviced first
designed to adapt to process behaviour dynamically
uses multiple process ready queues with different priorities. the higher priority queues are always services first. processes move between queues based on their cpu behaviour
PRE-EMPTIVE
what is starvation? how is it solved?
when a process waits and never gets CPU time because other processes keep getting priority
priority boosting solves this - if a process doesnt get CPU time in a while, priority is boosted
advantages of MLFQ
adapts dynamically to process behaviour
gives short or interactive tasks higher priority
reduces waiting time for priority processes
disadvantages of MLFQ
more complex to implement
lower priority tasks may starve.
harder to tune parameters like number of queues, time slice
pre-emptive meaning
a process running in the CPU can be stopped at any time
it does not have to finish its allocated time slice
allows higher priority or interactive processes to run immediately
Multi tasking operating systems
we expect to have more than one application open at once
in single-processor systems, each active program is scheduled to receive a tiny time slice in quick rotation to give the impression that they are operating at the same time
modern processiors with mutliple cores have to handle many processes at the same time
Multi user operating system
allows more than one person to use a computer at the same time
manages the user’s permissions and access rights when they log on
the server operating system software will handle requests of mutliple people using different computers on a network at the same time
Distributed operating system
combine the processing power of multiple computers across a network for a single tasks
in distributed computing, the operating system controls and coordinates the computers presenting them to the user as if they were a single system
e.g. one server handles querying of items, one handles the basket.
as the system becomes more busy with more requests, additional servers may automatically join the system - load-balancing requests without the user knowing
embedded operating systems
embedded operating systems tend to run on dedicated hardware so they run with maximum efficiency using low powered processors and very little memory
HIGHLY specialised for the task they are designed for
real time operating systems
in safety-critical environments, such as self-drive cars and missile systems
processes have to be guaranteed to execute within a known time frame
ALOT of redundancy is built into these systems so they can handle sudden increases in input
processors in real time operating systems rarely run at full capacity
overlapping classifications
all these classifications of operating systems can be combined together - overlapping
What is the BIOS
The basic input output system
responsible for loading the operating system when the computer first turns on
it first checks that all hardware is connected and working using a POST (power on self test)
what is a bootloader / bootstrap
a program that is used to load the operating system kernel into main memory
the operating system then takes over and boots up the rest of the system
where are initial startup instructions stored?
stored on ROM
where are BIOS settings stored and why?
stored in flash memory so they can be changed and are retained when there is no power
what is a device driver
software that tells the operating system how to communicate with a device
the device driver translates the operating system’s instructions into a series of instructions that a specific piece of hardware will understand
the computer has to output to a wide range of devices with different manufacturers and standards
What is a virtual machine
a program that has the same functionality as a physical computer
a virtual machine is hosted using a portion of the host pc’s hardware and can run any OS and any programs without affecting the host computer - completely isolated. the machine runs as if it were the host computer.
what can VMs be used for
testing applications on phones/consoles that were built on PC originally
server technology in VMS
VMs can be used to support a large number of virtual servers spread over a small number of powerful physical servers
4 physical servers runnign 6 virtual servers for example
as demand on a network increases, additional servers can be created and the load is balanced across different physical devices
if one server stops working, the others can pick up the load and continue working as if nothing happened
intermediate code
with traditional programming, you have to use the language of each device or a suitable compiler for each device
java gets around this by compiling its code into bytecode or intermediate code
this code is then translated by a Java Virtual Machine (JVM) running on the target device which then translates into specific machine code.
this makes the code highly portable between devices
what is hardware
physical parts of a computer system and its related devices both internal or external
what is software
general term covering all computer programs. most software falls into broad categories such as application, system, and utility software
what are teh two types of software
system software
application software
what is system software
operating systems, utility software
operating = windows, linux, macos, ios, android
utility = antivirus, defragmentation, backup, compression, firewall
what are the types of application software
presentation, word processing, spreadsheet, web browser, communication, email, photo editing, video editing, database, graphics manipulation
what is a generic application
does not ahve a very specific or narrow puirpsoe - can be used to carry out different tasks and meet multiple needs
generic applications such as word processors tend to be the most commonly installed and used products as they allow the user to be productive in many different ways
what is specific software
it has close to one specific purpose - making it essential for specific tasks such as database management
only tends to be installed on systems where there is a direct need for it.
what is DTP
desktop publishing (software)
like publisher
whjat is utility software
software designed to keep your computer safe, keep it running efficiently, provide you with useful tools to manage files and applications
examples of utility software
backup, compression, defragmentation, antimalware, file management, device drivers, file repair
File repair
files can become corrupt or damaged
this software attempts to correct these issues to restore the file to its original working state
file repair is often built into certain applications as well as being a separate dedication software tool found in most operating systems
backuip software
backups can be manual, automatic, or scheduled
incremental or full backups
you can backup to different media or an off site cloud system
backup software often comes with operating system but can also be purchased separately
full backup
takes all files and takes a copy of them all and puts them in a different media in a different location
incremental backup
scans to see what has changed since the last backup and only copies those files which have changed and adds them to the previous BASE full backup
Compression software
compression reduces the size of a file so it takes up less space and downloads and uploads faster over the internet
compressed files must be extracted before they can be read
data is either lost, reducing the quality of the file e.g. image or video OR represented in a different way using binary, retaining the original data in a new, compressed format
Defragmentation software
reorganises files on a hard disk, putting fragments of files and free space back together. This process reduces the movement of the read/write head across the disk which speeds up file access and improves the life span of the hard disk
solid state drives should not be defragmented as they have no moving parts. It also reduces the drive’s lifespan
Anti malware software
keeps the computer and files safe from malware such as viruses, trojans, worms, spyware, ransomware
most operating systems come with malware protection already built in, configured and turned on
there are also companies who specialise in dedicated anti malware programs.
open source software
users can modify and distribute the software
can be isntalled on any number of computers
support is provided by the community
users have access to the original source code
may not be fully tested
adv and disadv of open source for users
software is free, wide community modification to suit ur needs
can be poorly supported, some features might not be well tested
adv and disadv of open source for creators
gets their software out there to a wider community
little to no financial gain
closed source software
protected by the copyright design and patents act
users cannot modify the software
usually paid for and licensed per user or per comptuer
supported by developers who do not release source code
tested by developers prior to release, although it may run beta programs to allow people early access
adv and disadv of closed source for users
well supported, tested, professional built product
cost or ongoing subscription fee
adv and disadv of closed source for creators
advantages:
they receive an income for their product
constant demand from community for more features and improvements
disadvantages:
piracy issues
what is source code
we pick a programming language and write source code - it is descriptive and easy for us to understand, read, maintain and debug
however, computers cannot understand it so we translate it into machine code which is a pure binary form of source code so that computers can execute it
what is translation
the process of converting source code into machine code
different types of translators
assembler, compiler, interpreter
what is an assembler
translates assembly codfe mnemonics directly into machine code which can be executed on the specific processor architecture
how are high level languages translated
compilers or interpreted
what is an interpreter
takes one line of source code, translates it then executes it
what is a compiler / compilation
compilation takes the entire source code and translates it to produce a machine code output
the compiler translates the source code into object code then a linker program adds any libraries that are needed. The finished machine code can be produced as an executable file or an intermediate stage can be completed creating intermediate code which can be interpreted to convert to machine code.
advantages of assembler
memory efficient, speed of execution is faster, hardware oriented, requires fewer instructions to accomplish the same result
disadvantages of assembler
takes a lot of time to code or write the program as it is more complex
lack of portability between computers of different makes
advantages of compiler
no need for translation at run time
speed of execution is faster
code is usually optimised
original source code is kept secret
disadvantages of compiler
the program will not run with syntax errors - can be more difficult to write the code
code needs to be recompiled when the code is changed
designed for a specific type of processor
advantages of interpreter
easy to write source code as the program will always run only stopping when a syntax error is found
code does not need to be recompiled when code is changed
it is easy to try out commands when the program has paused after finding an error ( compared to recompiling ) making interpreted languages easy for beginner programmers to learn to write code