Lesson 3: The Workings of Computers
As we said in the last lesson, computers are essentially something that can be programmed and can do automated math. Modern computers accomplish this task with the CPU, which takes input from the surrounding circuits, and then outputs the computational results of the input.
Modern computers also extend this with additional devices providing more memory, storage, user input, and more.
Computer Number Systems
Though the ENIAC computer was a decimal-based system, all other modern computers are binary-based systems. This means that, at it’s basic level, a computer can only take two (bi) values, 0 or 1. These values are represented in computers on by either having an electrical charge (1), or having no charge (0). Each of this inidividual values is a called a bit. These bits are normally grouped into sets of 8, which are known as a byte.
These numbers can then be converted from binary (base-2) to decimal (base-10) or hexadecimal (base-16). Actually, you can convert between any base, but these are the three bases commonly used in computer systems.
Base-10 is the number system that we usually use in common mathematics. One byte can store between 0 and 255, in decimal (00000000 through 11111111 in binary). Decimal is primarily used by computers purely for the ease of human use. Computers don’t have to do math in decimal to give answers in decimal. It can simply do binary math and then convert the answer to decimal when it displays it for humans.
Base-16 is another number system used for the ease of humans, when we have to look at especially large numbers. Memory addresses (see the new section) are usually displayed in hexadecimal because they can be quite large in binary or hexadecimal. Hex is useful because just two hexadecimal digits can store one byte. That means you can reduce a byte written in binary (8 digits long), to only 2 digits long (00 through FF).
Hexadecimal on computers using the letters A through F to equal 10 through 15 for a single digit.
The CPU
The central processing unit, or CPU, is the hardware brains of the computer. If you just use the definition of a computer that it simply has to perform automated arithmetic and it is programmable, the CPU itself is the computer.
As we mentioned in our last lesson, the various components that make up the CPU were combined into one small circuit board, just a bit bigger than a postage stamp. These CPUs are called microprocessors.
The CPU consists of four primary components: the arithmetic and logic unit (ALU), the control unit (or central controller), memory, and input and output (I/O).
The CPU receives input from the other components in the computer, in the form of data. The control unit then interprets the input which contains instructions for the CPU. The control unit then sends signals to other components to perform the work.
The control unit will store data in the CPU’s memory until it needs the data.
The ALU is responsible for performing the actual math on the data, manipulating the data based on the instructions from the control unit, which bases it’s instructions on the incoming input.
Then, once the ALU has done it’s job, the data is then outputted back to the various components.
This is the basic abridged version of how the CPU works.
CPUs are designed to work with a specific number of bits for each number. Early modern computers only used a sparse number of bits at a time. By the time Windows 1.0 came out, we were using 16-bit computers. Now most computers are 32-bit, and are progressing towards 64-bit.
Notice that this number is always a power of 2. That is because bits are base-2. What this number essentially indicates is the largest single number that a CPU can handle. A 32-bit CPU can handle a maximum single number of 232 (about 4 billion). A 64-bit CPU can handle a maximum number of 18,446,744,073,709,551,615, significantly large.
This number is important because it translates to being able to process more data at a time or, maybe a more important way to look at it, the same amount of data in less time, resulting in faster computers.
Memory
In modern computers we have RAM (random access memory). This memory is what is used to store values when we are actually doing work with them. This type of memory is known as volatile because it can only store information in the presence of electricity. When the electricity is removed, all of the bits in RAM have no charge, so they are all set to 0 and essentially wiped clean.
We also have hard drives and other forms of “physical”, or non-volatile memory. These are non-volatile because instead of storing it as electrical charges, it stores it in a physical method. In the case of hard drives, it is stored using magnetic dust on a stack of metallic discs, or some other similar means. On CDs and DVDs, it is stored by carving small notches in the bottom of them which are then read by a laser as either carved or not. CD and DVD drives are often called “optical” drives or devices because of the use of a laser.
We also have ROM (read-only memory). This memory can only be read from by the computer and can’t be changed. This type of memory is pre-programmed by the manufacturer and contains typically contains the basic instructions to do at the start-up of the computer or device.
In all of these means of storage, we have “memory addresses”. These are just as they sound; address for the different memory. Memory is addressed by the byte. Due to this, you can’t use a variable smaller than a byte (with the exception of a boolean variable, which is just 1 bit). These addresses are used by the computer (and programmers) to determine where specific data is stored.
User Input Devices
There are also user input devices as well, such as keyboards, mice, and joysticks. When a user hits a button on one of these, a signal is sent from the device to the computer. The computer then looks at what message was sent and interprets what to do. These devices sent a message each time the “state” changes.
A state is just simply how something is at a moment. For example, a key that you aren’t pressing down at the moment is in the state of being up. When you hold it down, it is in the state of being down. The computer doesn’t necessarily know directly if a key is being held down, but it knows that if it received the signal for the state of being down, and hasn’t received the signal for being in the state of up, it knows that it must be down. The inverse is also true. If it knows it’s up and hasn’t been told it’s down, it must still be up.
Mouse and joystick movements work on the same principal. When you move a mouse, a small device inside determines that amount and direction it has moved, and let’s the computer know this. The specific internal mechanism differs depending on the type of mouse. For example, the roller mice (the ones with the small ball inside), work by turning two rollers, on an x-axis and y-axis inside, which can then be translated to movement in any of the possible directions the mouse can move in a 2D plane.
Other Components
There are also other components, such as graphics cards, audio cards, etc. These devices are essentially mini-computer (by our definition that it is programmable and automates calculations), but are optimized for specific purposes. For example, a graphics card has a GPU (graphics processing unit), which performs the same basic functions of a CPU, but is optimized in a way that it can handle the specialized data that pertains to 3D graphics.
Operating Systems
The computers then know what to do by reading the programs that are stored on them, and performing the actions. On the hard drive is a section called the Master Boot Record (MBR) which tells the computer what the first program to run is (the operating system). It then runs that program, which will give the computer additional directions as to what other programs to run.
The operating system could be thought of as the programmed brain of the computer. There are three primary operating systems, which have many variations. Those three are Windows, Mac OS X, and Linux.
Windows is the dominant operating system due to it’s ease of use. This dominance is slowly being reduce, but it still remains the dominant OS for now. It was created by Bill Gates and first came on the scene in 1985, with Windows 1.0. this OS was a 16-bit operating system. Eventually Windows progressed to the NT family, which was Windows XP and Windows 2000. This family was a complete rewrite of the code for Windows. All versions up until those two were based on the original Windows core. Windows Vista is the latest version of Windows, which is also part of the NT family.
Mac OS X is the operating system for Apple computers. It is based on the Unix operating system, which is also the precursor of Linux. Mac OS X isn’t really used for web servers, though it is great for multimedia work such as video. Apple computers at their core are similar to other computers, but have hardware optimized in a different way. OS X is the successor to the classic Mac OS, which powered Apple computers before 2000. Aside from the interface, a lot of the components are essentially the same as any other Unix system.
Unix is the name of another operating system. Unix itself isn’t directly used too often (at least not on personal computers), but is the basis for nearly all operating systems except for Windows. There are several implementations of Unix under numerous different licenses by numerous companies and individuals.
Linux is another Unix based operating system. It used to be rather difficult and unfriendly to use, but lately there has been a lot of effort to make it more user friendly. Linux is also free to use, so it is a cheap alternative to Windows, which costs several hundred dollars. Due to these factors, Linux has been gaining popularity though it still has a low percentage of total computer users. While not used that much for personal computing, it is used largely as a web server due to the above reasons, along with other tools that make it an excellent and efficient web server.
In this lesson we talked about the various components that make up the computers that we know and love. In our next lesson we’ll take a brief look at the history of programming.




