Unit 2 Systems Software Flashcards
Operating Systems
The term ‘operating system’ refers to a collection of programs that work together to provide an interface between the user and computer. Operating systems enable the user to communicate with the computer and perform certain low-level tasks involving the management of computer memory and resources. Therefore they are essential in devices such as laptops, mobile phones and games consoles. Examples of popular desktop operating systems include Windows and macOS while popular mobile phone operating systems include iOS and Android.
Operating systems are essential to a computer system as they provide the following features:
- Memory management (paging, segmentation, virtual memory)
- Resource management (scheduling)
- File management (moving, editing, deleting files and folders)
- Input/ Output management (device drivers)
- Interrupt management
- Utility software (disk defragmenter, backup, formatting etc.)
- Security (firewall)
- User interface
Paging
Paging is when memory is split up into equal-sized sections known as pages, with programs being made up of a certain number of equally-sized pages. These can then be swapped between main memory and the hard disk as needed. 4Kb each section
Segmentation
Segmentation is the splitting up of memory into logical sized divisions, known as
segments, which vary in size. These are representative of the structure and logical flow of the program, with segments being allocated to blocks of code such as conditional statements or loops.
Virtual Memory
Virtual memory uses a section of the hard drive to act as RAM when the space in main
memory is insufficient to store programs being used. Sections of programs that are not currently in use are temporarily moved into virtual memory through paging, freeing up memory for other programs in RAM.
Issues with Virtual Memory
The key issue with using these three techniques is disk thrashing. This is when the computer ‘freezes’ and occurs as a result of pages being swapped too frequently between the hard disk and main memory. As a result, more time is spent transferring these pages between main memory and the hard disk then is spent actually running the program. This issue becomes progressively worse as virtual memory is filled up.
Interrupts
Interrupts are signals generated by software or hardware to indicate to the processor that a process needs attention. Different types of interrupts have different priorities and how urgent they are must be taken into account by the operating system when allocating processor time. Interrupts are stored in order of their priority within an abstract data structure called a priority queue in a special register known as an interrupt register. It is the job of the operating system to ensure interrupts are serviced fairly by the processor through the Interrupt Service Routine.
Interrupt Service Routine
The processor checks the contents of the interrupt register at the end of each Fetch-Decode-Execute cycle. If an interrupt exists that is of a higher priority to the process being executed, the current contents of the special purpose registers in the CPU are temporarily transferred into a stack. The processor then responds to the interrupt by loading the appropriate interrupt service routine (ISR) into RAM. A flag is set to signal the ISR has begun. Once the interrupt has been serviced, the flag is reset. The interrupt queue is checked again for further interrupts of a higher priority to the process that was originally being executed.
If there are more interrupts to be serviced, the process described above is repeated until all priority interrupts have been serviced. If there are no more interrupts or interrupts are of a lower priority to the current process, the contents of the stack are transferred back into the registers in memory. The Fetch-Decode-Execute cycle resumes as before.
Scheduling algorithms can either be:
- Pre-emptive
Jobs are actively made to start and stop by the operating system.
For example: Multilevel Feedback Queues, Shortest Remaining Time, Round Robin - Non pre-emptive
Once a job is started, it is left alone until it is completed.
For example: First Come First Served, Shortest Job First
Round robin
Each job is given a section of processor time - known as a time slice - within which it is allowed to execute. Once each job in the queue has used its first time slice, the operating system again grants each job an equal slice of processor time. This continues until a job has been completed, at which point it is removed from the queue. Although Round Robin ensures each job is seen to, longer jobs will take a much longer time for completion due to their execution being inefficiently split up into multiple cycles. This algorithm also does not take into account job priority
First come first served
Jobs are processed in chronological order by which they entered the queue. Although this is straightforward to implement, FCFS again does not allocate processor time based on priority.
Multilevel feedback queues
This makes use of multiple queues, each which is ordered based on a different priority.
This can be difficult to implement due to deciding which job to prioritise based on a combination of priorities.
Shortest job first
The queue storing jobs to be processed is ordered according to the time required for completion, with the longest jobs being serviced at the end. This type of scheduling is most suited to batch systems, where shorter jobs are given preference to minimise waiting time. However it requires the processor to know or calculate how long each job will take and this is not always possible. There is also a risk of processor starvation if short jobs continue being added to the job queue.
Shortest remaining time
The queue storing jobs to be processed is ordered according to the time left for completion, with the jobs with the least time to completion being serviced first. Again, there is a risk of processor starvation for longer jobs if short jobs are added to the job queue.
Distributed
This is a type of operating system which is run across multiple devices, allowing the load to be spread across multiple computer processors when a task is run.
Embedded
Built to perform a small range of specific tasks, this operating system is catered towards a specific device. They are limited in their functionality and hard to update although they consume significantly less power than other types of OS.
Multi-tasking
Multi-tasking operating systems enable the user to carry out tasks seemingly simultaneously. This is done by using time slicing to switch quickly between programs and applications in memory.
Multi-user
Multiple users make use of one computer, typically a supercomputer, within a multi-user system. Therefore a scheduling algorithm must be used to ensure processor time is shared fairly between jobs. Without a suitable scheduling algorithm, there is a risk of processor starvation, which is when a process is not given adequate processor time to execute and complete.
Real Time
Commonly used in time-critical computer systems, a real time OS is designed to perform a task within a guaranteed time frame. Examples of use include the management of control rods at a nuclear power station or within self-driving cars: any situation where a response within a certain time period is crucial to safety.
BIOS
The Basic Input Output System is the first program that runs when a computer system is switched on. The Program Counter register points to the location of the BIOS upon each start-up of the computer as the BIOS is responsible for running various key tests before the operating system is loaded into memory
Examples of BIOS
- POST (Power-on self test) which ensures that all hardware (keyboards, disk drives) are correctly connected and functional
- Checking the CPU clock, memory and processor is operational
- Testing for external memory devices connected to the computer
Device Drivers
Device drivers are computer programs which are provided by the operating system and allow the operating system to interact with hardware
Virtual Machines
A virtual machine is a theoretical computer in that it is a software implementation of a computer system. It provides an environment with a translator for intermediate code to run.
Uses of virtual machines include:
- Protection from malware
Malware will affect the virtual machine rather than the device being used. - Running incompatible software
Programs specific to different operating systems or different versions of an operating system can be run within a VM, saving time and money required to purchase the hardware.
A common example is of games consoles being implemented on PCs via a virtual machine.
Virtual machines def
Virtual machines are commonly used to create a development environment for programmers to test programs on different operating systems. The advantage of this is that it saves both the time and money of having to purchase multiple devices solely for testing. However, running intermediate code in a virtual machine can also be considerably slower compared to running low-level code on the device it was designed for.
Applications software
Applications software is designed to be used by the end-user to perform one specific task.
Application software requires systems software in order to run.
Examples: desktop publishing, word processing, spreadsheets, web browsers.
Systems software
Systems software is low-level software that is responsible for running the computer system
smoothly, interacting with hardware and generally providing a platform for applications software to run. The user does not directly interact with systems software but it ensures high performance for the user.
Examples: library programs, utility programs, operating system, device drivers.
Utilities
Utilities are a key piece of system software integral to ensuring the consistent, high performance of the operating system. Each utility program has a specific function linked to the maintenance of the operating system.
Compression
Operating systems provide utilities that enable files to compressed and decompressed. This is used when compressing large files to be transmitted across the Internet and is commonly used to compress scanned files.
Disk defragmentation
As the hard disk becomes full, read/write times slow down. This is because files become fragmented as they are stored in different parts of memory. The disk defragmenter utility rearranges the contents of the hard drive so they can be accessed faster, thus improving performance.
Antivirus
Antivirus is responsible for detecting potential threats to the computer, alerting the user and removing these threats.
Automatic updating
This utility ensures the operating system is kept up to date, with any updates being automatically installed when the computer is restarted. Updates tackle bugs or security flaws so this ensures the system is less vulnerable to malware and hacking threats.
Backup
The backup utility automatically creates routine copies of specific files selected by the user. How often files are backed up is also specified by the user. This means that in the event of a power failure, malicious attack or other accident, files can be recovered.
Open source
Open source code can be used by anyone without a license and is distributed with the source code.
Closed Source
Closed source code requires the user to hold an appropriate license to use it. Users cannot access the source code as the company owns the copyright license
Adv Open source
. Can be modified and improved by anyone
. Technical support from online community
. Can be modified and sold on
Dis Open source
. Support available online may be insufficient or incorrect. No user manuals.
. Lower security as may not be developed in a controlled environment
Adv Closed Source
. Through, regular and well-tested updates
. Company owning software provides expert support and user manuals
. High levels of security as developed professionally.
Dis Closed Source
. License restricts how many people can use the software at once
. Users cannot modify and improve software themselves
Translators
A translator is a program that converts high-level source code into low-level object code, which is then ready to be executed by a computer. There are three types of translator that convert different types of code and work in different ways.
Compiler
Compilers translate high-level code into machine code all at once, after carrying out a number of checks and reporting back any errors. This initial compilation process is longer than using an interpreter or an assembler. If changes need to be made, the whole program must be recompiled. Once code has been compiled to produce machine code, it can only be executed on certain devices - compiled code is specific to a particular processor type and operating system. Code can be run without a translator being present.
Interpreter
Interpreters translate and execute code line-by-line. They stop and produce an error if a line contains an error. They may initially appear faster than compilers as code is instantly executed, but are slower than running compiled code as code must be translated each time it is executed with an interpreter.
This feature makes interpreters useful for testing sections of code and pinpointing errors, as time is not wasted compiling the entire program before it has been fully debugged. Interpreted code requires an interpreter in order to run on different devices. However, code can be executed on a range of platforms as long as the right interpreter is available, thus making interpreted code more portable
Assembly Code
Assembly code is considered to be a low-level language as it is the ‘next level up’ from machine code. Assembly code is platform specific, as the instructions used are dependent on the instruction set of the processor.
Assemblers translate assembly code into machine code.
Each line of assembly code is equivalent to almost one line of machine code so code is translated on almost a one-to-one basis.
Lexical Analysis
In the first stage of compilation, whitespace and comments are removed from the code. The remaining code is analysed for keywords and names of variables and constants. These are replaced with tokens and information about the token associated with each keyword or identifier is stored in a symbol table.
Syntax Analysis
In this stage, tokens are analysed against the grammar and rules of the programming language. Any tokens that break the rules of the programming language are flagged up as syntax errors and added to a list of errors.
Examples of syntax errors: undeclared variable type, incomplete set of brackets.
An abstract syntax tree is produced, which is a representation of the source code in the form of a tree. Further detail about identifiers is also added to the symbol table. Semantic analysis is also carried out at the syntax analysis stage, where logic mistakes within the program are detected.
Optimisation
This stage of compilation searches through the code for areas it could be made more efficient. The aim of optimisation is to make the code faster to execute although this stage can significantly add to the overall time taken for compilation. Insignificant, redundant parts of code are detected and removed. Repeated sections of code may be grouped and replaced with a more efficient piece of code which produces the same result. There is a danger, however, that excessive optimisation may alter the way in which the program behaves.
Linkers
This is a piece of software that is responsible for linking external modules and libraries included within the code.
There are two types of linker:
Static
Modules and libraries are added directly into the main file. This increases the size of the file. Any updates to modules and libraries externally will not affect the program. This means a specific version of a library can be used.
Dynamic
Addresses of modules and libraries are included in the file where they are referenced. When the program is run, the loader retrieves the program at the specified address so it can be executed. The advantage here is that files remain small and external updates feed through to the main file; there is no need to rewrite the code.
Loaders
Loaders are programs provided by the operating system. When a file is executed, the loader retrieves the library or subroutine from the given memory location
Use of Libraries
Libraries are pre-compiled programs which can be incorporated within other programs
using either static or dynamic linking. They are ready-to-use and error free, so save time developing and testing modules. Another advantage of libraries is that they can be reused within multiple programs.
Libraries are often used to provide a specialised range of functions which would otherwise require a lot of time and effort to develop, so save programmers from having to ‘reinvent the wheel’ and instead make use of others’ expertise. Popular libraries provide mathematical and graphical functions.