16 - system software + virtual machines Flashcards

1
Q

interpreter

A
  • executes the program line by line - outputs error messages as it encounters them
  • used evert time a program is executed
  • constructs a symbol table - allocates space in memory for constants, variables and data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

compiler

A
  • the source code is input and either object code or error messages are output at the end
  • source code can be run without translation again/ distrubuted
  • constructs a symbol table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

stages of compilation

A
  • lexical analysis
  • syntax analysis
  • code generation
  • optimisation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

translators

A

compiler
interpreter
assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

lexical analysis

A

first stage in compilation
- all unnecessary characters eg white space/ comments are removed
- program is converted into tokens - tokenisation
- variables and constants are also added to a symbol table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

keyword table

A
  • all the reserved words and symbols that can be used in the programming language are stored - with their corresponding token eg 2 hex numbers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

tokenisation

A

in lexical analysis to convert the program into tokens
- a key word table is used that contains all tokens for words/ symbols in a programing lang

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

syntax analysis

A
  • the output from lexical analysis is checked for syntax errors
  • the tokenised list is checked for errors using syntax rules for the programming lang (parsing)
  • if errors found each statement and the errors are output but in the next stage code generation wont be attempted
  • if error free its passes to the next stage to generate object code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

parsing

A

checking the tokenised list for errors using grammatical rules for the programming lang

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

lexeme

A

each meaningful character or collection of characters
may be used as an identifier or may be a key word
- in lexical analysis the whitespace and comments are removed and each lexeme is identified before categorising each lexeme to tokenise it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

code generation

A

produces object code to perform the task defined by the source code
- must be syntactically correct to produce obj code
- in machine code (binary)
- either in executable machine code or an intermediate form (converted to MC when program is loaded)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

benefits of intermediate code (code generation)

A

supports
- use of relocatable code so program can be stored anywhere in main memory
- addition of library routines to minimise storage size
- linking of programs to run together

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

optimisation

A
  • improves efficiency
  • performs task with minimum resources used
    eg time, storage space, memory and CPU use
  • can take place after syntax analysis or as part of code regeneration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

bootstrap

A
  • loads part of the OS into RAM from the hard disk
  • initiates start up procedures
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

when comp is switched on

A

BIOS starts off bootstrap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

flash memory

A

used as main memory on phones - explains why their start up is so fast
2 parts
- OS - read only - can be updated by manufacturers but user cant access
- apps (+ data) - user cant access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

resource management

A

split into 3 areas: CPU, memory, I/O system
- involves scheduling to allow for better utilisation of time and resources
- for I/O operations deals with: I/O operations that have been initiated, I/O operations that occur wile software is run and resources are requested

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

direct memory access controller (DMA)

A
  • allows hardware to access main memory independently of CPU
  • frees up the CPU to allow it to do other tasks while slower I/O operations take place
  • initiates data transfers - CPU does other tasks at same time
  • once data transfer is done an interrupt is sent to the CPU from the DMA
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

kernel

A
  • central component of OS
  • responsible for communication between hardware, software and memory
  • responsible for process
    management, device management, memory management, interrupt handling and input/output file
    communications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

how the OS hides the complexity of hardware from users

A
  • using GUI interfaces
  • using device drivers (simplifies the complexity of hardware interfaces)
  • simplifying saving/ retrieving data from memory and storage
  • carrying out background utilities eg virus scanning
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

syntax diagrams

A
  • anything with alternatives eg variable, letter, digit, operators goes in a square
  • items with no alternatives eg a specfic symbol or letter goes in a circle
  • have arrows showing the order of things
  • if in parallel you can have either of those options - iteration eg multiple letters is shown with an arrow looping
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Backus Naur form (BNF)

A
  • set of symbols used to describe the grammar rules in a programming language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

BNF notation symbols

A

<> encloses an item
::= separates an item from its definition ‘is defined as’
; end of a rule
eg <variable> ::= <letter> | <digit>;</digit></letter></variable>

<letter> ::= A | B | C;
<digit> ::= 1 | 2 | 3;
a vairbale consisting of any number of letters or digits could be defined as
<variable> ::= <Letter>|<variable><Letter>|<variable><Digit>

