Unit 2 - Operating System Flashcards

1
Q

what is an operating system

A

software needed to manage communication with computer hardware

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

how is an operating system booted

A

the boot loader in ROM loads the OS into RAM when the computer is switched on

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

functions of an operating system

A
  1. user interface
  2. memory management
  3. interrupt service routines
  4. processor scheduling
  5. backing store management
  6. management of all I/Os
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

why does an operating system have memory management

A

programs and their data needed to be loaded into RAM to be used. the OS must manage the allocation of RAM to different programs. there may not be sufficient RAM for all desired processes to be completely loaded into RAM at once

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

what is paging

A
  • available memory is divided into fixed size pieces called pages
  • each page has an address
  • a process loaded into RAM is allocated sufficient pages, but those pages may not be contiguous (next to each other) in physical terms
  • a page table maps between the logical memory locations and the physical memory locations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is segmentation

A
  • a logical method of memory allocation where memory is divided into segments which can be of different lengths
  • segments can relate to parts of a program, for example a particular function or subroutine may occupy a segment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is virtual memory

A
  • a computer has a fixed amount of RAM so the demand for memory will often exceed this amount
  • a designated area of secondary storage is used as if it were main memory
  • some of the pages of a current process are stored in virtual memory until they are needed, at which point they are swapped into RAM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is disk thrashing

A
  • if many processes are running and the computer has insufficient RAM, lots of time is spent swapping pages in and out of virtual memory
  • repeatedly swapping pages can noticeably slow down the computer
  • this is known as disk thrashing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what are some advantages of paging

A
  1. simplified memory management means that the processor does not have to worry about physical memory addresses.
  2. efficient memory usage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are interrupts

A
  • it is vital that the CPU can be interrupted when necessary
  • a signal generated by a source such as a I/O device or system software that causes a break in the execution of the current routine
  • control passes to another routine in such a way that the original routine can be resumed after the interrupt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are some examples of interrupts

A
  • an I/O devices sends an interrupt signal
  • the printer runs out of paper
  • an error occurs in a program
  • a scheduled interrupt from the internal clock
  • power failure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how does the interrupt service routine work

A
  • the CPU checks at the end of each clock cycle whether there are any interrupts to be processed
  • when an interrupt is detected, the processor stops fetching instructions and instead pushes the current content of its registers onto a stack
  • the CPU uses an interrupt service routine to process the interrupt
  • when processing has finished, the values can be popped from the stack and reloaded into the CPU
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is interrupt priority

A
  • interrupts have different priorities, and will be processed in order of priority
  • interrupts can themselves be interrupted if the new interrupt has a higher priority
  • if a higher priority interrupt occurs whilst an interrupt is being processed, the original interrupt’s registers will be pushed onto the stack as well
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

advantages of interrupts

A
  1. simplifies I/O operations by allowing devices to communicate directly with the CPU
  2. increases the efficiency of the CPU as there is less waiting time between tasks
  3. enables multitasking by allowing the CPU to switch between tasks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

why does an operating system need processor scheduling

A

a single CPU can only process instructions for one application at a time. the OS must schedule when each application can use the CPU. this gives the illusion of multi tasking

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

what is the aim of processor scheduling

A
  • to provide an acceptable response time to all users
  • to maximise the time the CPU is usefully engaged
  • to ensure fairness on a multi-user system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

name some examples of how processor scheduling can be organised

A
  1. round robin
  2. first come first served
  3. shortest remaining time
  4. shortest job first
  5. multi-level feedback queues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

how does round robin work

A

each job is allocated (by FIFO) a time slice during which it can use the CPU’s resources. if the job has not been competed by the end of its time slice, the next job is allocated a time slice

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

advantages of using round robin

A
  1. each process gets an equal share of CPU time
  2. cyclic = less starvation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

disadvantages of round robin

A
  1. setting the time slice too short increases the overhead and lowers CPU efficiency
  2. setting the time slice too long may cause a poor response to short processes and RR degrades to FCFS
  3. average waiting time = long
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

