05 System Software
05 System Software
5 System software
136
5.1
tasks. how these could affect the printing job.
Operating systems
Key terms
CMOS – complementary metal-oxide semiconductor. Hardware management – part of the operating system
Operating system – software that provides an that controls all input/output devices connected to
environment in which applications can run and provides a computer (made up of sub-management systems
an interface between hardware and human operators. such as printer management, secondary storage
management, and so on).
HCI – human–computer interface.
Device driver – software that communicates with the
GUI – graphical user interface.
operating system and translates data into a format
CLI – command line interface. understood by the device.
Icon – small picture or symbol used to represent, for Utility program – parts of the operating system which
example, an application on a screen. carry out certain functions, such as virus checking,
WIMP – windows, icons, menu and pointing device. defragmentation or hard disk formatting.
Post-WIMP – interfaces that go beyond WIMP and use Disk formatter – utility that prepares a disk to allow
touch screen technology rather than a pointing device. data/files to be stored and retrieved.
Pinching and rotating – actions by fingers on a touch Bad sector – a faulty sector on an HDD which can be
screen to carry out tasks such as move, enlarge, soft or hard.
reduce, and so on. Antivirus software – software that quarantines and
Memory management – part of the operating system deletes files or programs infected by a virus (or other
that controls the main memory. malware). It can be run in the background or initiated by
Memory optimisation – function of memory the user.
management that determines how memory is allocated Heuristic checking – checking of software for
and deallocated. behaviour that could indicate a possible virus.
Memory organisation – function of memory Quarantine – file or program identified as being
management that determines how much memory is infected by a virus which has been isolated by
allocated to an application. antivirus software before it is deleted at a later
Security management – part of the operating system stage.
that ensures the integrity, confidentiality and availability False positive – a file or program identified by a virus
of data. checker as being infected but the user knows this
Contiguous – items next to each other. cannot be correct.
Virtual memory systems – memory management (part Disk defragmenter – utility that reorganises the
of OS) that makes use of hardware and software to sectors on a hard disk so that files can be stored in
enable a computer to compensate for shortage of actual contiguous data blocks.
physical memory. Disk content analysis software – utility that checks
Memory protection – function of memory management disk drives for empty space and disk usage by reviewing
that ensures two competing applications cannot use files and folders.
same memory locations at the same time. Disk compression – software that compresses data
Process management – part of the operating system before storage on an HDD.
that involves allocation of resources and permits the Back-up utility – software that makes copies of files on
sharing and exchange of data. another portable storage device.
137
▲ Figure 5.1 An Acorn BBC B (left) and its cassette tape machine (right)
As the hard disk drive (HDD) was developed, operating systems were stored on
the hard disk, and start-up of the motherboard was handled by the basic input/
output system (BIOS). Initially, the BIOS was stored on a ROM chip but, in
modern computers, the BIOS contents are stored on a flash memory chip. The
BIOS configuration is stored in CMOS memory (complementary metal-oxide
semiconductor) which means it can be altered or deleted as required.
The required part of the operating system is copied into RAM – since operating
systems are now so large, it would seriously affect a computer’s performance
if it was all loaded into RAM at once. An operating system provides both the
environment in which applications can be run, and a useable interface between
humans and computer. An operating system also disguises the complexity
of computer hardware. Common examples include Microsoft Windows®, Apple
Mac OS, Google Android and IOS (Apple mobile phones and tablets).
The human–computer interface (HCI) is usually achieved through a graphical
user interface (GUI), although it is possible to use a command line interface
(CLI) if the user wishes to directly communicate with the computer.
A CLI requires a user to type instructions to choose options from menus, open
software, and so on. There are often a number of commands that need to be
typed; for example, to save or load a file. The user, therefore, has to learn a
number of commands (which must be typed exactly with no errors) just to carry
out basic operations. Furthermore, it takes time to key in commands every time
an operation has to be carried out.
138
5
computer and is not restricted to a number of pre-determined options.
For example, the following section of CLI imports data from table A into table B.
It shows how complex it is just to carry out a straightforward operation.
1. SQLPrepare(hStmt,
2. ? (SQLCHAR *) "INSERT INTO tableB SELECT * FROM tableA",
3. ? SQL_NTS):
5.1
4. ? SQLExecute(hStmt);
Operating systems
A GUI allows the user to interact with a computer (or MP3 player, gaming
device, mobile phone, and so on) using pictures or symbols (icons). For
example, the whole of the above CLI code could have been replaced by a single
Table update icon, like the one on the left.
Selecting this icon would execute all of the steps shown in the CLI without the
need to type them.
GUIs use various technologies and devices to provide the user interface.
One of the first commonly used GUI environments was known as windows,
icons, menu and pointing device (WIMP), which was developed for use on
personal computers (PCs). Here, a mouse is used to control a cursor and icons
are selected to open and run windows. Each window contains an application.
Modern computer systems allow several windows to be open at the same time.
An example is shown in Figure 5.2.
139
Memory management
Memory management, as the name suggests, is the management of a
computer’s main memory. This can be broken down into three parts: memory
optimisation, memory organisation and memory protection.
Memory optimisation
Memory optimisation is used to determine how computer memory is allocated
and deallocated when a number of applications are running simultaneously.
It also determines where they are stored in memory. It must, therefore,
keep track of all allocated memory and free memory available for use by
applications. To maintain optimisation of memory, it will also swap data to
and from the HDD or SSD.
Memory organisation
Memory organisation determines how much memory is allocated to an
application, and how the memory can be split up in the most appropriate or
efficient manner.
This can be done with the use of
» a single (contiguous) allocation, where all of the memory is made available
to a single application. This is used by MS-DOS and by embedded systems
» partitioned allocation, where the memory is split up into contiguous
partitions (or blocks) and memory management then allocates a partition
(which can vary in size) to an application
» paged memory, which is similar to partitioned allocation, but each partition
is of a fixed size. This is used by virtual memory systems
» segmented memory, which is different because memory blocks are not
contiguous – each segment of memory will be a logical grouping of data
(such as the data which may make up an array).
Memory protection
Memory protection ensures that two competing applications cannot use the
same memory locations at the same time. If this was not done, data could
be lost, applications could produce incorrect results, there could be security
issues, or the computer may crash.
Memory protection and memory organisation are different aspects of an
operating system. An operating system may use a typical type of memory
organisation (for example, it may use paging or segmentation) but it is always
important that no two applications can occupy the same part of memory.
140
5
organisation used.
Figure 5.4 shows how different applications can be kept separate from each other.
Address Memory
These boundaries mark the 0
upper limits of the operating system
addresses available to each A
application (addresses start
at 0 and end at Z); the Boundary location is at address (A+1)
5.1
boundaries (A + 1, B + 1, A+1
C + 1) are often referred to memory allocated
as a FENCE to application 1
Operating systems
B
Boundary location is at address (B+1)
A FENCE defines the B+1
memory allocated
boundary between the to application 2
operating system and the C
applications; it is not Boundary location is at address (C+1)
possible for an application
to access a memory C+1
memory allocated
location which is lower than to application 3
the FENCE address Z
Upper limit to address value (Z)
Security management
Security management is another part of a typical operating system. The
function of security management is to ensure the integrity, confidentiality and
availability of data.
This can be achieved by
» carrying out operating system updates as and when they become available
» ensuring that antivirus software (and other security software) is always up-
to-date
» communicating with, for example, a firewall to check all traffic to and from
the computer
» making use of privileges to prevent users entering ‘private areas’ on a
computer which permits multi-user activity (this is done by setting up user
accounts and making use of passwords and user IDs). This helps to ensure
the privacy of data
» maintaining access rights for all users
» offering the ability for the recovery of data (and system restore) when it has
been lost or corrupted
» helping to prevent illegal intrusion to the computer system (also ensuring
the privacy of data).
Note: many of these features are covered in more depth elsewhere in this
chapter or in other chapters.
EXTENSION ACTIVITY 5A
While working through the remainder of Chapters 5 and 6, find out all of
the methods available to ensure the security, privacy and integrity of data
and how these link into the operating system security management. It is
important to distinguish between what constitutes security, privacy and
integrity of data.
141
Hardware management
Hardware management involves all input and output peripheral devices.
5 System software
EXTENSION ACTIVITY 5B
Write down the tasks carried out by a keyboard manager when a user types
text using a word processor. Consider the use of buffers and queues in your
answer.
File management
The main tasks of file management include
» defining the file naming conventions which can be used (filename.docx,
where the extension can be .bat, .htm, .dbf, .txt, .xls, and so on)
» performing specific tasks, such as create, open, close, delete, rename, copy,
move
» maintaining the directory structures
» ensuring access control mechanisms are maintained, such as access rights to
files, password protection, making files available for editing, locking files,
and so on
» specifying the logical file storage format (such as FAT or NTFS if Windows
is being used), depending on which type of disk formatter is used
(see Section 5.1.3)
» ensuring memory allocation for a file by reading it from the HDD/SSD and
loading it into memory.
142
5.1
» defragmentation software
» disk contents analysis/repair software
Operating systems
» file compression
» back-up software.
143
5 Any computer (including mobile phones and tablets) can be subject to a virus
attack (see Chapter 6).
There are many ways to help prevent viruses, such as being careful when
downloading material from the internet, not opening files or links in emails
from unknown senders, and by only using certified software. However, virus
checkers – which are offered by operating systems – still provide the best
defence against malware, as long as they are kept up to date and constantly run
in the background.
5 System software
Defragmentation software
As an HDD becomes full, blocks used for files will become scattered all over
the disk surface (in potentially different sectors and tracks as well as different
surfaces). This happens as files are deleted, partially-deleted, extended and
so on. The consequence is slower data access time: the HDD read-write head
requires several movements just to find and retrieve the data making up the
required file. It would be advantageous if files could be stored in contiguous
sectors, considerably reducing HDD head movements.
Note that, due to their different operation when accessing data, this is less of
a problem with SSDs.
Consider the following example using a disk with 12 sectors per surface.
We have three files (1, 2 and 3) stored on track 8 of the disk surface.
sectors: 0 1 2 3 4 5 6 7 8 9 10 11
▲ Figure 5.5
File 2 is deleted by the user and file 1 has data added to it. However, the file 2
sectors which become vacant are not filled up straight away by new file 1 data
since this would require ‘too much effort’ for the HDD resources.
144
5.1
track 8: File 1 File 3 File 1
Operating systems
track 11: File 3
▲ Figure 5.7
If this continues, the files just become more and more scattered throughout
the disk surfaces. It is possible for sectors 4, 5 and 6 (on track 8) to eventually
become used if the disk starts to fill up and it has to use up whatever space
is available. A disk defragmenter will rearrange the blocks of data to store
files in contiguous sectors wherever possible; however, if the disk drive
is almost full, defragmentation may not work. Assuming we can carry out
defragmentation, then track 8 now becomes:
▲ Figure 5.8
This allows for much faster data access and retrieval since the HDD now requires
fewer read-write head movements to access and read files 1 and 3. Some
defragmenters also carry out clean up operations. Data blocks can become
damaged after several read/write operations (this is different to bad sectors). If
this happens, they are flagged as ‘unusable’ and any subsequent write operation
will avoid writing data to data blocks which have become affected.
145
5 While it is sensible to take manual back-ups using, for example, a memory stick
or portable HDD, it is also good practice to use the operating system back-up
utility. This utility will
» allow a schedule for backing up files to be made
» only carry out a back-up procedure if there have been any changes made to a file.
Windows uses File History, which takes snapshots of files and stores them on an
external HDD at regular intervals. Over a period of time, File History builds up a
vast library of past versions of files – this allows a user to choose which version
of the file they want to use. File History defaults to backing up every hour and
retains past versions of files forever unless the user changes the settings.
Mac OS offers the Time Machine back-up utility. This erases the contents of a
selected drive and replaces them with the contents from the back-up. To use
this facility it is necessary to have an external HDD or SSD (connected via USB
port) and ensure that the Time Machine utility is installed and activated on the
selected computer. Time machine will automatically
» back up every hour
» keep daily back-ups for the past month, and
» keep weekly back-ups for all the previous months.
Note that once the back-up HDD or SSD is almost full, the oldest back-ups are
deleted and replaced with the newest back-up data. Figure 5.9 shows the
Time Machine message:
146
5.1
When software routines are written (such as a sort routine), they are frequently
saved in a program library for future use by other programmers. A program
Operating systems
stored in a program library is known as a library program. We also have the
term library routines to describe subroutines which could be used in another
piece of software under development.
Suppose we are writing a game for children with animated graphics (of a
friendly panda) using music routines and some scoreboard graphics.
Well done
Freddie!!
You got 6 right
▲ Figure 5.10
friendly panda
animation routines
147
5 » removes the need to rewrite the many routines every single time (thus
saving considerable time and cost)
» leads to modular programming, which means several programmers can be
working on the same piece of software at the same time
» allows continuity with other games that may form part of a whole range
(in education, where there may be a whole suite of programs, for example)
» allows the maintenance of a ‘corporate image’ in all the software being
developed by a particular company
5 System software
» saves considerable development time having to test each routine, since the
routines are all fully tested in other software and should be error-free.
All operating systems have two program libraries containing library programs
and library routines: static and dynamic.
In static libraries, software being developed is linked to executable code in the
library at the time of compilation. So the library routines would be embedded
directly into the new program code.
In dynamic libraries, software being developed is not linked to the library
routines until actual run time (these are known as dynamic link library files
or DLL). These library routines would be stand-alone files only being accessed
as required by the new program – the routines will be available to several
applications at the same time.
When using DLL, since the library routines are not loaded into RAM until
required, memory is saved, and software runs faster. For example, suppose
we are writing new software which allows access to a printer as part of its
specification. The main program will be developed and compiled. Once the
object code is run, it will only access (and load up) the printer routine from DLL
when required by the user of the program. The main program will only contain a
link to the printer library routine and will not contain any of the actual printer
routine coding in the main body. Table 5.2 summarises the pros and cons of
using DLL files.
148
Key terms
Translator – the systems software used to translate Interpreter – a computer program that analyses and
a source program written in any language other than executes a program written in a high-level language line
machine code. by line.
Compiler – a computer program that translates a Prettyprinting – the practice of displaying or printing
source program written in a high-level language to well set out and formatted source code, making it
machine code or p-code, object code. easier to read and understand.
149
Assemblers
Programs written in assembly language are translated into machine code by
an assembler program. Assemblers either store the program directly in main
memory, ready for execution, as it is translated, or they store the translated
program on a storage medium to be used later. If stored for later use, then
a loader program is also needed to load the stored translated program into
main memory before it can be executed. The stored translated program can be
executed many times without being re-translated.
Every different type of computer/chip has its own machine code and assembly
language. For example, MASM is an assembler that is used for the X86 family
of chips, while PIC and GENIE are used for microcontrollers. Assembly language
programs are machine dependent; they are not portable from one type of
computer/chip to another.
Here is a short sample PIC assembly program:
movlw B’00000000’
tris PORTB
EXTENSION movlw B’00000011’
ACTIVITY 5C movwf PORTB
Find out what stop: goto stop
task this very
short sample PIC Assembly language programs are often written for tasks that need to be
assembly program
speedily executed, for example, parts of an operating system, central heating
is performing.
system or controlling a robot.
150
▲ Table 5.3 Similarities and differences between assemblers, compilers and interpreters
151
computer then executed on another type of computer. of computer and run on another type of computer.
A compiler finds all errors in a program. One error detected It is easier to develop and debug a program using an
can mean that the compiler finds other dependent errors interpreter as errors can be corrected on each line and
later on in the program that will not be errors when the the program restarted from that place, enabling the
first error is corrected. Therefore, the number of errors programmer to easily learn from any errors.
found may be more than the actual number of errors.
Untested programs with errors may cause the computer to Untested programs should not be able to cause the
crash. computer to crash.
The developer needs to write special routines in order to Partial results can be viewed during development,
view partial results during development, making it more enabling the developer to make informed decisions about
difficult to assess the quality of particular sections of a section of code, for example whether to continue,
code. modify, or scrap and start again.
End users do not have access to the source code and If an interpreted program is purchased, end users have all the
the run-time libraries, meaning they are unable to source code and the run-time libraries, enabling the program
make modifications and are reliant on the developer for to be modified as required without further purchase.
updates and alterations.
▲ Table 5.4 Pros (blue cells) and cons (white cells) of compilers and interpreters.
Source code:
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
152
Source code:
print ("Hello World")
Bytecode:
1 0 LOAD _ NAME 0 (print)
2 LOAD _ CONST 0 ('Hello World')
4 CALL _ FUNCTION 1 (1 positional, 0 keyword pair)
6 RETURN _ VALUE
EXTENSION ACTIVITY 5E
Visual Basic also has an interpreter for bytecode. Find an example of
bytecode for Visual Basic. See if you can find the bytecode for displaying
‘Hello World’ on the screen as in the Python example above.
EXTENSION ACTIVITY 5F
In small groups investigate different IDEs. See how many different features
are available for your group’s IDE and identify which programming
language(s) are supported. Compare the features of the IDE investigated by
your group with the IDEs investigated by other groups in the class.
153
5 »
»
»
a source code editor
a compiler, an interpreter, or both
a run-time environment with a debugger
» an auto-documenter.
Source code editor
A source code editor allows a program to be written and edited without the
need to use a separate text editor. The use of an integrated source code editor
5 System software
context sensitive
prompt offering
text completion
5
is being typed in to the source code editor and alerts the programmer at the
time, before the source code is interpreted. Many errors can therefore be found
and corrected during program writing and editing before the program is run.
Logic errors can only be found when the program is run.
For larger programs that have more than one code block, some code blocks can
be collapsed to a single line in the editor allowing the programmer to just see
the code blocks that are currently being developed.
Compilers and interpreters
source program
run-time environment
▲ Figure 5.14 PyCharm IDE showing both program code and program run
With PyCharm there can be more than one interpreter available for different
versions of the Python language. The program results are shown using the
run-time environment provided.
A run-time environment with a debugger
A debugger is a program that runs the program under development and aids
the process of debugging. It allows the programmer to single step through
the program a line at a time (single stepping) or to set a breakpoint to stop
the execution of the program at a certain point in the source code. A report
window then shows the contents of the variables and expressions evaluated at
that point in the program. This allows the programmer to see if there are any
logic errors in the program and check that the program works as intended.
single step
155
▲ Figure 5.15 PyCharm IDE showing the report window after line 2 (page 155) and after
line 4 (above)
Each variable used is shown in the report window together with the type and
the contents of the variable at that point in the program. The top variable
shown is the last one that was used.
Answers to calculations and other expressions can also be shown.
▲ Figure 5.16 PyCharm IDE showing the report window with the answer to an expression
156
ACTIVITY 5B
1 a) i) Describe the difference between a compiler and an assembler.
ii) Describe the difference between a compiler and an interpreter.
b) State two benefits and two drawbacks of using an interpreter.
2 A new program is to be written in a high-level language. The programmer
has decided to use an IDE to develop the new program.
a) Explain what is meant by an IDE.
b) Describe three features of an IDE.
End of chapter 1 A programmer is writing a program that includes code from a program library.
questions a) Describe two benefits to the programmer of using one or more library
routines.[4]
b) The programmer decides to use a Dynamic Link Library (DLL) file.
i) Describe two benefits of using DLL files. [4]
ii) State one drawback of using DLL files. [2]
Cambridge International AS & A Level Computer Science 9608
Paper 12 Q8 November 2016
2 a) The operating system contains code for performing various management
tasks. The appropriate code is run when the user performs actions.
Copy the diagram below and connect each OS management task to the
appropriate user action. [3]
➔
157
b) A user has the following issues with the use of his PC.
State the utility software which should provide a solution.
i) The hard disk stores a large number of video files. The computer
frequently runs out of storage space. [1]
ii) The user is unable to find an important document. He thinks it
was deleted in error some weeks ago. This must not happen again. [1]
iii)The operating system reports ‘bad sector’ errors. [1]
iv) There have been some unexplained images and advertisements
appearing on the screen. The user suspects it is malware. [1]
Cambridge International AS & A Level Computer Science 9608
Paper 11 Q6 June 2017
3 File History and Time Machine are examples of back-up utilities offered as part of
two different operating systems.
a) Explain why it is important to back up files on a computer. [2]
b) One of the features offered by both utilities is the possibility of
‘turning back the internal computer clock’.
Explain why this is an important feature and give two occasions when a
user may wish to use this feature. [4]
c) By using diagrams and written explanation, describe how defragmentation
software works. [4]
4 Assemblers, compilers and interpreters are all used to translate programs.
Discuss the different roles played by each translator. [6]
5 State four features of an IDE that are helpful when coding a program. [4]
158