Operating System - Definition
A software that manages hardware resources and provides user interface
Purpose of OS (theres 7)
OS Multitasking
More than one program can be stored in memory, but only one can have CPU access at any given time.
The rest of programs remain ready
3 Memory Process States
Ready: A new process arrived at the memory, and the PCB is created
Running: Has CPU access
Blocked: Cannot progress until some event has occurred
Scheduling
Ensures that the computer system can serve all requests and obtain a certain quality of service.
4 Scheduling Algorithms
Explain what Round Robin is
List the Advantage/ Disadvantages
Advantage
- Starvation does not occur
Disadvantages
- The processing resources could be used up on schedulling rather than processing
Shortest Job First, Define and give disadvantage
A scheduling process that selects the waiting process with the shortest execution time.
Disadvantages:
1. Hard to predict execution time
2. Can cause starvation of resource - long execution programs may have to wait an indefinite amount of time
Purpose of a User Interface
First Come First Served
Advantage
- Starvation doesnt occur - all processes will get a chance to run… eventually
Virtual Memory - what is it
Why would you use Virtual memory
It can be used when RAM is running low - computer processing many things at once
For more efficient use of RAM - any programs not running can be moved to virtual memory
Paging
Reading/ writing blocks of data from/to secondary storage when required
Segmentation
Disk Thrashing
—> as main memory fills up, more pages need to be swapped in and out of secondary memory
—> this swapping leads to a very high rate of hard disk head movements
—> eventually, more time is spent swapping the pages/ data than processing it.
2 types of Translation Software
Interpreter and Compiler
Explain the process of Interpreter
Compiler: State the 4 Compilation stages
Explain the 4 stages of Compilation
Lexical Analysis
- Converting a sequence of characters into a sequence of tokens
Syntax Analysis
- Uses parsing algorithms to interpret the meaning of a sequence of tokens
- checks if code matches the grammar of the language
- syntax errors are reported
- parse tree is produced
Code Generation
- Converting intermediate representation of source code into executable code
Optimisation
- Minimising a programs execution time and memory requirement
Why is RPN used
RPN or Reverse Polish Notation is used to carry out evaluation of expressions
- Provides an unambiguous method of representing an expression
- reads from left to right
- doesnt require brackets or rules of BODMAS
Explain Interrupt Handling
When an interrupt occurs, the process in the running state is moved to the ready state and the interrupt is moved to the running state so that it may be serviced.