how does first come first served work

A

the first job is executed until it completes and then moves onto the next job

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

advantages of FCFS

A
  1. simple and easy to understand
  2. fairness = all process have equal opportunity to run
  3. every process will eventually get a chance to execute (if the system has all the resources)
  4. low scheduling overhead = no frequent context switches or complex scheduling decisions
  5. well-suited for long-running processes or workloads without time constraints
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

disadvantages of FCFS

A
  1. processes with less execution time suffers
  2. favours CPU bound process rather than I/O
  3. average waiting time = long
  4. lower CPU and device utilization
  5. not suited for multiprogramming systems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

how does shortest remaining time work

A

the time to completion is estimated when each new job arrives. the job with the shortest remaining time to completion is executed. it is pre-emptive meaning that the process being executed can be stopped to process another job with smaller remaining time

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

advantages of shortest remaining time

A
  1. shortest jobs are favored
  2. gives the minimum average waiting time for a given set of processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

disadvantages of shortest remaining time

A

starvation - the large jobs with the longest time to completion may never be executed as new jobs constantly flow in

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

how does shortest job first work

A

the total execution time of each job is estimated by the user. the waiting job with the smallest total execution time is executed when the current job is completed. (not pre-emptive)

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

disadvantages of shortest job first

A
  1. starvation if processes keep coming
  2. it cannot be implemented at the level of short-term CPU scheduling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

how does multi-level priority queues work

A

multiple queues are created with different priority levels. if a job uses too much CPU time it is moves to a lower priority queue. processes can be moved to a higher priority queue if they have waited a long time

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

advantages of multi-level priority queues

A
  1. provides a good mechanism where the relative importance of each process may be precisely defined
  2. scheduling allows for the assignment of different priorities to processes based on their importance, urgency, or other criteria
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

disadvantages of multi-level priority queues

A
  1. if a high-priority process uses a lot of CPU time, lower-priority processes may starve and be postponed indefinitely
  2. deciding which process gets which priority level assigned to it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

how does a distributed operating system work

A

an OS where the software is spread over a collection of independent, networked, communicating and physically separate nodes. coordinates the processing of a single job across multiple computers
- a program that can be run by the user that uses data or resources from any other computer
- coordinated by the OS passing instructions between computers

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

advantages of a distributed OS

A
  1. the user can access more computational power with the illusion of working with a single processor
  2. no need for training or writing programs differently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

disadvantages of distributed OS

A
  1. the programmer has no control over the task distribution as this is entirely handled by OS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

how does a multi-tasking OS work

A

a single processor can appear to do more than one task simultaneously by scheduling time
- some systems use a powerful computer = mainframe
- lots of users with their own terminals access the mainframe’s CPU and each get a time slice
- each terminal is also running multiple processes

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

how does a mobile OS work

A
  • multi-tasking OS
  • linked to specific hardware
  • low level proprietary OS used for handling the hardware and special features
  • main OS handles user interface and running applications
37
Q

how does an embedded OS work

A

highly specialised, limited and cut down OS design to fit inside a certain type of machine whose single application is crucial to the device’s operation
- minimal features
- application programs are held in ROM
- limited amount of RAM
- user interface = simple and minimal

38
Q

how does a real-time OS work

A
  • responds in guaranteed time frame
  • safety-critical environments
  • ‘failsafe’ = mechanisms designed to detect and take appropriate action if hardware components fail
  • incorporate redundancy - crucial components are duplicated in case one fails
39
Q

what is the BIOS

A

basic input output system - part of the OS that handles the I/O of the computer. it enables the OS to use the particular features of the hardware being used

40
Q

what does the BIOS do

A
  1. boots the computer
  2. initialises and tests hardware
  3. loads the OS into RAM
41
Q

what is a device driver

A

a program that provides an interface for the OS to interact with a device. needed to allow OS to control hardware devices
- hardware and OS specific
- OS does not need to know the specifics of the hardware to interact with it

42
Q

how can a printer interact with other pieces of hardware

A

