CS - Unit 2, System Software and Application Generation

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

flashcard set

Earn XP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

22 Terms

1
New cards

Functions of the OS?

User Interface

Memory Management

Interrupt Handling

Processor Scheduling

2
New cards

What is User Interface?

Provides the user with a platform to use to hide the complexities of hardware

Allows user to have their own accounts

Manages what information / files different users have access to

3
New cards

What is Memory Management?

When the OS manages the allocation of RAM to different programs so they can be run

2 techniques:
Paging
- when available memory is divided into fixed sized chunks (pages), each of which has an address
- a process loaded into RAM is allocated sufficient pages, but these pages may not be contiguous
- a page table maps between the logical memory location and physical memory location
Segmentation
- memory is divided into segments (which can be of different lengths)

Some pages of a current process are stored in virtual memory until they are needed (and are then swapped into RAM)

Repeatedly swapping pages can slow down the computer (disk thrashing)

4
New cards

What is Interrupt Handling?

Interrupts can be sent to the CPU by software, hardware, or the CPU’s internal clock
(examples of interrupts: printer runs out of paper, error occurs in a program)

The CPU checks at the end of each clock cycle whether there are any interrupts to be processed. It uses an interrupt service routine (ISR) to process the interrupt

When an interrupt is detected, the CPU stops fetching instructions and pushes the current contents of its registers onto a stack (LIFO data structure)

Interrupts have different priorities and will be processed in order of priority. Interrupts can themselves be interrupted if a new interrupt is of a higher priority, and the original interrupt’s registers will be put onto the stack as well

5
New cards

What is Processor Scheduling?

The OS schedules when each app can use the CPU, giving the illusion of multi-tasking

It aims to: provide an acceptable response time to all users, to maximise the time CPU is usefully engaged, to ensure fairness on a multi-user system

5 scheduling algorithms:
Round Robin (p)
First Come First Serve (FCFS) (n)
Shortest Remaining Time (p)
Shortest Job First (n)
Multi Level Feedback Queue (p)

(preemptive = processes are given a certain amount of time and even if not completed, the CPU moves onto another process
non-preemptive = processes are given unlimited time and can run until completion)

6
New cards

Scheduling algorithms (preemptive)

Round Robin
- each job is allocated (by FIFO) a time slice during which it can use the CPU’s resources. If the job hasn’t completed by the end of its time slice, the CPU moves on to the next job

Shortest Remaining Time
- time to completion is estimated as each new job arrives. The job with the shortest remaining time to completion is executed, meaning that a shorter new job can take over from the current process

Multi Level Feedback Queue
- multiple queues are created with different priority levels. If a job uses too much CPU time, it is moved to a lower priority queue. Processes can also be moved to a higher priority queue if they have waited a long time

(preemptive = processes are given a certain amount of time and even if not completed, the CPU moves onto another process)

7
New cards

Scheduling algorithms (non-preemptive)

First Come First Serve
- first job to arrive is executed until it completes

Shortest Job First / Shortest Process Next
- the waiting job with the smallest total execution time is executed when the current job completes

(non-preemptive = processes are given unlimited time and can run until completion)

8
New cards

What is a Distributed OS?

Coordinates the processing of a single job across multiple computers

A program can be urn by the user that uses data / resources (e.g. processor time, memory) from any other computer

Distribution of tasks is coordinated by OS passing instructions between computers

The user can access more computational power with the illusion of working with a single processor

Benefits:
- no need for training or writing programs differently

Drawbacks:
- programmer has no control over the task distribution as it is all handled by the OS

9
New cards

What is an Embedded OS?

Application programs are held in ROM

Limited amount of RAM

UI is simple and minimal

Examples: washing machine, tv remote, vending machine

10
New cards

What is a Multi-Tasking OS?

A single processor can appear to do more than one task simultaneously by scheduling processor time

(A smart phone is a computer with a multi-tasking OS. Mobile OS are linked to specific hardware. Low level propriety OS is used for handling hardware and special features while the main OS handles user interface and running apps)

11
New cards

What is a Multi-User OS?

Some systems use a very powerful computer called a mainframe

Lots of users with their own terminals access the mainframe CPU and each gets a time slice

12
New cards

What is a Real-Time OS?

Some OS needs to respond quickly to inputs or cope with many inputs simultaneously

Usually seen in safety-critical environments

