The basics of Computer Architecture
According to the IEEE/ACM Computer Curricula 2001, prepared by the Joint Task Force on Computing Curricula of the IEEE (Institute of Electrical and Electronics Engineers) Computer Society and ACM (Association for Computing Machinery):
The computer lies at the heart of computing. Without it most of the computing disciplines today would be a branch of theoretical mathematics. To be a professional in any field of computing today, one should not regard the computer as just a black box that executes programs by magic. All students of computing should acquire some understanding and appreciation of a computer system’s functional components, their characteristics, their performance, and their interactions.There are practical implications as well. Students need to understand computer architecture in order to structure a program so that it runs more efficiently on a real machine. In selecting a system to use, they should be able to understand the tradeoff among various components, such as CPU clock speed vs. memory size.
Computer Architecture is indeed an underrated topic of study for web developers and programmers. Understanding the low level concepts of the system on which you are implementing binary trees and hash tables and making web applications, and how they actually run on your PC is just as important as actually implementing them. There are already many articles on what Computer Architecture is and why understanding it is important, so I wouldn’t be delving into that. Instead, I would like to introduce the basics that I have learned.
Organisation of a basic computer
A computer, on a very broad level, basically does two operations:
- Executes a program (or a set of instructions)
- Does operations according to the instructions and store the results
To perform these operations, a computer consists of 5 basic components:
- Control Path
The processor is the main component of a computer. It does all the data manipulation and processing, and performs operations on data or data streams. Frequently referred to as the Central Processing Unit(CPU) of the computer or the brain of a computer, it consists of two components:
- Datapath: Datapath performs all the required operations on a given data. This is the place where actual execution of instructions take place. For example, operations like ADD and MULTIPLY are performed by the Datapath.
- Control Path: Control Path or Control Unit basically controls how data flows inside the computer. It tells the datapath what to do by selecting, interpreting and seeing to the execution of the program instructions. Hence, directing the operation of the computer, and acting like the nervous system of the computer.
These two components, the Datapath and the Control Path make up the processor of the computer, and this is broadly how the processor works.
The Memory component, as might have become clear from it’s name, stores data and the instructions to be performed on that data.
Input lets user feed data to the computer, i.e. input of user data.
Output performs the output of the required information on the screen or somewhere else.
The Instruction Set Architecture (ISA)
Suppose sum = a + b is a high level program, say, implemented in C. The computer understands this program through some set of instructions (language which the computer understands). This set of instructions through which the computer understands high level programs is called Instruction Set Architecture (ISA).
Different processors have different architectures, for example, Intel, ARM, AMD and Princeton, all of these different processors have different ISAs.
Instructions that get executed by a processor depend completely on the ISA, which is designed by the computer architect while designing the processor.
Going back to our C program, suppose we want to output the sum of numbers input by the user, that is, sum = a+ b, where a and b are numbers input by the user, and sum is supposed to be the shown on the screen. In this scenario, what happens is the following:
Step 1: User inputs the numbers a and b
Step 2: The numbers a and b and the operation ADD are stored in the memory.
Step 3: The data (a , b and operation ADD) is transferred to the Control part of the processor, which identifies the operation and then instructs the Datapath to apply the operation ADD to the numbers a and b.
Step 4: The data is then transferred to the Datapath which performs the actual operation ADD on a and b, and stores the result in the variable sum.
Step 5: The resultant information, i.e. sum is then transferred to the memory.
Step 6: The information is then loaded to the output, and sum is then printed on the screen as output.
Hence, what actually happens inside a computer can be broadly shown as:
These things may seem trivial, but are the foundational building blocks upon which the vast realm of computer architecture is built. Hope you got a somewhat better understanding of broadly how a computer works. Any comments, suggestions or feedback are welcome. Feel free to hit me up on Twitter !