the base operating system and the hardware (kernel) and the driver communicate with the operating system, which in turn manages the hardware

43
Q

what is a virtual machine

A

software is used to emulate a machine. operated based on the computer architecture and functions of a real or hypothetical computer
- can be used for running one OS inside another to emulate different hardware
- can execute intermediate code (Java)

44
Q

why does an OS need backing store management

A

the OS is required to keep a directory of where files are stored so they can be quickly accesses. it needs to know which areas of storage are free

45
Q

why does the OS need peripheral management

A

different applications require different I/O devices throughout operation. the OS makes use of buffers to temporarily store this information so the CPU can continue with another task
- printer

46
Q

name 4 examples of systems software

A
  1. OS
  2. utility programs
  3. library programs
  4. translators
47
Q

name 4 examples of application software

A
  1. off-the-shelf
  2. custom written
  3. proprietary
  4. open source
48
Q

what are utility programs

A

programs that aim to optimise the performance of the computer and perform useful background tasks

49
Q

5 types of utility program

A
  1. disk defragmenter
  2. automatic backup
  3. automatic updating
  4. virus checker
  5. compression software
50
Q

what does a disk defragmenter do

A
  • large files stored on a magnetic hard drive may be split up across several physical disk locations
  • disk defragmenter reorganises the hard drive so that files are in sequential blocks where possible
    -the result is that files can be read more quickly
51
Q

what does automatic backup do and why is it needed

A
  • data in permanent (secondary) storage needs to be regularly backed up
  • users may forget to do this, so the process can be automated, specifying:
    1. where = portable hard drive, cloud, local server
    2. when = usually when the computer is not in use
    3. what = what data should be backed up
    4. how = should data be compressed
52
Q

what does automatic updating do and why is it needed

A

runs in the background detecting software update releases and automatically installing them
- some updates add new software features
- some important updates fix security issues which could otherwise be exploited by hackers

53
Q

what does a virus checker do and why is it needed

A

scans permanent (secondary) storage for viruses by comparing files to known virus definitions
- may also scan files ‘on access’ as they are opened
- must be kept up to date with new virus definitions to be effective

54
Q

how does a virus checker work

A

uses heuristics – it knows what types of behaviour are likely to be used by a malicious program
- heuristics can be used to guess which programs or files may contain a virus, based on their behaviour
- sometimes the virus checker will flag a harmless file as a virus

55
Q

what does compression software do and why is it needed

A

can reduce the size of files
- to compress more than one files = zipped folder

56
Q

what is application software

A

software that performs a task to benefit the user

57
Q

what are the 3 main categories for applications

A
  1. general purpose - ready made software available to anyone to purchase is known as off the shelf software
  2. special purpose - performs a single specific task or set of tasks
  3. bespoke - custom created for a specific user, mostly used by businesses
58
Q

what is open source code

A

allows anyone to access its source code
- licences but free to use
- anyone can modify the software and sell it, on the condition that the software produced is also open source

59
Q

what is freeware

A

software that is free for anyone to use but the source code is not available

60
Q

what is closed (proprietary) code

A

software does not allow access to source code
- users must pay the person or company who owns the copyright for a license to use the software
- there may be restrictions on how the software is used

61
Q

features of “off-the-shelf” software

A
  1. less expensive since the cost is shared among all other people buying the package
  2. may contain a lot of unwanted features, and some desirable but non-essentail features may be missing
  3. ready to be installed immediately
  4. well documented, well-tested and error-free
62
Q

features of bespoke software

A
  1. more costly and requires expertise to analyse document requirements
  2. features customised to user requirements and other features can be added as needs arise
  3. may take a long time to develop
  4. may contain errors which do not surface immediately
63
Q

what 5 things need to be considered when selecting an application

A
  1. functionality
  2. hardware – will it run on the current hardware?
  3. availability – already exists or specially written?
  4. cost
  5. reliability – bugs?
64
Q

what are some benefits of proprietary software

A
  • support available from the company
  • regular updates available
  • technical support lines
65
Q

what are the three types of translators

