Software is the instructions that are processed by the CPU.
Software tells the computer how to do everything, from switching on, allowing you to log in, opening a web page or a word processor document, software provides the instructions for the CPU. Even interactions between the hardware components which allow a printer to produce a document, or a keypress that shows a character on the screen, are made possible by software.
Software provides the essential, invisible interface between the computer hardware and users, see figure below.
Software can be broadly divided into two general categories:
Application software (sometimes called productivity software) allows the user to perform an activity such as creating a document, editing a photo, or creating a web page.
System software is used to manage, maintain, and run the computer itself, including managing the hardware and application software. System software can be divided into two general categories: operating system software and utility software (see figure below).
A computer requires both system software and application software to be useful. System software is required to manage the hardware, and application software is required to make the computer do something useful for the user .
Application software (sometimes also called productivity software) allows users to perform specific tasks, activities, or work.
Word processor
Spreadsheet software
Dabase software
Computer Aided Design (CAD)
Presentation software
Photo editing software
Desktop Publishing (DTP) software
Web browser
Operating systems are a type of system software that manage the computer’s hardware and resources, and manage and control application software.
Roles of the operating system. The operating system (OS) is responsible for managing the hardware resources and the application software that uses them. All computer systems require an operating system. The roles of an operating system include:
Providing an interface. The OS provides the user interface that allows the user to type in commands and run programs. The interface might be a Graphical User Interface (GUI), a Command Line Interface (CLI) where commands are typed, or a touch interface.
Managing files. The OS is responsible for allocating space on secondary storage devices, and managing the creation and deletion of files.
Handling interrupts. The OS receives and processes requests from peripheral devices, known as interrupts. For example, when the printer paper is jammed the printer will send an interrupt to the OS.
Managing peripherals and drivers. The OS uses pieces of software known as drivers to communicate with peripheral devices. Each hardware device such as a printer or a screen will have its own driver software. The OS manages these and ensures they are correctly installed and up to date.
For many modern devices, especially USB devices, the operating system can automatically locate and install drivers as soon as the device is connected.
Providing a platform for running applications. The OS manages the programs that are running on the computer, allowing the user to start or stop programs, and providing programs access to the resources they need (such as RAM).
Managing memory. The OS controls the allocation of RAM to individual programs, including dividing the allocation into pages. If the OS allows multi-tasking, the OS may need to use virtual memory to ensure programs have the required memory. This will involve swapping pages in and out of RAM as necessary.
The OS is also responsible for ensuring that one program cannot access the memory of another program, which would likely cause the computer to crash.
Managing multitasking. Most modern operating systems can run multiple programs at once, known as multi-tasking. The OS is responsible for switching between running tasks, allocating each of them some of the CPU’s processing time.
The process of allocating processor time to tasks is known as scheduling.
Managing user accounts. User accounts allow people to have their own usernames and passwords to log on to a computer system. The OS manages these accounts and ensures that one user cannot access files or resources that he does not have permission to access.
Providing system security. The OS provides general security for the computer. This includes ensuring users cannot access files or resources without the appropriate permission, and ensuring the computer is protected against unauthorised access over the Internet.
Utility software is a type of system software used to perform maintenance and optimization tasks. Unlike operating system software, utility software is not essential, but it does perform a number of important tasks to keep a computer running at its best performance. Some examples of common utility software are:
Compression software. Compression software reduces the space occupied by a file, thus freeing disk space. A common example of compression software is the ZIP utility.
Backup software. Backup software creates copies of important files which can be recovered in the event the original file is lost or damaged. Backup software can often automate the backup process and schedule it to make backup copies at fixed intervals, such as every week.
Disk cleaning software. Disk cleaning software is used to free up disk space by removing unneeded files. These may be temporary files created by applications or certain files that were created during the installation or removal of software.
Anti-virus software. Anti-virus software detects and removes various malicious software that may harm a computer or its data. In addition to scanning files, anti-virus software may integrate with a web browser to check visited web pages or downloads for viruses.
Defragmentation software. Disk defragmentation software reorganises data stored on secondary storage. It arranges the data for each file into continuous sectors of the disk (i.e. sectors that are next to each other). This reorganisation speeds up the process of reading files and thus improves performance.
Encryption software. Encryption software is a type of security software used to make a file unreadable to a person who does not possess the decryption key.
In previous sections you have learnt how hardware is useless without software, and that the operating system manages and controls the hardware. This leaves us with a predicament:
1. The hardware needs to load and run the operating system when the computer is switched on
2. All software – application and system – resides on secondary storage devices
3. Software drivers are required to access any peripheral devices (including storage devices)
This means that a computer has no way of ‘knowing’ how to read data from its storage devices when it is switched on, meaning it would be unable to load the operating system and start up.
The solution for this is relatively simple: a very small piece of software, the firmware, containing only the instructions required to access the secondary storage devices and start loading the operating system, is embedded in the computer’s ROM chip. The ROM is the ideal location for the firmware because ROM is non-volatile and it is not possible to change its contents.
As the firmware helps load the operating system, it is sometimes also called the bootloader. Common names for the firmware included in PCs are the BIOS (Basic Input Output System) and the UEFI (Unified Extensible Firmware Interface).
When the computer is first switched on, the firmware is executed. This instructs the hardware how to access the attached storage devices. The operating system can then be started, running after the firmware. Once the operating system has loaded and is running, application software can be loaded and run.
Test your knowledge
Fill in the blank:
Firmware is software that is stored in the part of the hardware known as the .....................
Select the correct statement:
a) The operating system runs on the hardware; the firmware runs on the operating system; application software runs on the operating system
b) The operating system and application software both run on the firmware
c) The firmware runs on the hardware; the operating system runs on the firmware; application software runs on the operating system
d) The firmware, operating system, and application software all run directly on the hardware
In previous sections you have learnt that the operating system manages all of a computer’s hardware and resources and coordinates the application software. This means the operating system has a lot of tasks and that many aspects of a computer will need to communicate with the OS to request assistance or access to resources. Rather than have the operating system continually ask peripherals and applications if they need anything, a system called interrupts is used. The operating system will continue with its normal work and if a peripheral or an application needs something, it will send a signal known as an interrupt to the operating system. The OS will then suspend its current task and execute an interrupt service routine for the peripheral or application that sent the interrupt. When the interrupt has been serviced, the OS will continue with the task it was performing before the interrupt occurred.
Interrupts can be generated by hardware or software.
Hardware interrupts are generated by hardware devices such as keyboards, mouse, printers, storage devices, and screens. When the OS receives such an interrupt it will suspend its current task and start the appropriate interrupt service routine for the device. Some common examples of hardware interrupts and how they might be serviced are:
Keyboards generate an interrupt when a key is pressed. The operating system’s interrupt service routine will take appropriate action depending on the keypress – for example, passing the keypress to the running application which may then display it on screen. In other cases, special key combinations may cause other tasks to run (e.g. Ctrl-Alt-Delete).
The computer’s mouse will generate an interrupt whenever it is moved or a button is clicked. The operating system’s interrupt service routine will read the state of the mouse (for example, its location or which button was pressed). Appropriate action will then be taken, such as drawing the cursor at a new location on the screen.
Interrupts can also be generated by software, especially when unexpected events occur. In this context they are sometimes known as exceptions. The OS will service a software interrupt in the same way as a hardware interrupt, by suspending the current task and running the interrupt service routine. Examples of software interrupts include:
An application tries to access memory which has been assigned by the OS to another application. This is an error condition which could cause a security issue, so the interrupt service routine will prevent access and potentially shut down the offending program.
An application tries to divide by zero. This is an error condition which the interrupt service routine might deal with by closing down the offending program.
Computer programs can be written in high-level languages or low-level languages, depending on the task to be performed and the computer to be used.
High-level languages enable a programmer to focus on the problem to be solved and require no knowledge of the hardware and instruction set of the computer that will use the program.
High-level languages are designed with programmers in mind; programming statements are easier to understand than those written in a low-level language. This means that programs written in a high-level language are easier to:
read and understand as the language used is closer to human language
write in a shorter time
debug at the development stage
maintain once in use
The following code is written in a high-level language program:
result = num1 + num2;
These are examples of high-level programming languages: C++, Pascal, Python, Visual Basic, JavaScript.
Low-level languages relate to the specific architecture and hardware of a particular type of computer. There are two types:
Assembly language
Assembly language is a form of low-level language that uses mnemonics. Few programmers write programs in assembly language. Those programmers who do, do so for the following reasons:
to make use of special hardware
to make use of special machine-dependent instructions
to write code that does not take up much space in primary memory
to write code that performs a task very quickly
The following code is written in assembly language:
LDA First
ADD Second
STO Sum
In order to understand this program the programmer needs to know that:
LDA means, load the value of the variable into the accumulator
ADD means, add the value of another variable to the value stored in the accumulator
STO means, to store in the variable the value stored in the accumulator
Machine code
Programmers do not usually write in machine code as it is difficult to understand and it can be complicated to manage data manipulation and storage.
The following program adds two numbers and is written in machine code:
0001 00010010
0100 00010011
0000 00011010
The code that programmers write need to be translated into machine code before it can be executed by the CPU. The software used to do this is known as a translator.
The following are types of translators:
An interpreter translates one line of a program into machine code and immediately executes that line of code, before moving on to translating and executing the next line. This process of translation-execution continues until the program ends.
A result of this process is that interpreters can run programs even if these programs contain errors: the interpreter will translate and execute correct code up to the point of the first error, and will then stop and report an error.
Since an interpreter translates code each time a program is run, the interpreter software and the source code are required every time you run the program.
A compiler translates an entire program into machine code, and produces an executable file (sometimes called object code) which can then be run.
If there are any errors in the code the compiler will be unable to translate it and an executable file cannot be produced. This means a compiler will report all errors during the translation process and it will not be possible to execute the program until all errors are fixed.
Once a program has been compiled neither the compiler software nor the source code are required to run the program since an executable file has been produced.
Assembler translates assembly language into machine code.
Compilers
The executable file produced by the computer will execute quicker than interpreted code.
An executable file (object code) is produced which can be executed without the compiler or other additional software.
Interpreters
Code can be tested even if it contains errors, up to the point of the error. This aids debugging.
The edit-test process is faster as there is no need to wait for the compilation process. This can speed up debugging.
Compilers
The compilation process can take time, which slows down testing.
Executable file created by compiler (the object code) is not cross-platform.
Code must be free of syntax errors before compilation can succeed.
Interpreters
Interpretation slows down the execution of code.
Interpreter software is required every time the code is executed.
It is possible to write programs using the basic text editor that is included with many operating systems. However, because these text editors are not specifically written for developing programs, they lack features designed specifically to help programmers. When developing longer, more complex programs or working on projects with multiple files or multiple programmers, using a basic text editor can be very difficult.
An integrated development environment (IDE) is a software application specifically designed to help programmers create software. In the same way that a word processor has features such as spelling and grammar checks, formatting, and layout tools to help create documents, IDEs have tools to help create code. These tools do not write code automatically, but they greatly support the programmer by making the process easier, faster, and less error-prone. These tools can include:
Code editor or text editor allowing code to be typed.
Code formatting including indentation and syntax highlighting, to make code easier to read, also known as ‘prettyprint’.
Auto-complete which offers a list of options when programmers start to type key words.
Auto-correction which corrects minor typing mistakes, similar to auto-correct in a word processor.
A translator (either a compiler or interpreter) built in for convenience.
A run time environment to allow programs to be run and tested within the IDE.
Error highlighting and diagnostics which highlights potential errors in code and provides hints and suggestions about possible solutions.