| between items indicates a choice
</Digit></variable></Letter></variable></Letter></variable></digit></letter>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Reverse Polish notation (RPN)

A
  • used to represent an arithmetic or logical expression - without brackets or special punctuation
  • uses postfix notation - operator is after the variables it acts on eg A+ B > A B +
  • compilers use bc any expression is processed left to right without backtracking - converted using a binary tree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
how to evaluate to RPN
eg a+ b *c whichever has the higher precidence in this case * is done first so put bc * then after put a on the far left and. + on the righ to give abc * + the comp will automatically do the 2 things next to the operator first then result, next one and the next operator
26
evaluating RPN using a stack
- values are added to the stack in turn from left to right - when you get to an operator it is used to operate on the top two values which are popped off - the result is then pushed back on - this is repeated until there is one value on the stack - the answer to the expression
27
converting back from RPN
whenever you have two variables and a sign after them pit the sign in the middle and rewrite the expression eg ba * cda ++- (b*a)c(d+a)+- (b*a)(c+d+a)- (b*a) - (c+d+a)
28
prcoess managemtn
- multitasking - low level scheduling - process scheduler
29
multitasking
- comps can carry out more than one task - scheduling is used to decide which is carried out at each time - monitors state of each process - gives appearance that prcoess are carried out a same time - kernel overlaps the execution of each process using scheduling - 2 types - preemtive, non preemtive
30
preemptive
processes pre-empted after each quantum - resources allocated for a limited time - can be interrupted - high priority processes arriving frequently means there is a risk low priorit processes are starved - more flexible
31
non preemptive
- once the resources are allocated they are retained until it has completed its burst time or has switched to waiting - cant be interrupted - must finish or switch to waiting - if process with long burst time is running there is a risk another process with short time is starved of resources - more rigid
32
low level scheduling
- decides which process should get next use of CPU - maximises system to and ensure a stable system
33
process priority depends on
- category (batch, online, real time) - if its CPU bound or I/O bound (needs more CPU or I/O devices) - resource requirements - turnaround, waiting and response time - whether the process can be interrupted during running
34
once a priority is given a task is still affected by
- deadline for the completion of process - how much CPU time is needed to run - wait time and CPU time - memory requirements
35
process control blcok
- data structure containing all data needed for a process to run - created in memory when data needs to be received during execution
36
process control block stores
- current process state - process privileges (which resources it can access) - register values - process priority and scheduling info - amount of CPU time needed to complete - unique process ID
37
process state
- running - ready - blocked
38
running > ready
- program executed during time slice - when slice is done interrupt occurs and is moved to ready
39
ready > running
- once process is first in ready queue - OS scheduler allocates CPU time to process so it can be executed
40
running > blocked
- process needs to carry out an I/O operation - the OS scheduler puts process in blocked
41
blocked > ready
process is waiting for I/O resource an I/O operation is ready to be completed by the process
42
scheduling routine algorithms
- first come first served scheduling (FCFS) - shortest job first scheduling (SJF) - shortest remaining time first scheduling (SRTF) - round robin ensure system is running efficiently and stable have to manage ready queue to minimise waiting time
43
first come first served
data added to queue first is data that leaves first + no risk of starvation
44
shortest job first
non preemptive burs time shoudl be known in advance job qith the shortest burst time is completed first
45
shortest remaining time first
preemptive processes placed in the queue as the arrive if a process with a shorter burst time arrives the xisting process is remover (preempted) from execution
46
round robin
a fixed time slice is given to each process (quantum) once a process is executed for its time slice its removed and placed in the blocked and the next process in the ready queue is executed in its slice Context switching is used to save the state of the pre-empted processes
47
interrupt handling
the CPU checks for interrupt signals the system will enter the kernel mode if any of these interrupts are sent: - device interrupt eg printer out of paper - exceptions eg /0 - traps/software interrupt eg process requesting a resource
48
interrupt dispatch table
when an interrupt is received the kernel consults the IDT - this links a device description with the appropriate interrupt routine - supplies the address of low level routine to handle the interrupt - kernel saves the state of the interrupt process on the stack - the state is restored once the interrupt is serviced
49
interrupt priority levels
how interrupts are priorities a process is suspended only if its IPL is greater than that of the current task the process with the lower IPL is saved and handled when the IPL falls bellow it
50
interrupt process
- interrupt recieved - state of current process is saved on kernel stack - source is identified and priority is checked - the system now jumps to the ISR - once completed the state of the interrupted process is restored and continues
51
memory management
- determines which processes should be in main memory and where they are stored (optimisation)
52
single contiguous allocation
all memory is made available to a single application
53
paged memory
- memory is split up into fixed size partitions - physical memory (frames) and logical memory (pages) are split up into fixed sized blocks - program is allocated just more pages than it needs
54
page table
uses page number as index maps logical address onto physical address shows page num, flag status, page fram adress and time of entry
55
segmented memory
logical address space is broken up into variable size memory blocks (segments) each has a name and size to execute segments from logical are loaded into physical memory segments are numbered and used as index in a segment map table
56
paging vs segmentation
57
logical vs physical memory
58
virtual memory
if a process runs out of RAM uses swap space on the hard disk implemented using in demand paging pages are loaded into memory from the disk when required
59
benefits of virtual memory
- programs can be larger than physical memory and executed - more efficient multi programming - less I/O loading and swapping programs into/out of memory - no need to waste memory with unused data - eliminates external fragmentation/ reduces internal fragmentation - no need to buy/ install expensive RAM
60
disk thrashing
- when there is a high rate of read/write head movements - increases as main memory fills when using virtual memory - if more time is spent moving pages than processing then the processing speed decreases - can lead to premature failure of a hard disk
61
thrash point
when the execution of a process comes to a halt as the system is so busy paging in and out of memory
62
how do programs access data using virtual memory
- program executes the load process with a virtual address - comp translates address into a physical address - if not in memory then loads from disk - reads RAM using the physical address and returns data
63
page replacement
occurs when a requested page isnt in memory if a new page is requested but not in memory then page fault occurs OS replaces the existing oage with a new page
64
page replacement algorithms
first in first out optimal page replacement least recently used page replacement clock page replacement/ second chance page replacement
65
first in first out
OS keeps track of all pages usinga queue oldest page is at front and first to be removed when new page to be added - dont consider page usage - beladys anomaly - possible to have more faults when increasing number of frames
66
optimal page replacement
looks to see which frame it can replace before a fault happens replaces the faulty page with the page that will not be used for the longest time in the future + free of beladys anomaly
67
least recently used page replacment
the page not used for the longest time is replaced need to maintain a linked list of all pages in memory with most recently at front and least at the rear
68
clock page replacement/ second chance page replacement
- use a circular queue with a single pointer serving as both head and tail - when a page fault occurs the page pointed to is expected and action depends on R flag if R = 0 its removed if not its kept
69
processor management vs memory management
- processor decides which processes will be executed and in which order eg multitasking, scheduling - memory decide where in memory data is stored and how they are stored eg paging, segmentation
70
virtual machines
- an emulation of an existing computer system - runs the existing and oversees the virtual hardware using a guest OS
71
emulation
- the use of an app/device to imitate the behaviour of another program/device; for example, running an OS on a computer which is not normally compatible
72
host OS
- This is the OS that is controlling the actual physical hardware. - It is the normal OS for the host/physical computer. - The OS runs/monitors the virtual machine software
73
guest OS
- This is the OS running in a virtual machine. - It controls the virtual hardware during the emulation. - This OS is being emulated within another OS (the host OS). - The guest OS is running under the control of the host OS software.
74
hypervisor
virtual machine software that creates and runs virtual machines
75
+ virtual machines
- can be used without impacting anything outside the VM - hsot is protected - can run apps not compatible with host OS - useful to emulate old software on a new system - useful for testing a new OS or app since they will not crash host comp if something goes wrong
76
- virtual machines
- not same performance on guest OS as when running real system - can be pricy - complex to manage and maintain
77