Section 0.2 What Is a Computer?
A computer is a machine that performs calculations and processes information. A computer works under the control of a computer program, a set of instructions that tell a computer what to do.
Hardware refers to the electronic and mechanical components of a computer. Software refers to the programs that control the hardware.
A general-purpose computer of the sort that we will be programming can store many different programs in its memory. That is what gives it the ability to perform a wide variety of functions, from word processing to browsing the Internet.
This is in contrast to a special-purpose computer, such as the one that resides in your microwave oven or the one that controls your digital watch or calculator. These types of computers contain control programs that are fixed and cannot be changed.
A computer's hardware is organized into several main subsystems or components (Figure 0.2.1).
Output devices provide a means by which information held in the computer can be displayed in some understandable or usable form. Common output devices include printers, monitors, and audio speakers.
Input devices bring data and information into the computer. Some of the more common input devices are the keyboard, mouse, microphone, and scanner.
Primary memory or main memory of a computer is used to store both data and programs. This type of memory, which is often called RAM, short for Random Access Memory, is built entirely out of electronic components—integrated circuit chips—which makes it extremely fast.
A computer's main memory is volatile, which means that any information stored in it is lost when the computer's power is turned off. In a sense, main memory acts as the computer's scratch pad, storing both programs and data temporarily while a program is running.
Secondary storage devices are used for long-term or permanent storage of relatively large amounts of information. These devices include hard drives or magnetic disks, compact disks (CDs), digital video disks (DVDs), and memory sticks. All of these devices are non-volatile, meaning that they retain information when the computer's power is turned off. Compared to a computer's primary memory, these devices are relatively slow.
The central processing unit (CPU ) is the computer's main engine. The CPU is the computer's microprocessor, such as the Intel Core processor, which serves as the foundation for many Windows and Macintosh computers.
The CPU is designed to perform the fetch-execute cycle, whereby it repeatedly gets the next machine instruction from memory and executes it. Under the direction of computer programs (software), the CPU issues signals that control the other components that make up the computer system.
One portion of the CPU, known as the arithmetic-logic unit (ALU), performs all calculations, such as addition and subtraction, and all logical comparisons, such as when one piece of data is compared to another to determine if they are equal.
There are two main types of software:
Application software refers to programs designed to provide a particular task or service, such as word processors, computer games, spreadsheet programs, and Web browsers.
System software includes programs that perform the basic operations that make a computer usable. For example, an important piece of system software is the operating system, which contains programs that manage the data stored on the computer's disks.
An operating system assists application software in performing tasks that are considered primitive or low-level, such as managing the computer's memory and its input and output devices.
Another important thing that the operating system does is to serve as an interface between the user and the hardware. The operating system determines how the user will interact with the system, or conversely, how the system will look and feel to the user.
For example, older operating systems, such as Unix and DOS (short for Disk Operating System), had a command-line interface, whereby a program was run by typing its name at the command prompt.
By contrast, modern operating systems, such as Windows and MacOS, have a graphical user interface (GUI), whereby a program is run by clicking on its icon with the mouse.
These different user interfaces have a totally different “look and feel” but do the same sorts of things.