Chapter 5 | System Software
5.1 Operating Systems
Operating Systems →
An operating system provides an environment to run programs and acts as an interface
to allow interaction with hardware.
Tasks of an OS →
-
User interface provision: Can be CLI (command-line interface), GUI (graphic user
interface) or menu-driven. Allows users to communicate with hardware by making
navigation of the system easier. Provides facility for input and output
-
Program-hardware interface: Ensures hardware does what software wants.
Mechanism for program execution
-
Resource management: Schedules processes and resolves resource conflict
-
Process management: Manages scheduling and handling of processes, multi-tasking,
fair access. Manages which resources are needed for a process. Enables processes to
share information, and prevents interference between processes. Resolves conflicts
-
Memory management: Memory protection ensures two processes don’t use the
same memory. Memory organisation using virtual memory, paging, segmentation.
Memory Usage Optimisation - Decides which processes should be in main memory,
allocates memory to processes, keeps track of allocated memory, and releases
memory when a process stops. Keeps processes separate & ensures fair usage
-
Device/hardware/peripheral management: Handles buffers, queues, interrupts.
Controls usage of hardware by processes. Sends commands and control signals.
Installs drivers
-
File management: Divides storage into file allocation units and allocates storage to
files. Creation of files and other operations like edit, close, read, open.
Naming conventions and directory structures. Controls access mechanisms
-
Security management: Sets up accounts, authentication of usernames and
passwords, access rights, backups, system restore and roll back to previous state.
Anti-malware programs
-
Error detection and recovery: Interrupts a running program, provides diagnostics,
and shuts down system in an organised fashion without data loss if required
-
Interrupt handling: Identifies interrupt priority, saves current memory and process
values, then loads the appropriate ISR
Utility programs →
Might be provided by the OS or downloaded. Relatively small and only 1 purpose e.g.
maintain, analyse, repair, configure system
-
Hard disk formatter: Removes existing data, configures disc for use, initialise tracks
and sectors. Sets up file system, partition disk into logical drives. Installs boot
-
Hard disk defragmenter: Finds files which aren’t contiguous and moves blocks to be
continuous. Collates free space to read faster and reduce head movements
-
Hard disk repair: Checks for errors and inconsistencies. Resolves errors. Retrieve files
and data from damaged disk, recovers the disk and reconstructs the file directory.
Marks bad sectors as unusable to verify integrity and fix logical file system errors
-
Disk cleaner: Finds redundant and unnecessary files. Gives the user the option to
delete if disk getting full
-
Disk space analysis: Visually demonstrate disc usage, by showing sizes of files and
folders
-
Backup software: Copy files automatically and schedule backups. Set-up off-site
backups. Allows the user to pick what is backed up (files changed since last backup,
or all files). May encrypt or restore data
-
File compression: Reduces file sizes using lossy or lossless compression algorithms to
minimise storage requirements and increase capacity
-
Virus checker: Scans files when they enter the system, are downloaded, or when a
memory stick is inserted. Regularly scans files, then isolates, quarantines, or deletes
infected files. Regularly updates virus definitions. Sets up a schedule for virus
checking
Library Programs →
Libraries are pre-written modules - functions and routines - which perform common or
complex tasks. Can be imported and then functions can be referenced in a program.
|
Pros
|
Cons
|
-
Code already written and saves time
-
Code used by many people, thoroughly tested and likely to be error-free
-
Programmer can use mathematical or graphical functions they don’t know
-
Can be sure function will perform as it should and simplifies code
-
Conforms to industry standards and robust
-
Automatic updates improve routines
|
-
Compatibility issues, so libraries might not work with code or may need program to be changed
-
May not meet exact needs → unexpected results
-
Unexpected results/errors if routine is changed
|
Dynamic link library →
The Dynamic Link Library (DLL) consists of self-contained, pre-compiled routines that are
only loaded into main memory at run-time and can be made available to several
applications at once
|
Pros
|
Cons
|
-
Same DLL file used in several programs at once, easing pressure on memory and saving memory space
-
Pre-written saving developer time
-
Pre-tested and reliable
-
Smaller executable file as it doesn’t contain routines
-
Only loaded into memory when needed
-
Changes are done independently and update automatically
|
-
External change to DLL could stop program working
-
DLL file must be present at run-time or error
-
Executable code isn’t self contained as DLL files must be linked at run-time
-
Appropriate linking software must be available at run-time to link DLL files
|
5.2 Language Translators
Languages →
High level language: Resembles natural english language & syntax. One line has many
CPU instructions. Easy to understand but more time to execute
Low-level language: Direct CPU access, but harder to write and understand
Machine code: Consists of binary 1s and 0s. Directly executable and no translator.
Rarely used by humans as it is impossible to read and understand
Translators →
|
Name
|
When is it used
|
How is it used
|
Advantages
|
Disadvantages
|
|
Interpreter
|
Used during development
|
Interpreter program, source code and data made available. Interpreter analyses and reads the first line. If an error is found, it is reported and the program stops. Otherwise, the line is converted to intermediate code and executed. This repeats for all lines
|
Stops at error, easier to debug as errors can be corrected in real-time
Can test part programs
No executable file, so more memory efficient
|
Greater time to execute
Source code not protected
Interpreter always needed to run
|
|
Compiler
|
Used when completed
|
Source code and compiler available. First line read and analysed. If an error is found, it is recorded. Else, the line is converted to intermediate code, and this repeats for the whole program. At the end, if errors are found, an error report is output, else the intermediate code is converted to object and executable file.
|
Produces an executable file, which can be shared without giving source code access.
Faster to run
Don’t need compiler at run-time and don’t need to re-compile
|
Longer analysis time.
More memory to link object code.
Harder to debug errors at end.
Can’t test part programs.
One error induces other false errors.
Won’t run with errors
|
Java →
-
Machine independent: Runs on all platforms and OS
-
Partially interpreted and partially compiled. Compiled by IDE and
interpreted by Java Virtual Machine (JVM)
-
JVM: Interface between OS and program. Each machine has its own JVM based on
hardware and byte codes
-
Optimises code for CPU as machine code file only produced at run-
time
Integrated Development Environments (IDEs) →
An Integrated Development Environment (IDE) is a software with features to edit
programs, translate with interpreter or compiler, write code, and to debug and observe
outputs
Features:
-
Prettyprinting: Indentation, colour-code keywords and comments
-
Context-sensitive prompts: Hints or choice of keywords and available identifiers
appropriate at current insertion point in programs
-
Dynamic-syntax checks: When a line has been typed, performs syntax checks and
alerts programmer to error
-
Expanding and collapsing code blocks: Saves excessive scrolling and focus on section
by expanding a block of code or closing it
-
Automatic indentation: Easily see blocks of code & structure
-
Breakpoint: Stops running code at a set point
-
Single-stepping: Runs through code one line at a time
-
Variable and expressions report window: Shows how variables and expressions
change as program is run
-
Highlight structure blocks, undeclared, unassigned and unused variables
-
Built-in library functions & test editor