Thursday, August 20, 2009

Computer literacy 101 -- what is memory?


We talked about the microprocessor, or CPU, of a computer last blog -- but what can it do without someplace to store, and retrieve, information (next entry will talk about how that information -- or data -- is used)?

The first thing to know about memory for computers is the idea of address space. Address space serves the same purpose for computers as postal addresses do for paper mail. Often that address space will start at zero (0) and continue to as large as the physical memory allows. As an example, you have a 4GB flash drive that you use for assignments -- carried between home and work, or classes. The addresses of the information on that flash drive will be from 0 up to 4 gigabyte - 1 (or
actually 4,294,967,295 but you can think of it as 4,000,000,000 units of information).

You also may have many different locations for memory -- these are called storage units. So, you may have a hard drive, a DVD-ROM drive, a USB flash card, and a set of backup files on a tape unit. Using the comparison to the paper mail system, let's say that each of these are in a different city -- so addresses consist of the information location (0 to 4 gigabyte on the flash drive) and storage location "G:flash_drive".

Alright, this is pretty cumbersome and it can really strain a microprocessor to directly address 4 gigabyte of memory (although it is possible for computers that describe themselves as "64-bit processors"). So, what most computer systems do is to break this memory down into separate "blocks" (or streets in the mail system). Each block may consist of 512 bytes. Therefore, we can now address a block as "G:flash_drive", "block 0 to 8,388,607" and a specific location as "G:flash_drive", "block 1,567", "byte 93".

OK. We see that by numbering the information and then breaking it down into separate groups we can effectively find all the information. But it is still rather clumsy talking about "G:flash_drive", "block 1,567", "byte 93". That is where the file system comes into play. A file system starts putting all of those numbers into friendlier terms. "Charles resume" is a lot easier to remember when one is doing a word processing program than telling it -- give me "C:CKS_hard_drive", "block 7,432 through 7,987", "bytes 0 (of first block) through 345 (of last block)".

Not only that, but this specific labeling of the location makes it very hard to move it -- what if I add something to the information (or file)? It will get bigger and the location will also get bigger -- do I now have to remember a whole new set of numbers? No. The file system will keep track of just where the file is now located and how large it is. (It also means that the file does not have to be contiguous -- the bytes can be located in different blocks and not come one after another.)

There are two other regions of memory that should be understood -- these are RAM and registers. Random Access Memory (RAM) is like your own pile of papers on your desk. It can be gotten to very quickly and is "right there". Registers are like "post-its" and are used for temporary copies of numbers to be used. RAM will often be addressed just by the byte numbers and registers will be referred to by special names (R1 for register 1) -- but these details aren't really important to most people.

Now that we have information in memory, how do we use it? That is the concept of data.

Wednesday, August 19, 2009

Computer literacy 101 -- what is a computer?


Back from jury duty (actually, jury selection -- I didn't have to serve). I am going to start my short series on areas that I feel are important to become computer literate. I will try to make it useful but not to go into greater detail than necessary.

A computer, of today, is based on a semiconductor chip called a microprocessor. This is also sometimes referred to as a CPU (Central Processing Unit). This microprocessor changes numbers. It does very simple things with the numbers -- moves them from one location to another, shifts them (which effectively multiplies them by 2 or divides them by 2), does "logic" operations on them (which, if you don't know what that is -- will be another topic in the future), and changes the order in which it follows directions depending on the values that it has been given or has created based on the instructions given. That's about it, although some microprocessors will have other instructions that are actually shortcuts for a sequence of operations that could be done with a long series of simpler instructions.

The microprocessor does simple things with the numbers -- but it does them very, very quickly. When you see an advertisement for a "4 GHz CPU", it is an indication of how fast the microprocessor is and an indication of how quickly instructions can be processed. Larger numbers indicate a greater potential for speed. I say potential because the final speed depends on many design factors but, in general, you can use these numbers as an indicator of speed.

Microprocessors are used in many devices in our modern world. When they are in something that allows its use for different, non predetermined, purposes, it is called a "general purpose computer" or just plain old computer. Most people are familiar with smaller computers that are referred to as Personal Computers (PCs) but computers come in many sizes from a "smart" cell phone to a large "mainframe" which might be as large as several filing cabinets (they keep getting smaller, though).

The other category of use of microprocessors is for specialized uses -- the microprocessor is used for only one thing, or for one category of uses. Televisions, amplifiers, DVD players, watches, digital clocks, refrigerators, coffee makers, fuel injection and engine monitoring systems, traffic lights, alarm systems and MP3 players are all examples of devices using specialized processors. Some devices start entering into a "grey" area where they could be used for various, non-predetermined, purposes but are actually primarily used for a single purpose.

The microprocessor does not exist just by itself. It must have access to ways of giving it information upon which to work and ways to give results. In order to do this, other electronic devices will be connected to it and they, in turn, will be connected to other devices. A digital watch is an example of a very "simple" system which has buttons for setting information and a display to give results.

One very important additional item to which the microprocessor must have access is memory, which will be the topic of 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...