# A-level Computing 2009/AQA/Computer Systems, Programming and Network Concepts/Introduction to Computer Systems

Definition of this section is available at , page 16. This text will be expanded shortly

## What is Hardware and Software?

At the highest level, a computer system is composed of hardware and software components. Hardware consists of all the physical devices. All the programs (code) that run on the computer system form the software part. The hardware and software are tightly coupled and they complement each other. Hardware is useless without software and software requires hardware to carry out computations.

## Different Types of Software
### System Software

System software is anything that is an essential part of the computer system; or in other words a software is the artificial intelligence which dictate the rules of operation within its systems.

#### Operating system software

An operating system is the low-level software that acts as an interface between the user and the hardware. The OS provides a "virtual machine" where the user is safe to execute their applications and program code.
Common operating systems include Microsoft Windows, Mac OS X and GNU/Linux derivatives.

#### Utility programs

Utility software helps manage and tune the computer hardware, OS or application software. It usually performs a single task or small range of tasks. Good examples include:
* Archive: utilities take a file or collection of files and output a single file or stream.
* Disk defragmenters: reorganise file structure so that all file fragments are contiguous on the disk. Modern filesystems, such as those used by Mac OS X and GNU/Linux, do not need explicit defragmenting.
* Encryption: utilities use a specific algorithm to encrypt/decrypt the contents of a file or stream using an encryption key.
* Virus scanners: scan for malicious computer program code in files and storage devices.

#### Library programs

A collection of subprograms used to develop software and hardware compatibilities. Libraries contain "helper" code and data for other programs to use in a modular way; they are usually not executable and exist purely to provide services to other programs.

#### Compilers, assemblers and interpreters

A compiler is a computer program that translates code written in a high level language to a lower level language, e.g. assembly language or machine language. The most common reason for translating source code is to create an executable program (converting from a high level language into machine language).
Advantages of using a compiler
* Source code cannot be stolen/copied
* Tends to be faster than interpreting source code
* Produces an executable file, and therefore the program can be run without need of the source code
Disadvantages of using a compiler
* Object code needs to be produced before a final executable file
* The source code must be 100% correct for the executable file to be produced
An assembler translates assembly language into machine language. Assembly language consists of mnemonics for machine opcodes so assemblers perform a 1:1 translation from mnemonic to a direct instruction. Conversely, one instruction in a high level language will translate to one or more instructions at machine level.
Advantages of using an assembler
* Assembly code is often very efficient (and therefore fast) because it is a low level language
* It is fairly easy to understand due to the use of English-like mnemonics
Disadvantages of using an assembler
* Lots of assembly code is needed to do relatively simple tasks, and complex programs require lots of programming time
* Assembly tends to be optimised for the hardware it's designed for, meaning it is often incompatible with different hardware
An interpreter program executes other programs directly, running through program code and executing it line-by-line. This is slower than running compiled code but it can take less time to interpret program code than to compile in then run it — this is very useful when prototyping and testing code.
Advantages of using an interpreter
* Useful for prototyping software and testing basic program logic
* Easy to find errors in source code because the translation will stop when an error is encountered
Disadvantages of using an interpreter
* Source code is required for the program to be executed
* Interpreters are generally slower than compiled programs due to the per-line translation method

### Application Software

Application software is designed for the user to allow them to solve a task. These may include Word processors, spreadsheets and database packages. (NOTE: do not use brand names in the exam, unless asked to, it is better to use the type of software instead, e.g. Excel Spreadsheet package)

#### General purpose

General purpose application software is designed to solve a wide range of tasks, for example:
* Word processor
* Spreadsheet package
* Presentation package

#### Special purpose

Special purpose application software performs a specific task or set of tasks, for example:
* Media player
* Accounting
* Vector drawing

#### Bespoke

Bespoke application software has been written specifically for the needs of a user or company. It is "tailored" to their exact requirements. Some examples might be:
* Air traffic control
* Factory robot
* Tourist kiosk
* etc.

