0%(1)0% found this document useful (1 vote) 136 views20 pagesChapter 4 Software
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Te nua molt
rat
+ explore the different types of software that run on computers
‘+ understand the role and function of an operating system in a computer
+ explore the different types of programming language
+ describe and use the software used to write a computer program
+ Ieam about the software used to translate program code,
‘Work in pairs to make a list ofall the different pieces of software that you have
used. Can you think of a way to categorise these picces of software?
For example, by what they do er how they are used?
As a class create a mind-map of the different programming languages that you
have used, or come across. Discuss whether any of these have specific uses, or
do they allow for any type of program to be written?
DEVELOPMENT OF PROGRAMMING LANGUAGES
The very first programmable digital computer was developed during World
‘War 2 in the United States of America; the Electronic Numerical Integrator and
‘Computer (ENIAC). Its purpose was to perform calculations faster then a
human, Itallowed the storage of « 10-digit number and could perform addition
and subtraction. This computer could only perform the task it was designed to
perform,Figure 4.1: The ENIAC
From this, assembly language was created that allowed a user to write a
program that could then be converted into binary code (see binary
interpretations in Chapter 1). These languages required the user to state which
memory locations were being accessed (for example, store the data in memory
location 3, access the data from memory location 4. This takes a lot of
expertise o write a long program), Each program had to be written to the
assembly language of the computer it was to run on, If you wanted the same
program on two computers from different manufacturers, or different versions,
then you would have to write the program again in that computer's language.
Figure 4.2: Close-up of an original computer similarto a Turing machine
Fortran was the first significant high-level programming language first released
in 1957 by IBM, This was different from previous languages because it was the
first language that did not require the user to write in assembly language. It
used more user-friendly commands that were then converted into code that
could be run, Another benefit of this new language was that it was not
‘machine-dependent, you could write a program on one computer, and run it on
an entirely different one.
Discussion questions
1 Can you think of any more problems that can arise from only writing
programs in assembly language?
How has the development of programming languages impacted the use of
computers?4.1 Types of software
‘Computers nced software to allow the user to do something useful. You will use
software each time you use & computer, whether this is @ PC, a laptop, tablet or | =: |
‘mobile phone. Software is a series of instructions that tell the computer what to dd
created using programming languages.
System Application
Hardware >| >|
software software
Figure 4.3: System software manages the running of hardware; application software
runs on top of system software
Software can be put into different categories, depending on their purpose and use
(Figure 4.3 shows the link between hardware and software),
System software manages the running of the hardware and other software, and
allows communication between these components. These are tasks that help the
computer perform its functions and improve or maintain its efficiency. Two types of
system software are the operat
system (OS) and utility programs.
Examples of utility programs are not required but useful to know. These are
programs that maintain the computer system, for example:
the user, for example, write a letter, view a website, etc.
‘System clean-up-searches for and removes un-used programs and data.
Defragmentation-rearranges files so that they are located together
(contiguously) and that the free spaces is located together.
a Application software allows the user to perform a task — it provides the services for
£5
Application software have generic names, as well as the brand names. It is important
that you know the generic names, some of the common ones are:
Aword processor allows the user to create written documents.
A spreadsheet allows the user to perform calculations on data,
A database allows the user to store and search a set of data,
A web browser allows the user to view and navigate websites,
PCs, laptops, tablets and smartphones all have application software. The brand.
znames may be different, but the fundamental purposes are the same. For
example, you can open a word processor on a PC, a laptop, a tablet and even a
smartphone,
L_
———ices come in many different forms
‘The application software cannot run on a computer without an operating system,
‘The operating system cannot run unless there instructions given to it, these are
provided by the firmware, The firmware cannot run unless its told to run, this is
done using the bootstrap program, which is loaded when the computer first turns
‘on, This process ean be represented as shown in Figure 4.5 below.
Application software
runs on
y
Operating System
runs on
' B
Firmware
is loaded by the
y
Bootstrap
‘The softwere on a computer,
ACTIVITY 4.1
Log onto a computer, tablet or mobile phone. Make a list ofthe different types
of application software that are installed. Remember not to use brand names.4.2 Operating system
An operating system (OS) is an example of system software, you may be familiar
with brands such as Windows, Linux and macOS for PCs and laptops. Other
computers also have operating systems, for example, a mobile phone may have an
Android OS, or iOS. The overall purpose of these operating systems is to allow you,
the user, to interact with the hardware
‘The OS has many different roles that are described in the Following sections.
Providing an interface
‘The OS allows the user to enter data, and outputs data to the user, all through the
terface. There are different types of interface:
+ Graphical User Interface (GUI) has windows, icons, menus and pointers
WIMP). It is what you will be familiar with from PCs, mobile phones, ete.
This is most useful for novices because itis often intuitive, An example is
Windows.
(crface requires the user fo enter text as commands. This is
most useful for expert users because the commands entered must be exact. An
example is Linux,
+ Anatural language interface allows the user to enter any text commands, or
speak commands, The OS then analyses what has been entered and performs
the action,Figure 4.7: An image of a commend prompt.
COMPUTER SCIENCE IN CONTEXT
Have you every spoken a command to a computer? For example, Amazon’s
Alexa, Microsoft’s Cortana or Apple's Siri? These are examples of natural
language interfaces. You do not have to speak specific commands, the
programs analyse the words you have said and decide on a response. There is
a more about how this is done in Chapter 6, 5
Managing files
A.user will use application software to create files. The OS allows the creation of
directories that the files ean be stored within. It also allows the user to move files,
copy files, delete files, name and rename files, plus many other actions such as
sorting by date.
Managing peripherals and drivers
Accomputer cannot be used without input and output devices. These are called
peripherals. Anyone can build a peripheral, and it will be programmed by the
person who made it — not the developer of the OS, This means that it may not be
compatible (for example, it may use a different interpretation of binary). A driver is
software that translates data from the computer to the peripheral, and vice-versa, The
(08 allows the installation of these drivers and the sending of data to and from it.
Managing memory
A. computer uses memory to store data, This ean be using secondary or
primary memory.
The OS manages the movement of data to and from hardware, primarily RAM. It
also checks the processes being carried out and makes sure that they have enough
memory allocated to perform their function. The OS will also make sure that two
processes do not try and access the same memory location,Managing memory
A computer uses memory to store data. This ean be using secondary or
primary memory.
‘The OS manages the movement of data to and from hardware, primarily RAM. It
also checks the processes being carried out and makes sure that they have enough
memory allocated to perform their function. The OS will also make sure that two
processes do not ry and access the same memory location,
Figure 4.8: RAM memory modules
Managing multitasking
‘A single processor can only ever execute one instruction ata time. The processor
docs this so fast that it appears to be doing several tasks at once. For example, you
might be listening to music from 2 computer, typing a document into a word
processor, and the computer is outputting what you are doing, The OS allows this to
happen by deciding which processes should be executed next and how long they ean
spending processdbefore switching to another proces. The OS desis using,
interrupts.
Managing interrupts
An interrupt isa signal sent to the processor to tel it that something needs its
attention, The OS decides which interrupt to run and then performs the actions
required. There is more about interrupts in Section 4.3.
Providing a platform for running applications
Application software needs to run on a computer. The software could be written by
anyone using any language. The OS allows the application software to run on the
computer by fetching instructions from it and executing them,
Managing user accounts
Most computers need a user to set up an account. This ean include preferences, as
well as a username and password (text and/or biometric). The OS allows a user to
set-up an account, Keeps the data separate for multiple accounts, and restricts the
access by using the password,4,3 Interrupts
_An interrupt is a signal to the processor to tell it that something needs its attention
‘An interrupt can be software or hardware based. Table 4.1 has several examples
ofeach,
Division by 0. Data input, eg. key pressed on a
keyboard, mouse click.
‘Two processes attempting to access the | Etror from hardware, e.g. printer out of
same memory location. Paper.
Program request for input. Hardware failure
[Output required Hiard drive signal that ithas read data.
Data requited from memory. New hardware device connecied.
‘Table 4.1: Interrupt examples
An interrupt has a priority level. A high-priority interrupt needs the attention
quickly, for example, hardware failure. A low-priority interrupt needs the
processor but it’s not urgent, for example, data input, This is managed by the
interrupt handler (1H),
When an interrupt is generated it is put in a queue according to its priority
‘The sequence of activities is
+ When the processor finishes its current fetch-decode-execute cycle (or before
the starting the next FDE cycle), it checks the interrupt queue.
J+ Itchecks whether there is an interrupt with a higher priority than the current
tusk itis processing.
+ itis, it
+ Stores the current process and fetches the interrupt.
+ Checks the source of the interrupt.
+ Calls the relevant interrupt service routine (ISR).
instructions that handle the interrupt.
his is a sequence of
+ When finished the stored process is retumed to memory or another higher
priority interrupt is fetched
‘+ Ifitisn’t, it rans another FDE eycle.
Questions
1 Givetwo examples of application software
2 State the purpose of system software,
3 Describe the relationship between application software and the bootstrap.
4 domtfy three tasks the file management of an Operating System can perform.
Give two examples of software interrupts, and two examples of hardware
interrupts,
6 Describe the process that happens when an interrupt is sent to the processor,4.4 Types of programming language
When you are writing computer programs you will make use of specific software|
that allows you to write, edit, test and run the programs you write
Programming languages can be categorised as high-level and low-level.
High-level
A high-level language uses human-language style words. These could be English
words that we recognise and use day-to-day. For example, if, while, output, print,
input; as people we understand these, but they are also high-level language
instructions. You will be learning to use a high-level language, for example, Python,
Java and VB.NET.
Here are some examples of high-level language statements:
Python:
print("This is a high-level language
statement")
VB.NET:
Dim x as integer
x = Console.readline()
Java:
numl = 10;
num2 = 5;
num3 = numl + num2;
| pice ent language is considered portable: you can i
‘write a program on one computer, and run it on a different computer.
che annem”
Figure 4.9: Code written in a high-level language
Low-level
There are two main types of low-level language, machine code and assembly
language._Acdinpatee executes machine Cede, ths isin biaty (ls wid 0) IF you wile
program in a high-level language it needs to be converted into machine code
before it can executed. Different computers may have different machine code
(for example depending on ie manufactures). This means that machine codesis
non portable; you can write a program in machine code and it may not run on a
different computer.
An example of machine code is: 01100110
Assembly language is an in-between stage. It uses mnemonics to represent code, for
example, to store data in a memory location it may use the mneumonic STO. This is
a mid-way stage. Each high-level language statement is converted into assembly
language instructions, which are then converted into machine code
Figure 4.10: Machine code
Examples of assembly language are:
LDD count
ADD 1
STO count
In assembly language, the program has to state which memory locations are being
used. In the previous example, LDD count, the count is the memory location.
One high-level language statement may need several assembly language
instructions. The previous three assembly language instructions are the same as the
single high-level language count = count + 1
Assembly language instructions are split into operators and operands. Find out
what an operator and an operand is. Find some examples of each.Choosing a language
High- and low-level languages have their own benefits end drawbacks. Some of
these are shown in Table 4.2
Easier for users (humans) to
funderstand, read, write, amend,
[More difficult for users to understand, read, write
land amend,
Easier for users (humans) to
debug code,
Harder for users to debug code
Portable, machine independent.
[Not portable, machine dependent.
Itmust be converted into a low=
level language before it can be
[Machine code does not need converting.
Assembly language must be assembled before
Jexecution, but this is faster than from a high-
level language
[One statement can represent
many low-level instructions.
[Several instructions are needed for each high-
evel language statement,
[Cannot directly manipulate the
hardware.
[Can directly manipulate the hardware, e.g
writing to specific memory locations. This can
make the program more efficient in terms of
speed and memory usage.
‘Table 4.2: Benefits and drawbacks of high- and low-level languages
Questions
>: Destxibewintiaceanthy ahigh keel engage
8 Three examples of program code are given. Identify whether each example is
high-level language, assembly language, or machine code.
Dx 10
INC
STO 10
valuel = input ("Enter
value")
jprint(valuel + 1)
01100011
11000011
10101010
9 Harry needs to write a utility program that uses as little memory as possible.
Give the most appropriate type of programming language Harry should use
and justify your choice.4.5 Translators
In Section 4.4 you learnt that high-level language programs, and assembly ~e EG
programs, need to be converted to machine code to be executed. This is done us!
Assembler
If you have a program written in assembly language, then an assembler is used to
convert the instructions into machine code for the processor the code is being run
on,
Interpreter
s and compilers
If you have written a program in a high-level language then you can use an
interpreter or a compiler to translate the instructions.
‘An interpreter:
+ reads one line of the high-level language code
+ checks that itis syntactically correct:
+ ifit is not, it stops and reports an exror to the user
+ Ifitis, it executes the statement and moves to the next
Interpreters are most useful when wri
the program, because it will stop at an
crror, allow you to correct it, and then continue executing from the same position,
Interpreters are not as useful for whole-system testing, or when the program is
complete, This is because all of the code needs to be interpreted every time the
program is run, even if there are no errors.
Acompiler checks all the code, by going through one-line after the other. there are [pg
any syntax errors, they are all reported to
IF there are no errors, then an exeeutal
the user and the program is not executed.
le is created. An executable file uses
intermediate or object code derived from the high-level language code. The actual
program code is not included so if someone bas the executable file, they cannot view
‘or amend the original code. The executable file can be run without having to re-
translate the code,
‘Compilers are useful when you have finished the program or need to testa working
element repeatedty, This is because the code does not need to be translated each
time, the executable file is run repeatedly.
‘Table 4.3 shows the comparisons of interpreters and compilers
Translates one line of code into machine
Jcode and then executes (runs) it.
Translates all lines of code into machine
code, before executing the program.
[Reports a syntax error as soon as it is
picked up, and stops the program
running until corrected.
Reports all syntax errors at the same
time, the program is not run until all
Jerors are corrected.
Usefull when writing a program.
Usefil when a program has been
finished and is ready for testing or
distibution,
[Code needs to be re-translated each time
the program is run
[Code does not need re-translating each
time the program is run.
Does not produce an executable file.
[Produces an executable file
[Source code is required to run the
program,
Source code is not required to run the
program, only the executable fileInterpreter software is required to run [No other software is required to run the
the program. executable file
You can test part ofa program without | You need to have finished a section of JM
completing ital code before testing it x
‘Table 4.3: Comparison of interpreters and compilers
Example
Saria is writing a computer game program that allows a character to move through
different worlds collecting coins,
‘Which translator should Saria use when writing the code?
+ Iris more appropriate to use an interpreter. This will allow her to see when an
error is identified, correct it and then continue running the program from the
same position,
+ compiler can be used, but then all the errors would appear at the start and she
‘would need to correct all of them before seeing how any of her program nuns.
+ An interpreter is considered more appropriate, but you could justify the use of a
compiler in this situation,
Which translator should Saria use once she has finished programming the computer
‘game and wants to sell it to users?
+ Acompiler should be used, because she can produce an executable file
‘There should be no syntax errors at this point, so correcting the code line-by-
line is not required. The executable file can be distributed to people and they
can then run the program without need to retranslate the instructions every
time, The executable fie also means that no-one will be able to see her code, so
itis protected.
‘+ An interpreter would not be an appropriate choice here, because the end user
‘would need the interpreter software and the source code, and will need to wait
for it to be interpreted each time. It also means the users can access the source
code, and then copy it or change it
ACTIVITY 4.3
Write a computer program in a language that uses an interpreter, and one that
uses compiler. You might need to use a different programming language for
each one, For example, Python usually has interpreters, whilst VB.NET and
Java usually have compilers. Which translator did you prefer to use?”
Peer assessment
Discuss the reasons why you preferred the translator you chose. Did anyone
zzive you some reasons that you hadn’t thought of? Can you expand your own.
answer any further?
Sent eanen
JUSTIFYING CHO
Inan exam you may need to make a decision and then justify your choice. To
answer this type question you will need to consider the context of the question
and how each of the possible choices will impact the context. When you are
Justifying your decision you need to relate every reason back to the scenario.
Consider the choice of translatorWrite a computer program in a language that uses an interpreter, and one that
uses a compiler. You might need to use a different programming language for
each one, For example, Python usually has interpreters, whilst VB.NET and
Java usually have compilers, Which translator did you prefer to use?
Peer assessment
Discuss the reasons why you preferred the translator you chose. Did anyone
give you some reasons that you hadn't thought of? Can you expand your own
answer any further?
M
eater
JUSTIFYING CHOICE
In an exam you may need to make a decision and then justify your choice. To
answer this type question you will need to consider the context of the question
and how each of the possible choices will impact the context. When you are
justifying your decision you need to relate every reason back to the scenario.
Consider the choice of translator,
An interpreter is most useful during
fhe development of a program because:
+ you can fix errors in realtime
+ the program will stop at cach error to allow you to fix it
+ you can nun small sections of the program when incomplete
‘A-compiler is most usefil when a program is complete because:
+ itproducesa .exe file
+ the program does not need to be interpreted each time it is run
+ the program can be distributed without the source code.
ria is writing a computer program,
‘Why is it more appropriate for Saria to use an interpreter while writing a
program?
Why is it more appropriate for Saria to use a compiler when the program is
complete?4.6 Integrated Development Environment (IDE)
‘When you write 2 computer program you will most likely use an Integrated
Development Environment (IDE). This is a piece of software that includes an
‘editor for you to enter and amend your code. This editor may include other features
such as:
+ Aut
to select the correct one,
mpletion; you start typing a command and it suggests options for you
+ Auto-corrections if you spell a command incorrect it changes it to what you
meant to type.
‘+ Prottyprint; this changes the colour of words, e.g. commands and identifiers.
This helps you spot key terms and whether you have entered them correctly or
not.
‘+ Block minimising: you can make sections of code, e.g. procedures, minimised
so there is less code to read through.
‘The IDE will also include the relevant translator, that you can select to translate the
code, It will also provide a run-time environment; this is where the outputs from
the executed code is displayed, it ean be a command line or GUI depending on your
language and the eode entered
An IDE can also provide debugging features, or error diagnostics, these help you
find the problems in your code. Some examples are:
+ Break points; the user sets these points and the code stops running on that line.
‘This lets you check the values and output from the code to that point.
‘Variable watch window; the values of the variables are displayed while the
code is running. so they can be checked whether they are correct
Stepping; the program will run one line ata time, and the user has to tell the
program to move on to the next line, so it can be checked line by line
You can write and run programs without an IDE, You ean write your eode in a basic
text file without any formatting, and then run it (usually) through a command line
interface by entering the correet instructions. An IDE is much more user friendly,
‘ith lots of tools to help you write, amend and correct your code.
oN TaU Ne ASOT eNO TSO NG TENG)
‘You may not always get a choice of whether to use an interpreter or a compiler.
Ifyou use an IDE (Integrated Development Environment) it will probably
come with one, or the other. If your IDE has an interpreter and you want to
‘make an executable then you might need to download another IDE to compile
it
ACTIVITY 4.4
Open up the IDE that you use to write programs. Identify the features that are
mentioned in this chapter. Are there any different ones? If so, find out what
ese do.
isa ene
‘After completing Activity 4.4, it can be helpful to think about how you
approached it and ways you could improve your research skills for future‘come with one, or the other. If your IDE has an interpreter and you want to
make an executable then you might need to download another IDE to compile
‘mentioned in this chapter. Are there any different ones? If so, find out what
these do,
REFLECTION
After completing Activity 4.4, it can be helpful to think about how you
approached it and ways you could improve your research skills for furare
activites
1 Discuss how you approached the investigation of the features. Did you
test out the features, of search the internet to find out what they did? Do
‘you think your approach was the most appropriate? Would you try a
different way if the activity was repested?
2 Discuss how this activity has helped you to identity the features. Does
practically using them help you to remember them?
Questions
10. Narav three perf tanaiatn:
1 Nasratis writing « program in a high-level language that she wants to sell to
make money. Identify when Nasrat could use an interpreter, and when she
could use a compiler. Justify your decisions.
12 Describe two features of an IDE that help the user to test the program they
have written,
Question 11 required you to justify your choice. Did you give generic points,
fr did you relate each point you made to the scenario in the question? When a
context is given, always try and go back to the question each time.SUIS,
[Software is created using programming languages. Tr
[Two types of software are application and system software.
[The Operating System performs many functions including memory
management, handling interrupts and providing an interface.
[An interrupt is a signal sent to the processor to get ils attention,
A high-level language uses English-like terms that need translating before it
[can run and a low-level language is assembly or machine code.
[Assembly language is tumed into machine code using an assembler. High-
evel languages are turned into a low-level language using a compiler or
interpreter,
[An IDE helps the user write, test and run program code.EXAM-STYLE QUESTIONS.
1 Tick one box in each row to identity if the software is an example of
system software or anplication software.
[System software [Application software
Word processor
Defragmentation
Operating System
[image manipulation
[System clean-up
Database
[Web browser
[Spreadsheet 151
2 State what is meant by an interrupt. PI
3 Describe the difference between system software and application
software using an example of each, BI
4 Am operating system performs memory management,
a Describe memory management, BI
ee ee eee 11
(Total: 51
'S _Aprinter sends an interrupt to the computer to say that itis out of.
paper. Describe the stages involved in the processor handling the
interrupt, 151
6 The following sentence describes the requirements for application
software, Fill in the missing gaps.
software runs on the aes
«this runs on the firmware, and itis
Toaded by the ose seen nen pl
‘The applic
7 Quis writing « program using a high-level languaye.
Describe what is meant by low-level language, and high-
level language. 141
b Explain why a person will usually write a program using a
high-level language and not a low-level language. BI
© Give one reason why a person might prefer to write a
program using 2 low-level language. i}
@ Qui nceds to use a translator while writing the program, State
what type of translater Qui should use, justify your choice. BI
© Quiiuses the translator in his Integeated Development
Environment (IDE),
Describe the other features of an IDE that Qui can use to
‘write and test his program. 161‘State what is meant by an interrupt. re
‘Describe the difference between system software and application
software using an example of each,
An operating system performs memory management.
a Describe memory management. BI
b Give rwo other functions of an operating system. 2
{Ta
A printer sends an interrupt to the computer to say that itis out of
paper. Describe the stages involved in the processor handling the
interrupt. 15)
‘The following sentence describes the requirements for application
software. Fill in the missing gaps.
The application software nuns on the eels,
«this runs on the firmware, and itis
loaded by the pI
Qui is writing « program using a high-level language.
a Describe what is meant by low-level languoge, and high-
level language. 141
b Explain why a person will usually write a program using a
high-level language and not a low-level language. BI
© Give one reason why a person might prefer to write a
program using 2 low-level language. uy
4 Qui needs to use a translator while writing the program. State
‘what type of translator Qui should use, justify your choice. [3]
© Qui uses the translator in his Integrated Development
Environment (IDE).
Describe the other features of an IDE that Qui can use to
‘write and test his program. 161
otal: 17]
Explain the role of the operating system in a computer aSELF-EVALUATION CHECKLIST
describe the difference between
application and system software.
eon
is
[describe the role and basic functions of an
operating system,
describe how hardware, firmware and an
loperating system are required to run
application software,
[describe the role and operation of
interrupts.
[describe the characteristies, advantages
and disadvantages, of high-level and low-
Ievel languages.
doseribe the use of an assembler, compiler
and interpreter.
describe the advantages and disadvantages
lof'a compiler and an interpreter.
describe the use of, and features of, an
IDE.