What a computer is
A computer is a device that does things with digital information. What it does:
- It takes in information
- It stores information
- It changes information
- It puts out information
The digital information might be text, numbers, pictures, music, movies … anything that can be represented by patterns of ones and zeros. For example, the letter “A” is represented by “100 0001” in a common coding scheme called ASCII.
Some computers are flexible, and they work with many kinds of information. For example, a modern desktop computer can work with any of the kinds of information I mentioned. This is the kind of computer that’s the most confusing, so I’ll mostly be talking about it.
Other computers are specialized for use with one kind of information. We name them for how we use them, or for traditional appliances they replace. For example, a digital camera is a computer that just works with pictures.
Still other computers are parts of other machines. The information they work with has to do with the operation of the machine. For example, a modern car has an on-board computer. It might even help you drive the car, by deciding when to use anti-skid braking.
What makes a computer work
I’ve mentioned that all of the kinds of information a computer works with are represented as patterns of zeros and ones. An important part of any computer is its processor. You can think of the processor as a kind of motor that works with the zeros and ones. It can change them to ones and zeros, or just move them around. A modern computer’s processor is in a microchip. Some people call the processor the CPU; that’s “Central Processing Unit.” Other people call the case that holds the computer parts together (including the processor) the CPU; that’s just confusing.
The speed of the processor is one way to measure how powerful your computer is. In 2013, when I wrote this, a good desktop computer had a processor speed of about 3 gigaHertz (GHz). “Hertz” means “cycles per second.” The prefix “giga” means about 1 billion. A lot of computers now have more than one processor, making them even faster.
A special kind of information, called a program, controls the processor. Exactly how a program does this is quite interesting. But you don’t have to know anything about it to use a computer. What matters is that, to work with a given kind of information on your computer, you need to use a program that’s designed for the job. For example, to edit a photo, you’d use a photo editing program like Photoshop. Some people call programs “software” or “apps.”
- Modern computers can run many programs at once.
- A generalized computer has a special program that takes care of the details of its operation for other programs. It’s called the operating system. Windows is an example.
When a program is working with information, its zeros and ones need to be in a workspace where the processor can get at them, change them and move them around quickly. That workspace is called memory. Modern computer memory is in microchips.There are two kinds of memory; static and dynamic.
- Even tho the word “dynamic” sounds sexier, dynamic memory is the cheapest, and most common, kind. It can only retain information for a few milliseconds. To avoid “forgetting” the information, every few milliseconds the processor must set aside what it’s doing, read every piece of information in memory and rewrite it back to its original memory location before it goes away. This is called the refresh cycle; it’s overhead that can use up significant processor capacity.
- Static memory is more expensive and less dense than dynamic memory, so it’s generally not used as a computer’s main memory. It can retain information with no need for refreshing. But it still requires power to retain information.
The amount of memory is another measure of how powerful a computer is. Memory is measured in bytes. You can think of a byte as a character, such as a letter of the alphabet. In 2013, when I wrote this, a good desktop computer had 8 gigabytes (GB) of memory. To put that in perspective, an average book contains 500,000 characters. So this computer could hold 2,000 books in its memory.
Why would a computer need so much memory? Information such as music and movies takes up a lot more memory than a book. Also, remember that a computer needs to run a program to work with information. When the program is running, it has to be in memory too. And, again, computers often run many programs at once.
Memory is expensive, and it takes up space and electricity. So, most computers only keep information in memory when they’re using it. Information that isn’t being used right now is kept in storage. Storage is a cheaper kind of memory that doesn’t need a constant flow of electricity and can hold huge amounts of information, such as a disk drive. A disk drive records information as digital signals on the magnetized surface of a spinning disk. A disk drive works more slowly than memory; when your computer acts “bogged down” or “frozen,” the trouble probably has something to do with the disk drive.
The amount of disk storage is another way of measuring the power of a computer. In 2013, when I wrote this, a good desktop computer had about 1 terabyte (TB) of disk storage. The prefix “tera” means about a trillion (a thousand billion). So, the disk storage I’m talking about is 125 times the capacity of the memory I told you about earlier. It could hold 250,000 books.
A computer might have more than one disk drive. They might be built into the computer; or they might be separate devices that you plug into it. A storage device might use storage media that’s removable, such as a compact disk (CD).
Input and output devices
- A mouse
- A lens
- A microphone
You can think of a storage device such as a disk drive as an input-output (I/O) device.
Another kind of I/O device is a network connection. A network is a system for moving information between computers over wires or by radio signals. A lot of I/O devices are controlled by their own internal computers. These devices can be connected to a network, so more than one computer can share them.
Files and directories
Up to now, we’ve talked about the parts of a computer (the “hardware”). Now we’re ready to talk about the ways a computer manages information in storage.
The zeros and ones that make up a piece of information, such as a blog post, need to be kept together and not mixed up with other information. So, the computer stores them as a group; we call it a file. Programs are stored as files, too. Some people call a file a “document,” although it seems strange to speak of a video as a document.
A file includes information that the computer needs to use it properly; in particular, its file name. A file name often includes a suffix that tells the operating system which program can use the file. For example, the names of files written by Microsoft Word always end in “.docx”. If you change the suffix of a file name, that makes it harder for the operating system to figure out which program should use it. This is why your computer might have an option set that keeps file name suffixes hidden.
The operating system uses a special kind of file called a directory to keep track of the computer’s files. The directory has an entry for each file it’s tracking. The entry includes the file’s name and its storage location. A directory can include entries for other directories. This feature lets you organize directories in an arrangement which, if drawn in a diagram, would look like an upside-down tree.
- Some people call a directory a “folder,” as if it were a cardboard folder full of paper documents.
- Some operating systems use a special directory to keep track of what’s displayed on the screen “background” when no windows are covering it. In Windows and OSX, this directory is named “desktop“.
Another special kind of file is a shortcut. Instead of usable information, it just contains the real location of the file (we call this a “pointer”). In the Windows and OSX operating systems, if a file’s icon has a little arrow in the bottom left corner, that means it’s a shortcut.
- You can delete a shortcut, and you’ll still have the file it pointed to. But first, it’s a good idea to make sure you can get to the file without depending on that shortcut.
What happens when you turn on your computer
- Your computer copies the operating system program from stored files into memory. Then it starts the operating system. This includes assigning it a memory workspace.
- The operating system checks all of the devices it knows about, to see if they are still attached and working.
- It checks for any new devices that it didn’t know about, to see if it needs special programs (“device drivers”) to work with them.
- It may show icons for the files and directories that have entries in the Desktop directory on the screen.
- At this point, the operating system may play a chord or a sound effect to let you know it’s ready for use.
- The operating system may automatically start programs that have files or shortcuts in another special directory called “Startup”.
What happens when you run a program
- You tell the operating system which program you want to run. On many computers, you’d do this by clicking on an icon that represents a directory entry for the program file (or for a shortcut to the program file). The icon might be displayed by your directory management program (in Windows, Windows Explorer; in OSX, Finder) or on your desktop.
- The operating system follows directory and shortcut pointers until it finds the program file. Some operating systems also look for the program file in a list of directories where programs are typically stored, called the path.
- The operating system copies the program file into memory, and starts it.
- If you want to work with a given file, you tell the program to open it. You might do this by pulling down a File menu and selecting Open. The program tells the operating system to go get the file. The operating system copies all or part of the file into the program’s memory.
The operating system keeps track of the fact that a program has a file open. If two programs were to write to the same file at once, the file would be mixed up (“corrupted”). So, many operating systems won’t let more than one program open a file at once.
It’s best to make sure that any file you change in a program is written out before you stop the program. Otherwise, the file might not include the changes you just made (or it might not even be usable).
What happens when you open a file
If you want to work with an existing file, this method is faster than first opening the program and then the file.
- You tell the operating system which file you want to open. On many computers, you’d do this by clicking on an icon that represents a directory entry for a file (or a shortcut to the file). The icon might be in Windows Explorer or on your desktop.
- The operating system follows directory and shortcut pointers until it finds the file.
- If the file name has a suffix, the computer uses it to figure out which program is needed to open the file. Otherwise, it may follow an internal rule to pick a program; or it may ask you to pick a program.
- The operating system finds, loads and starts the program, as described above.
- The operating system copies all or part of the file you asked for into the program’s memory.
What a crash is
The processor fetches and runs a series of program instructions from memory. In certain situations, this process can get stuck in a loop. Here’s a conceptual example:
- PRINT “THIS PROGRAM IS GOING TO CRASH!”
- GO TO 3
In the example above, the program gets as far as instruction #3; then it “loops through” that instruction over and over again, forever.
Looping can happen due to a programming error like the one shown above. An event that changes a program in memory can also cause it to loop. For example, the program (or another program) may store some data in a memory location that was holding instructions. Then it mistakes the data for instructions. This can cause the current program instruction location to jump to a memory area that holds data or that belongs to some other program.
If you see that the computer has paused for a long time (Windows; mouse pointer turns into an hourglass. OSX; mouse pointer turns into a color wheel), you may be tempted to “do something to get its attention.” Instead, the best thing to do at this point is to give it some more time; turning the computer off and on will often do more harm than good. If you feel that you must do something, try to terminate the program that seems to be causing the problem, rather than shutting down the whole computer.
You can usually terminate a program that has crashed. In Windows, hold down the keys CTRL, ALT and DEL at the same time to get a Task Manager list of running programs; then select the crashed program and terminate it. Similarly, in OSX hold down the keys CLOVER, ALT and ESC at the same time to get a Force Quit list; then select the crashed program and force it to quit.
Program termination/force-quitting depends on cooperation from the operating system; if the operating system has crashed, it’s unlikely to work. In this case, you’ll have to turn off your computer and restart it.
What happens when you turn off your computer
If you have a bad temper, you’re impulsive, and you like to show inanimate objects “who’s the boss,” you’re bound to have lots of trouble with computers. You may want to consider using an abacus instead.
How do you know when your computer is so messed up that you should turn it off? If a program pauses for a long time, you may want to terminate or force-quit the program instead (see above). If the operating system seems to be in trouble (for example, the display is messed up or the mouse has stopped working), then turning off the computer and restarting it is your only recourse.
There is a right way and a wrong way to turn off a computer. The difference has to do with how memory is treated. Remember that the dynamic memory that most computers use must be refreshed every few milliseconds to retain its information. If you suddenly deny power to your computer, refreshing stops; and any information that was in its memory is lost.
A program that uses files usually holds some information only in memory, saving it to a file periodically or when you tell it to do so. A bad shutdown causes the loss of that information. On some systems, information having to do with file management is held in memory while the file is open; and if the file management information is lost, you might not be able to open the file again. (This condition is called a “corrupted file.”) Another way to corrupt a file is to turn off the power while the computer is midway thru writing the file. Operating systems use files too; so a corrupted file can cause you a lot of trouble.
The right way to turn off the computer is to tell the operating system you want to turn it off, and let the operating system do an orderly shutdown. For example, in Windows 7 you click the Start button and click “Shutdown.” In OSX you click the Apple button and click “Shutdown.”
The operating system asks each program that’s running if it is ready for a shutdown. Typically, a program will answer “no” if it knows about data that’s been created or changed in memory and not yet saved to a file. You may be asked to either agree to the writing of files, or agree that you don’t need the data that’s in memory. Or, on OSX, you may see a notice that a program has cancelled the shutdown.
After all the programs have returned a positive report to the operating system, the operating system tells you it’s okay to turn off the computer. Or, on newer computers, the operating system simply turns off the computer automatically.
The wrong way to turn off the computer is to turn off its power switch. Newer iMac computers are designed to go to sleep rather than shutdown if you push the power switch. To make them shut down from the switch, you have to hold it down for several seconds. Even then, the iMac will at least try to write out and close all open files.
A worse way to turn off the computer is to pull the plug out of the socket. This defeats any safeguards the computer manufacturer has built into the power switch.