3. Computers, Objects, and Java

3.2. What Is a Computer?

A computer is a machine that performs calculations and processes infor- mation. 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 (Fig. 1).

 

 

 

 

 

 

Main Memory

 

 

 

 

 

 

 

 

 

Output devices provide a means by which information held in the com- puter can be displayed in some understandable or usable form. Com- mon output devices include printers, monitors, and audio speakers.

 

SECTION 0.2 What Is a Computer?3

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 informa- tion 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 stor- age of relatively large amounts of information. These devices include hard drives or magnetic disks, compact disks (CDs), digital video disks (DVDs), and magnetic tapes. All of these devices are non-volatile, mean- ing 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 Pentium pro- cessor, which serves as the foundation for most Windows PCs, or the Power-PC processor, which serves as the foundation for Macintosh

computers. The CPU is designed to perform the fetch-execute cycle, 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 sub- traction, 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 com- puter’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, in command-line systems, such as Unix and DOS (short for Disk Operating System), a pro- gram is run by typing its name on the command line. By contrast, in

 

graphically based systems, such as Windows and Macintosh, a program is run by clicking on its icon with the mouse. Thus, this “point-and-click” interface has a totally different “look and feel” but does the same thing.