A
  1. assembler
  2. compiler
  3. interpreter
66
Q

what is assembley code

A

low level language - assembly code instructions are mnemonics equivalent to machine code but easier for humans to work with

67
Q

what does an assembler do

A

translates assembly code into machine code or bytecode
- each processor has its own instruction set and so the object code produced will be hardware specific

68
Q

what is bytecode

A

a combination of compiled and interpreted code

69
Q

what is a compiler and how does it work

A

a compiler translates a whole program written in a high level language into executable machine code, going through several stages.
- the object code produced is hardware specific

70
Q

what is an interpreter

A

translates code written in a high level language (JavaScript, PHP) into machine code
- does this line by line rather than translating the whole program before any of it is executed – helps with error diagnosis

71
Q

advantages of using bytecode

A
  1. platform independence
  2. acts an an extra security layer between the computer and program
72
Q

advantages of a compiler

A
  1. object code can be saved on a disk and run whenever required without the need to recompile. however, if an error is discovered the whole program has to be recompiled
  2. faster to execute
  3. object code produced by a computer can be distributed or executed without having to have the compiler present
  4. object code is more secure (needs reverse engineering to view it)
    = more appropriate when a program is run regularly or object code is going to be distributed
73
Q

advantages of an interpreter

A
  1. platform independence = the source code can be run on any machine which has the appropriate interpreter available
  2. if a small error is found, there is no need to reinterpret the entire program
74
Q

what are the 5 stages of complimation

A
  1. lexical analysis
  2. symbol table
  3. syntax analysis
  4. semantic analysis
  5. code generation
75
Q

what happens in lexical analysis

A

puts each statement into the form best suited to the syntax analyser
- all unnecessary spaces and all comments are removed
- keywords, constants and identifiers are replaced with tokens representing their function in the program
- simple error-checking

76
Q

what happens in the symbol table stage

A
  • the lexer will build up a symbol table for every keyword and identifier in the program
  • the symbol table helps to keep track of the run-time memory address for each identifier
77
Q

how and why is a symbol table organised

A
  • lexical analyser spends a great proportion of its time looking up the symbol table so the more organsied it is the faster compiling time is
  • usually arranged as a hash table
78
Q

what happens in the syntax analysis stage

A

language statements are checked against the rules of the language, errors being reported if a statement is not valid
- the stream of tokens from the lexing stage is split up into phrases
- each phrase is parsed which means it is checked against the rules of the language
- if the phrase is not valid, an error will be recorded

79
Q

what is parsing

A

the task of systematically applying the set of rules to each statement to determine whether it is valid

80
Q

what are the syntax rules

A
  • the rules of the language need to be defined
  • syntax rules can be drawn as a diagram
81
Q

what happens in the semantic anlaysis stage

A
  • it is possible to create a sequence of tokens which is valid syntax but is not a valid program
  • semantic analysis checks for this kind of error
82
Q

what happens in the code generation stage

A
  • once the program has been checked, the compiler generates the machine code
  • it may do this in several ‘passes’ over the code because code optimisation will also take place
83
Q

what are the aims of code optimisation

A
  • remove redundant instructions
  • replace inefficient code with code that achieves the same result but in a more efficient way
84
Q

what are the disadvantages of code optimisation

A
  1. increase complimation time
  2. may produce unexpected results
85
Q

what is a linker and what does it do

A

software tool that allows already compiled object code files or modules to be combined with the compiled program. the linker needs to put appropriate memory addresses in place so that the program can call and return from a library function

86
Q

what is a loader and what does it do

A

the job of a loader is to copy the program and any linked subroutines into main memory to run
- when the executable code was created it may assume the program will load in memory address 0
- however, memory addresses in the program will need to be relocated by the loader because some memory will be in use

87
Q

what is a library

A

most languages have sets of pre-written (and pre-compiled) functions called libraries
- a programmer can also write their own libraries
- library functions can be called within a program

88
Q

advantages of library routines

A
  1. tested and error-free
  2. save the programmer time as they don’t need to write code to perform common tasks