# What is a Computer?

Computer?

A computer is a programmable machine that receives input, stores and automatically manipulates data, and provides output in a useful format.

So to put it simply a computer is a calculator with a better interface.

That might seem overly simplistic to some of you, but it is basically true. No mater how you use or perceive a computer, at it’s most basic level it is a sophisticated calculator. This view of a computer will make it easier to see how much the ingenuity of the programmers has come into play to turn this calculator into the device so integrated into modern life.

Imagine if a computer were a person. Suppose you have a friend who’s really good at math. She is so good that everyone she knows posts their math problems to her. Each morning, she goes to her letterbox and finds a pile of new math problems waiting for her attention. She piles them up on her desk until she gets around to looking at them. Each afternoon, she takes a letter off the top of the pile, studies the problem, works out the solution, and scribbles the answer on the back. She puts this in an envelope addressed to the person who sent her the original problem and sticks it in her out tray, ready to post. Then she moves to the next letter in the pile. You can see that your friend is working just like a computer. Her letterbox is her input; the pile on her desk is her memory; her brain is the processor that works out the solutions to the problems; and the out tray on her desk is her output.

So you can see that the 4 elements common to all computers are input, storage, processing, and output. The art comes from how we handle these functions, and what we do with them.

So what does this all mean to me? The answer is that it gives you a view into why things like the command line are so important. It also helps to understand why some fancy operations seem so hard to get right. But having an appreciation of how much work goes into the operations of the computer, can help you appreciate what it takes to get things to work smoothly.

# Motherboard Described

Motherboard Diagram

The motherboard is the heart of today’s computers. It is a circuit board which contains all the chips and connectors which make up a computer. To understand how a computer works, we need a understanding of the different components which go onto a motherboard.

In the section above, we talked about the Computer, we said that the computer needed, input, storage, processing, and output. The motherboard contains the chips and circuits to implement these functions.

## Input

The Teleprinter

For input, the motherboard contains the keyboard and mouse controllers. Additionally it contains interfaces for things like USB, PS2, serial and parallel ports. Even though these chips are controlled by the CPU, they interface the outside world to the memory for the CPU to access.

This type of interface is controlled by software called device drivers. This type of software is typically written in assembly or some other low level programming language. The interface chips have data and address pins, as well as control registers/pins. A detailed knowledge of how to read control specs and understand the hardware is required. Some common tools for a device driver writer are a Logic analyzer and an oscilloscope.

The art of writing device drivers is outside the scope of this group, at least for now, since it requires knowledge of both hardware and software. But if you are interested in knowing more about it have a look at Linux Device Drivers, 2nd Edition by O’Reilly books.

## Storage

The Floppy

The second part of the computer equation is the storage. Storage comes in several types. There is permanent/semi-permanent storage as represented by Read Only Memory (ROM). These are the chips on the motherboard which store the start up code known as the Basic Input/Output System (BIOS).

Another common storage device is the floppy disk drive. Although they are mostly out of favor these days, the floppy disk played an important role for many years. Today people commonly think of the hard disk when referring to storage devices. But we should not forget the semiconductor type of storage from memory stick to secure digital (SD) devices.

The final kind of storage is the Random Access Memory (RAM). Ram is a fast, flexible, and reliable means of storing information, even though it requires constant power to maintain it’s contents. Ram memory is often combined with memory management chips to make it more flexible. By using memory management a computer with 1 gigabyte of ram can allow programs to think they each have 4 gigabytes of memory available. By swapping information in and out of memory it gives the illusion of being larger than it really is.

## Processing

As long as we are discussing this lets look into what is in the CPU which is the heart of the processing unit.

CPU Diagram

The control unit (often called a control system or central controller) manages the computer’s various components; it reads and interprets (decodes) the program instructions, transforming them into a series of control signals which activate other parts of the computer. Control systems in advanced computers may change the order of some instructions so as to improve performance.

A key component common to all CPUs is the program counter, a special memory cell (a register) that keeps track of which location in memory the next instruction is to be read from.

The control system’s function is as followsnote that this is a simplified description, and some of these steps may be performed concurrently or in a different order depending on the type of CPU:

1. Read the code for the next instruction from the cell indicated by the program counter.

2. Decode the numerical code for the instruction into a set of commands or signals for each of the other systems.

3. Increment the program counter so it points to the next instruction.

4. Read whatever data the instruction requires from cells in memory (or perhaps from an input device). The location of this required data is typically stored within the instruction code.

5. Provide the necessary data to an ALU or register.

6. If the instruction requires an ALU or specialized hardware to complete, instruct the hardware to perform the requested operation.

7. Write the result from the ALU back to a memory location or to a register or perhaps an output device.

