Computer Architecture

 

Computers in History

The first computer that was ever invented in recordable history was designed by the Chinese in around 5000 BC. This computer is still used today and is known as an Abacus. It is only in the past two hundred years that computers have started evolving in any big way – especially in the past 100 years.

The main definition of a computer is: A machine that accepts data as input processes the data according to its purpose and presents the output as useful information. Data can therefore be seen as raw unprocessed information and information is that which we as human beings can comprehend.

These days’ computers have become an integral part of our lives both in business as well as in our personal lives. It is therefore very worthwhile to be familiar with the way they work, especially if you want to program them to do specific things. In this chapter we are going to look at the fundamental way in which these machines actually work so that you can make informed choices when in comes to writing more complex programs.

These days’ computers have become an integral part of our lives both in business as well as in our personal lives. It is therefore very worthwhile to be familiar with the way they work, especially if you want to program them to do specific things. In this chapter we are going to look at the fundamental way in which these machines actually work so that you can make informed choices when in comes to writing more complex programs.

Computers are essentially made up of two main parts that are completely co-dependent. The two parts I am referring to are Software and Hardware. We are first going to look at the different hardware parts and how they work together to form computers the way we know them. What we have to bear in mind while looking at this section is that when creating software (programming) the software is limited by what the hardware can accommodate.

Hardware:

In general computer hardware is made up of five main parts that again form a very close relationship. These main parts are: Input devices, output devices, primary memory, secondary memory and the central processing unit. I will now briefly explain what each of these parts do and how they interact. The diagram below should assist in placing all the parts in context.

1Input Devices:

Input devices are the devices used by the computer to take in information / data from the user. Examples of such devices include: Keyboards, mouses, scanners and even microphones.  It is important to note that a disk drive is not classified as an input device or an output device – merely as a storage device.

Output Devices:

Output devices are devices attached to computers that allow the computer to present information to the user once it has processed whatever data had to be processed. The best example of such a device is monitors or display units. Another example of output devices are the speakers that are connected to some computers.

Primary Memory:

There are generally two kinds of memory present on computers. One of them is primary memory and the other one is secondary memory. We are first going to discuss primary memory.

Primary memory is regarded as fast, volatile memory Random Access Memory (RAM) that is used to temporarily store programs and data that are being used by a computer to process the tasks at hand. Once the tasks are completed and the information either presented or stored the data and programs are very likely to be cleared out of the primary memory.

There are two main types of primary memory: Static memory which is very fast but expensive to build and Dynamic memory which is slower (yet very fast) but is also much cheaper to build. Static RAM is usually only found on the Central Processing Unit (CPU) and designated as Cache memory. Cache memory is used to facilitate pipelining which is a feature found on practically all modern CPUs. Dynamic RAM is normally found on the motherboard and is used to store all the programs and data currently used by the computer system.

One of the first things that happen when a computer is switched on is that the operating system’s kernel (part of the OS that maneges all the sustems resources) gets loaded into the Dynamic RAM.

Once your computer is on and booted up completely you may want to open a program to write a letter. That program will then be loaded into secondary memory and as you type your letter the program (word processor) will feed all the characters you type into the primary memory as well. If, at this stage, there is a power failure and the computer is turned off, all the information typed into the document will be lost. This proves that primary memory is volatile. It requires electricity to store its data (refresh).

Secondary Memory:

Secondary memory is made up of devices that store data on a more permanent basis. This includes devices like hard disk drives (HDDs) floppy disk drives, writable CD drives and flash drives – these are also known as storage devices. The most common and fastest of the above mentioned devices is HDDs. They have really large capacities and are faster at accessing and transferring data than most other secondary memory devices.

Going back to the previous example of writing a letter in a word processor: As you are typing the letter it is a very good idea to store a copy of the letter you are writing in the secondary memory of your computer. This would generally be the HDD. Now, once you have finished and want to shut the PC down, there is a copy of the letter in the secondary memory and when you switch your computer off that copy will be retained in that memory (HDD).

Central Processing Unit:

The CPU is the part of the computer that does all the actual computing.  We can now, using a very simple example of computing an arithmetic sum, see how the five above mentioned parts of a computer work together to provide us with an answer:

