Well, it’s been a bit of a summer break. Almost two weeks, 12 days in fact. Your author has started a new position. But, for the few of you reading, I shall press on.

Computers are great at certain calculations. Want to know how many days there are between June 12, 1973 and August 27, 1975? A simple computer program will do it in no time flat.

As we now, bits are the fundamental building blocks of information. And we can use bits to represent numbers. The Arithmetic and Logic Unit (ALU) part of a CPU is what performs those basic operations that are required for computers to do their work.

The arithmetic part of the ALU does basic mathematical operations. Initially, ALU could only perform the most basic of operations on integers. Now, most ALUs can do numerous operations on integers well as real numbers (also called floating point numbers). An example of a real number is .232343×10^-4. These kind of numbers are used in all kinds of scientific calculations as well as complex games. In older computers, operations on floating point numbers required a completely separate chip.

The logic part of the ALU allows one to treat a number as its underlying bits, and perform various operations to create a new number from those bits. These are called bitwise operations. Many of these are critical to basic operations in graphics and text processing. Also, they can compare two integers and see if they are the same or different. This is an operation that is performed very often.

The ALU is a critical part of a CPU. The operations it enables are what all programs use to do their work. Again, the CPUs ability to execute billions of these instructions in a second is what enables complex programs to work.

Let’s go to a simple example. One things computers do a lot is compare two words to see if they are equal. If you wanted to search a file, you’d have to be able to do this simple operation.

Firstly, we have to figure out how to map letters into numbers (and therefore bits). Thankfully, we don’t have to do this work, it’s been done for us. One common representation is ASCII, which uses the numbers 0-255 to represent the common characters used in early computing. A more modern version is called Unicode, which uses numbers 0-65355 to represent all known glyphs in all languages (with room for more).

One common way to represent a word (or a collection of letters) is to have a series of numbers that end with a zero. For example, the word hello can be represented as the following:

104 101 108 108 111 0

ASCII tells us that 104 is a lower case h, 111 is a lower case o, and so on. So, how do we tell if two strings are the same? Well, we just have to take each number in the sequence, and if they are equal, move to the next number. Repeat until both numbers are zero, and we know that the strings are equal. If the numbers are different, then the strings are not the same. The ALU provides the comparison operations.

The next building block we will discuss is the Memory Management Unit. The MMU is responsible for interfacing the CPU to the main memory of the computer.

Nice information