## Introduction to how computers store data

Computers can't understand colours, words and sounds like humans. Even if you use digital cameras and voice recognition, a computer has to translate these inputs into the only language it does understand, that is the language of 1 and 0. This is called binary.
Binary is different from our own decimal numbering system. Instead of having 10 different values like decimals: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 (this can also be referred to as denary or base 10), binary (or base 2) only has 2 values: 0 and 1. A binary digit, or bit as it is more commonly known, can either be set to 0 (off) or 1 (on).
By combining many bits together, we create what are known as "bit patterns". Inside the computer, all data is transmitted and manipulated in bit patterns. Apart from individual bits, the two other most important bit patterns are:
* Byte: This is a quantity of bits that computers tend to use as the smallest sequence of bits to store data, e.g. 10110110. This is eight bits wide on most types of computer, but can vary on more obscure machines.
* Word: This is sometimes called a 'manipulation unit'. It is a set length of bits that varies between types of computers, but is usually 32 or 64 bits long in most modern computers.
* Program: A program is a set of instructions that are processed by the computer to do a specific operation. This could be anything, from adding two numbers and outputting the result, to the complex instructions in the program of a computer game.
* Data: Data (the singular is datum) are raw numbers that have no meaning by themselves. Data could be stored about parts of a video clip, an image, a sound, text or a number.

## What parts make up a computer?

These components are found in virtually every computer:
* Processor: The 'brain' of the computer. It executes instructions sequentially and processes data. The processor is usually divided up into the Arithmetic and Logic Unit (ALU), and the Control Unit. The ALU carries out logical evaluations (for example comparisons), and mathematical expressions (such as addition and subtraction). The Control Unit carries out the functions that organise instructions and co-ordinates all the data and instructions, similar to traffic lights controlling the flow of cars. The processor is also called a Central Processing Unit (CPU).
* Clock: A piece of hardware used to keep the processor (and some other integrated circuits) in time by generating an oscillating signal with a steady frequency.
* Main Memory: This is temporary storage that stores data currently being worked on. It is accessible to the processor directly, without going through any input/output channels. It does, however, need to connect to the processor via the data, address, and control buses. When power is lost, all data stored in main memory is lost, therefore meaning it is volatile. Main memory is also known as Immediate Access Storage (IAS).
* Address Bus: A collection of wires between the processor and main memory used to communicate the physical location (address) of data in main memory.
* Data Bus: A collection of wires between the processor and all internal devices, and is used to send and receive both data and instructions.
* Control Bus: A collection of wires between the processor and devices used to send commands and get status signals from the devices. For example, it could show whether the computer was reading or writing to memory.
* I/O Port: An interface and physical connector that allows peripherals, such as a keyboard, mouse or monitor, to communicate with the 'heart' of the computer system — the processor and main memory. I/O stands for Input/Output.
* Secondary Storage: This is computer memory that is not directly accessible to the processor but uses the I/O channels. It is for storing data not in active use and preserves data even without power, meaning it is non-volatile.
diagram is needed here

## How to run programs

All programs are stored as a series of bit patterns ready to be executed (or "run") by the processor. All modern computer systems use the "stored program concept". This is where program instructions are loaded into main memory for the fetch and execute cycle.
The stored program concept basically states that both instructions and data to be operated on can be loaded into memory at the same time, as opposed to having the instructions pre-programmed into the hardware, and then passing this hardware the data to be processed.
The fetch-execute cycle is the retrieval of data and instructions from main memory through the data bus, and then executing the data or instructions using the processor.
An example of these ideas working together would be when a computer system was required to add two numbers together. A program that adds numbers is loaded into main memory. Then each instruction of the program is fetched and executed one after the other by the processor, along with any data required (in this case the numbers to be added). The processor stores the current instruction in a special register and uses its Arithmetic and Logic Unit to process the instruction.