Imagine that the computer we are using is a simple calculator and we have to find out what 1 + 1 is. The first thing that we must do is feed the computer the data that we want processed. We do that using the keyboard (input device). First we enter 1 followed by the operator (+) and then another one. These three keystrokes are now temporarily stored in the primary memory. When we choose to run the program (press =) the data is sent to the CPU which comes up with an answer by adding the two numbers together and then feeds the answer back to the primary memory. The answer is then fed to the output device (LCD screen of the calculator) and we are presented with the information (answer) being three.

If this calculator were a bit more advanced and had a flash chip on it allowing you to store worthwhile calculations, you could now choose to store (save) the above calculation. When you do that you are simply making a copy of that which is in the primary memory (of the calculator) and storing it in its secondary memory.

Software:

As with hardware, software is also divided up into two main sub-sections being system software and application software. Again this is a co-dependent relationship whereby one is almost useless without the other. Without software which is basically just a set of instructions for the machine the computer is incapable of doing anything and so software can be seen as a major interface between the computer’s hardware and its users.

fig2

In the diagram showing the interactive layers on the right hand side of the page you will see that there are various layers of software present between the user and the computer’s hardware. At this point its worth mentioning that any interaction between the user and the computer’s hardware has to go through all the layers of software.

First we are going to discuss System Software and all the parts that, in the order of their importance, make up a computer system.

When you switch a computer on the very first thing that happens is that the Basic Input Output System (BIOS) gets accessed from a Read Only Memory (ROM) chip found on the motherboard of the computer. The BIOS contains a sub-routine called the Power On Self Test (POST) and all the main devices’ drivers.

POST first checks that all the computer’s devices are present and running after which it loads the boot strap loader which then searches for the Master Boot Record (MBR) on the hard drive and facilitates the loading of the OS into memory (RAM). Once the OS has loaded, it will load all the Device Drivers corresponding to the devices that are installed on the computer. After that the OS loads the User Interface (shell) which facilitates interaction between the computer and its users. This shell is usually a WIMP shell (pioneered by Apple Corporation) which stands for windows, icons, mouse and pointer.

At this stage we have only covered the first two layers of System Software, the BIOS / Drivers and the OS / UI. The next layer up is still within the domain of System Software and contains two optional instances of System Software.

A Programming Compiler is generally used within an Integrated Development Environment (programming development suite) or IDE which is an environment within which you can write programs and run/test them.  The utility that facilitates the translating of the source code of a program into machine code (that which machines can understand) is known as a compiler. Given the low level nature of what it does it has been classified as System Software.

Anti-virus software is software that inspects all the files stored in a computer to check if they have been, in any way, altered by malicious software (known as viruses). Again this is a very low level process and so the algorithm (program) that does that has also been classified as System Software.

The next layer up is known as the Application Layer. This layer allows the running of programs like word processors, database management tools and games etc. Theses are the kind of programs that we the users interact with the most. Let us now investigate how all these layers work together using a simple example of opening an existing word processing document, editing it, printing it and then storing the changes made.

Let’s assume that the user has already loaded the word processing program (WP) and that they are ready to load the document. When the user instructs the WP to open a document, the program will make a request to the OS for the file that meets the user’s requirements (filename etc.). The OS will then accesses the storage device through the BIOS (HDD device drivers are included in the BIOS). Once the data has been found and transferred (copied into the primary memory [RAM]), it gets displayed on the computer’s monitor as information.  The user can now make whatever changes they desire and these changes are initially recorded in the primary memory by the OS.

When the user is satisfied with what they see he/she may want a hard copy version of the document. This is achieved by sending a copy of the document to another output device being a printer which prints the document onto paper. The document first gets translated into a printer friendly file through the OS by a device driver. It then gets fed to whatever port the printer is attached to by the OS.

Once all that has been achieved the user wants to store the changes they made. First the user clicks ‘save’, the WP sends a request to the OS stating that a copy of the file stored in the primary memory (updated) now needs to be sent to the same location in the secondary memory device the file was stored on initially. The OS will then overwrite that file with a new copy of the file and all is updated done.

 

pl

« Previous || Next »