Friday, August 28, 2009

Computer Literacy 101 -- what are programs?


Data falls into two categories, as we saw in the previous blog. These categories are instruction data and program data. Instruction data can also be called a program -- which makes use of the program data to fulfill its purpose. Many times, a program will be called an application. Most people refer to programs as applications if they are widely used by different people. A word processing program may be considered an application. A spreadsheet program may be considered an application. Programs that people do not directly make use of are usually not called applications.

Programs consist of a sequence of instructions that tell the computer what to do. In the first blog of this series, we mentioned the types of instructions that may be given a microprocessor. These instructions are called machine language because they are sets of datum that are interpreted directly by the microprocessor. For example, the decimal value of 026002 will tell an HP 2100 computer to "jump" (change the current address for the next address) to address 002. The 026 portion is a "change the current instruction address to" code for the microprocessor and the 002 portion tells it the new value for the instruction address. Frankly, you don't really want to know much more than that unless you are involved with microprocessor design. Most microprocessors have their instructions written in binary (0s and 1s) or hexadecimal (symbols 1 through F for each numerical location) but the computers of the "early days" were not always standardized.

There is a hierarchy of languages used to program computers. At the base is machine language -- normally represented by a series of 0s and 1s -- like 10011001100011100011111101011110 -- which would be considered 32-bits. Current-day programmers almost never use machine language directly. The next level is called assembly language which uses a set of readable codes that can be directly translated into machine language. An example of assembly language might be "JMP START", where JMP is the operation to be performed and START is a symbol for an address that is the value to be used by the operation. The next level consists of many different languages in a family called high-level computer languages. A compiler changes the high-level language into assembly language (or, sometimes, directly into machine language. An assembler changes the assembly language into machine language. Finally (at least, at this current point of time) there are machine-independent languages which are used to create programs that may be run on many different computers without being changed.

Programmers write programs. Very few write machine language programs. More, but not many, write assembly language programs. Most write programs in high-level languages. An increasing number write programs in machine-independent languages (such as Java). However, all of them end up actually creating machine language -- with special programs such as Java interpreters/compilers, compilers, and assemblers acting to make it into this special, final, form.

I said earlier that some programs are visibly used by people -- and these are called applications. The ones that are NOT visibly used by people are sometimes called system programs. These are programs that enable to computer to perform the acts that people want. A printer program will be used to allow people to print a document from their application. At the core of all of the system programs is a particular program called an operating system and this will be addressed in the next blog.

Thursday, August 27, 2009

Computer Literacy 101 -- what are data?


All computers work with data. But, what are data? I say "what are data" because the word data is a plural one -- it is the plural of datum. However, almost no one ever uses the word datum and just about everyone treats data, grammatically, as singular. A datum is a single piece of information -- yes or no, it is raining or it is not raining, you have eaten breakfast or you have not eaten breakfast. You will note that a datum only indicates a yes/no or off/on, binary, condition. Most of the time, when we need information, it is really a collection of datum -- or data.

The same is true with computers -- they work on each individual datum but they pull them out of a pool of data. This data (I will use the conventional singular grammar here) is kept in storage, as I pointed out in a previous blog. It is then transferred from one storage area to the local RAM where the microprocessor can directly work with it.

Data is used by the microprocessor at many stages. The first stage, or startup (or bootup), is when the microprocessor first receives electricity. The actual hardware (the collection of semiconductor chips, and other discrete electronic components) is designed to start transferring data from a specific memory storage area and address. Often, this is address zero (0). This means that the microprocessor will transfer data from address 0 (the actual physical location, once again, depends on design of the hardware) to its working memory. It then executes the data -- it starts to perform specific operations based on the contents of that data that was at that address and then increments the address for the next instruction (usually by one -- unless the first instruction says something else) and then executes the operations for that address and on and on.

The next stage occurs once the registers (we talked about them in the storage blog) of the microprocessor have been filled with working data. At this stage, it is prepared to continue to execute instructions as it transfers them from memory. You can look at is as having two stages -- the first where the microprocessor "wakes up" with no specific contents in its registers and the second when the microprocessor has been initialized and can now proceed to work as the data tells it. Or, you can look at it as having three stages -- the first one the boot stage, the second is the startup stage where it is still getting ALL of the hardware connected to the computer ready to be used, and the third stage where any type of instructions can be executed because all of the hardware has been set up to be ready for use.

All of this works with the data. The data, for a general purpose microprocessor, is what makes it able to work differently each time it is turned on. For a specialized microprocessor, the incoming data starts the activities for which the microprocessor is designed.

Somehow, I managed to avoid the word program in this description but data are often split into two categories. Instruction data, or programs, are executable -- they contain instructions for the microprocessor while program data is used by the programs to produce more data. The difference between these categories of data is that instruction data does not change (unless someone specifically writes another program to change that instruction data -- the topic of viruses and software patches).

I'm going to swap the next two items on my original "computer literacy" list and talk about programs more in the next blog.

Interrupt Driven: Design and Alternatives

       It should not be surprising that there are many aspects of computer architecture which mirror how humans think and behave. Humans des...