If a hardware component fails, the OS must have a failsafe to detect this and respond appropriately

There is hardware redundancy - crucial components are duplicated in case one fails 

(Case study: Therac-25 - 1980’s radiation therapy machine with real-time embedded OS. Patients were treated for cancer using radiation, but a programming error meant the machine responded incorrectly to certain real-time inputs, and several people died due to radiation overdose)

13
New cards

WPO the BIOS?

Stands for Basic Input Output System

It boots the computer at start-up (initialises and tests hardware and loads the OS into RAM)

It is stored in ROM

14
New cards

What is a device driver?

A program that provides an interface for the OS to interact with a device

It is hardware dependent and OS specific

The OS does not need to know the specifics of the hardware to be able to interact with it

15
New cards

What is a virtual machine?

Software that is used to emulate a machine

It can be used for running one OS inside another to emulate different hardware

A virtual machine can execute intermediate code (e.g. Java virtual machine executes Java byte code)

16
New cards

What is System Software?

Is needed by the system to control hardware and run applications

Utility programs:
Optimise the performance of the computer and perform useful background tasks
- Disk defragmenter
- Automatic backup
- Automatic updating
- Virus checking
- Compression software

Has libraries and translators (allows programs to use pre-written routines and to be translated into executable code)

17
New cards

What are the Utility Programs (pt 1)

Disk defragmenter:
- Reorganises the magnetic hard drive so that files (that are split across several physical disk locations) are on sequential blocks where possible

Automatic backup:
- Data in permanent storage needs to be backed up regularly and this process can be automated

Automatic updating:
- Runs in the background detecting software update releases and automatically installs them

Virus checking:
- Scans permanent storage for viruses and compares files to known virus definitions
- Has to be kept up to date to be effective
- Uses heuristics (knows what type of behaviour is likely to be used by a malicious program)

Compression software:
- Reduces size of files and is useful for sending large files across the internet

18
New cards

What is Application Software?

Software that performs a task to benefit the user

Off the shelf software is ready made and available to anyone to purchase

Bespoke software is custom created for a specific user (mostly used by businesses)

Open source software allows anyone to access its source code. The software is licensed but free to use. Anyone can modify it and sell but only if the software produced is also open source. Different from freeware - software that is free to use but source code is not available 

Proprietary (closed source) software doesn’t allow access to source code. Users must pay the person / company that owns the copyright for a licence to use the software. There may be restrictions on how the software is used

19
New cards

What are the different translators?

Assemblers translate assembly code instructions into machine code

Interpreters and compilers translate code written in a high level language into machine code

Interpreters do this line by line, however it needs to be there when the program is being executed

Compilers translate the whole program and then the object code produced can be executed without needing the compiler to be present (but is hardware specific)

Bytecode - an intermediate code between source code and machine code. It is interpreted by a bytecode interpreter

20
New cards

Advantages of compilers and interpreters

Compiler:
- Program can be run many times without needing to recompile
- Executable code doesn’t require the translator to run
- Faster to execute
- Compiled code can’t be easily read and copied by others

Interpreter:
- Source code can be run on any machine with the interpreter
- If a small error is found, no need to recompile entire program

21
New cards

What are the stages of compilation?

Lexical analysis:
- Comments and unnecessary spaces are removed
- Keywords, constants, and identifiers are replaced with tokens representing their function in the program

Symbol table:
- The lexer will build up a symbol table for every key word and identifier in the program. This helps to keep track of the run-time memory address for each identifier

Syntax analysis:
- The stream of tokens from the lexing stage is split up into phrases and each phrase is parsed (checked) against the rules of the language
- If the phrase is not valid, an error will be recorded (and reported to the user ???)
- The rules of the language need to be defined

Semantic analysis:
- Checks for errors where there is a sequence of tokens that is valid syntax but not a valid program (e.g.
an identifier is mentioned when it has not been previously declared)

Code generation:
- The compiler generates the machine code
- It may do this in several passes over the code as code optimisation (removes redundant instructions and replaces inefficient code) will also take place

22
New cards

What are libraries, linkers, and loaders?

Libraries - sets of re-written and pre-compiled functions

Linkers - puts the appropriate memory addresses in place so that the program can call and return from a library function

Loader - copies the program and linked subroutines into main memory to run. Memory addresses in the program will need to be relocated by the loader since some memory will already be in use