Table of contents
3.4.1 Purposes of an operating system (OS)
- show understanding of how an OS can maximise the use of resources
- describe the ways in which the user interface hides the complexities of the hardware from the user
- show understanding of processor management: multitasking, including:
- the concept of multitasking and a process
- the process states: running, ready and blocked
- the need for scheduling
- the concept of an interrupt
- how the kernel of the OS acts as the interrupt handler and how interrupt handling is used to manage low-level scheduling
- show understanding of paging for memory management: including:
- the concepts of paging and virtual memory
- the need for paging
- how pages can be replaced
- how disk thrashing can occur
Paging
w16 31 Q3
Page thrashing
w16 32 Q3.iv [1]
(Need only to remember the name ‘Thrashing’ but not definition)
Thrashing: When pages are loaded and unloaded simultaneously.
What is meant by page frame address
w16 33 Q3.a [1]
In case Page frame address is ‘245’,
- The 245th page frame from the start of memory.
What is meant by page
w19 33 Q6 [1]
- Virtual Memory is divided into blocks of a fixed size.
What is meant by page frame
w19 33 Q6 [1]
- The main memory is divided into page frames of the same size as a page.
What is meant by page table
w19 33 Q6 [1]
- The Page table shows mapping of pages to page frames.
Difference between process and program
w15 31 Q6.a [2]
- A process is the executing code (‘dynamic’)
- A program is the written code (‘static’)
States of processors
w15 31 Q6.b [6]
w15 32 Q6.a, Q6.b [7]
RUNNING -> READY
w15 32 Q6.a [2]
- Running state: Process is allocated time on processor
- Ready state: When interrupt occurs the process can no longer use processor even though it is capable of further processing
READY -> RUNNING
w15 31 Q6.b [3]
- Process is capable of using processor
- OS allocates processor to process so that process can execute
RUNNING -> BLOCKED
w15 31 Q6.b [3]
- When an executing process needs to perform IO operation,
- it is placed in blocked state until IO operation completed.
BLOCKED -> READY
w15 32 Q6.a [2]
- Block state: Process is waiting IO operation to complete
- Ready state: when IO operation completed process goes into ready queue
Why a process cannot BLOCKED -> RUNNING
w15 31 Q6.c [3]
- When IO operation completed for process in BLOCKED state,
- process is put in ready state
- OS decides which process to allocate to processor from the ready queue.
Why a process cannot READY -> BLOCKED
w15 32 Q6.b [3]
- To be in BLOCKED state, process must perform some IO operation
- To perform IO operation, process must be executing, so it must be RUNNING. ([2])
When RUNNING process uses up its time slice
w18 31 Q5.a.ii [2]
- Running process is halted
- … and moves to ready state
Conditions for a process to READY -> RUNNING
w18 31 Q5.B.i [2]
- Processor is available
- Process was at the head of the ready queue
Conditions for a process to BLOCKING -> READY
w18 31 Q5.B.ii [2]
- The only
- … required resource becomes available
Why scheduling (algorithms) is needed
w18 31 Q5.c [3]
s19 33 Q5 [3]
- to allow multiprogramming
- to give each process a fair share of the CPU time
- to allow the highest priority jobs to be executed first
- to give each process a fair share of the memory
The role of high-level scheduler in a multiprogramming OS
w15 31 Q6.d [2]
- Decides which processes are to be loaded from the backing store
- into ready queue
The role of low-level scheduler in a multiprogramming OS
w15 32 Q6.d [2]
- Decides which of the processes in ready state
- should be put in RUNNING state
- based on priority
- invoked after interrupt
What is meant by an interrupt
w19 33 Q6 [1]
- A signal from a software source or hardware device seeking the attention of the processor.
How interrupts help to solve unloaded paging problems
w16 32 Q3.b.ii [3]
- When loading an instruction for a page not in memory,
- … a page fault occurs,
- … which generates an interrupt.
- ISR code is executed,
- causing the OS to load the paged needed into memory
3.4.2 Virtual Machine
- show understanding of the concept of a virtual machine
- give examples of the role of virtual machines
- show understanding of the benefits and limitations of virtual machines
w17 32 Q3.ii [3]
- Guest OS handles request as usual.
- I/O requests are translated by the virtual machine software
- … into instructions executed by host OS.
- Host os retrieves the data from the file
- … and passes it to the virtual machine software
- Virtual machine software passes the data to the guest OS.
Describe the role of the virtual machine software
in testing an application
w20 32 Q6 [3]
- Create virtual machine.
- Translate instructions used by guest OS to that required by host OS.
- Hardware emulation.
- Protecting each VM
- … so instances of app can be tested together.
Using VM
Benefits
w17 32 Q3.b.ii [1]
- Software can be tested on different OS using same hardware,
- … therefore no need to purchase all sorts of different hardware.
Limitations
s16 31 Q3.b.ii [2]
w17 32 Q3.b.ii [4]
- Particular hardware may be difficult to emulate ([2])
- Using VM means execution of extra code, so cannot judge actual response times ([2])
3.4.3 Translation software
- show understanding of how an interpreter can execute programs without producing a translated version
- show understanding of the various stages in the compilation of a program: lexical analysis, syntax analysis, code generation and optimisation
- show understanding of how the grammar of a language can be expressed using syntax diagrams or Backus-Naur Form (BNF) notation
- show understanding of how Reverse Polish Notation (RPN) can be used to carry out the evaluation of expressions
The benefit of code optimization
w15 33 Q3 [2]
- Less instructions
- so less execution time needed
The benefit of (Reverse Polish Notation) RPN
w16 31 Q3.c.iii [2]
- No need for rules of precedence
- No need for brackets
- In RPN evaluation of operations is always left to right
Why no need for rules of precedence with RPN
w16 32 Q2.c.iii [2]
- In RPN. Evaluation of operators is left to right.
- No need for brackets.
How RPN is used by an interpreter
s20 33 Q6 [2]
- Evaluation is always from left to right.
- Each operator uses the two previous values on the stack.
- Description of pushing and popping on a stack.
Phases of a Compiler
- Lexical analyzer
- Syntax analyzer
- Semantic analyzer
- Intermediate code generator
- Code optimizer
- Code generator
Tasks of Syntax analysis
w15 32 Q2.c.ii [2]
- construct parse tree
- checks syntax
- reports error