8. Jump back to step (1).

Since the program counter is (conceptually) just another set of memory cells, it can be changed by calculations done in the ALU. Adding 100 to the program counter would cause the next instruction to be read from a place 100 locations further down the program. Instructions that modify the program counter are often known as “jumps” and allow for loops (instructions that are repeated by the computer) and often conditional instruction execution (both examples of control flow).

It is noticeable that the sequence of operations that the control unit goes through to process an instruction is in itself like a short computer program and indeed, in some more complex CPU designs, there is another yet smaller computer called a microsequencer that runs a microcode program that causes all of these events to happen.

## Output

The Monitor

Output basically refers to converting the data from machine form for human form. This encompasses screens, speakers, printers, interface devices, or even other computers.

We are all familiar with the computer screen or projector. But these are only a couple of output devices. The task of output is again handled by special devices driven by device drivers.

One of the interesting aspects to the computer is how many types of inputs and outputs are available to today’s computers. We have gone from the keyboard, to sound, and to the visual image. Some devices are today starting to involve our sense of touch. A game box like the Wii, is taking physical movement and converting it into computer data.

# Command Line?

Terminal in Xwindows

As I was writing up this talk, I started to wonder how many of you are comfortable on the command line. I know that today most operating systems are primarily used through graphical user interfaces, (GUI). But for this advanced group, you will need to be reasonably comfortable on the command line.

So the question for this group is, Should we spend a couple of sessions discussing the use of the command line in Linux?

For those of you who are unfamiliar with the command line, I am including several command line tutorials below. Also, I would recommend if you are using Ubuntu or Debian that you install a package called dwww. It is a web interface to the documentation on the Linux system. I have created home versions of this program but I highly recommend it as an easy way to look up commands, help, and info in Linux.

To get you started on the command line, I am going to give you the commands to install the dwww package on your system. I will assume that you have opened a terminal, and that you are logged in as yourself on a Debian/Ubuntu system. I am also assuming that you are connected to the Internet.

• sudo -i Will elevate your permissions to root user. You will be asked to enter your password.

• apt-get update This command tells the package management system to update it’s list of packages to the most recent.

• apt-get dist-upgrade This command, while not required, will update your system to the latest version of packages for your distribution. You don’t need to do this but it is a good idea to do periodically.

• apt-get install dwww This command does the installation of the dwww package.

• exit You are done as a root user, so you should stop using the administrator access.

You can access the information by entering this URL in your web browser. http://localhost/dwww. Or since we are discussion the command line, in a terminal try entering this command: lynx http://localhost/dwww to view the information in the terminal window. NOTE: you might need to install the lynx package to make this work.

So here is a list of tutorials you can use to get started or just refresh you knowledge of the command line.

And finally for now, an old idea revisited, the Cheat-Sheet. For years I have kept multiple cheat-sheets lying around my computer. These sheets of paper were always helpful when I was using an application and couldn’t remember the command’s name or options. So I will point out a few on the Internet for your pleasure. Remember a cheat-sheet is also valuable as a link in your web browser. Or even a local copy so you have access even when you do not have Internet access.

# Home Work

Home Work?

Yes, I am giving you home work. This is a user group, not a college lecture hall. I can do show and tell for a long time, but if you don’t roll up your sleeves you will not get much out of these talks.

So for our next meeting I would like each of you to select a Linux distribution you want to use as your bootstrap. Here are a few suggestions to start with.

• The first choice I would suggest is Gentoo Linux. It has easy to follow instructions on how to install your boot strap system.

• Since we are discussion it you could use Linux from Scratch. My only reservation is that the builds are getting old and do not work on all machines. Documentation is available and reasonably complete.

• Another idea is to try the Bootstrap loader from Turnkey Linux. This is minimal system, but should give you a system you can build upon from Ubuntu distribution. Remember the idea is not to install Ubuntu, but to have a system with enough tools to start building your own system.

• Or if you would like to try a different route you could try Cross Linux From Scratch. This site is a bit more complex but follows the same idea as Linux From Scratch.

• Another interesting idea is to build Building a GNU/Linux system from scratch and running it with UML. This could be an interesting way to attack this problem.

Use the base you choose to create a partition, format it, and install a tool chain and minimal tools. Create something you can boot into and get to a prompt. No Graphical user interfaces. We are going to be working at code level, programming your GUI is well beyond what we hope to do in this group.

What ever route you choose, keep track of what you do and lets discuss it in this group. We will learn from our mistakes just as much as from our successes. The only caveat I would recommend is this is not going to be a stable environment. You may rebuild this system several times before it works. So don’t do anything you are not prepared to lose.

Written by John F. Moore

Last Revised: Mon Jan 16 15:37:36 EST 2017