Thursday, November 10, 2011

Computer

1.1. Introduction


You use word processors to write documents, Web browsers to explore the Internet, and email programs to send email over the Internet. Word processors, browsers, and email programs are all examples of software that runs on computers. Software is developed using programming languages. There are many programming languages. So why Java? The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future of computing is being profoundly influenced by the Internet, and Java promises to remain a big part of that future. Java is the Internet programming language.
You are about to begin an exciting journey, learning a powerful programming language. Before the journey, it is helpful to review computer basics, programs, and operating systems, and to become familiar with number systems. You may skip the review in §§1.21.4 if you are familiar with such terms as CPU, memory, disks, operating systems, and programming languages. You may also skip §1.5 and use it as reference when you have questions regarding binary and hexadecimal numbers.

1.2. What Is a Computer?

A computer is an electronic device that stores and processes data. A computer includes both hardware and software. In general, hardware is the physical aspect of the computer that can be seen, and software is the invisible instructions that control the hardware and make it perform specific tasks. Computer programming consists of writing instructions for computers to perform. You can learn a programming language without knowing computer hardware, but you will be better able to understand the effect of the instructions in the program if you do. This section gives a brief introduction to computer hardware components and their functionality.
A computer consists of the following major hardware components, as shown in Figure 1.1.
  • Central Processing Unit (CPU)
  • Memory (main memory)
  • Storage Devices (disks, CDs, tapes)
  • Input and Output Devices (monitors, keyboards, mice, printers)
  • Communication Devices (modems and network interface cards (NICs))

Figure 1.1. A computer consists of a CPU, memory, hard disk, floppy disk, monitor, printer, and communication devices.

The components are connected through a subsystem called a bus that transfers data or power between the components.

1.2.1. Central Processing Unit

The central processing unit (CPU) is the brain of a computer. It retrieves instructions from memory and executes them. The CPU usually has two components: a control unit and an arithmetic/logic unit. The control unit controls and coordinates the actions of the other components. The arithmetic and logic unit performs numeric operations (addition, subtraction, multiplication, division) and logical operations (comparisons). 
Today's CPU is built on a small silicon semiconductor chip with millions of transistors. The speed of the CPU is mainly determined by clock speed. Every computer has an internal clock. The faster the clock speed, the more instructions are executed in a given period of time. The clock emits electronic pulses at a constant rate, and these are used to control and synchronize the pace of operations. The unit of measurement is called a hertz (Hz), with 1 hertz equaling 1 pulse per second. The clock speed of computers is usually measured in megahertz (MHz) (1 MHz is 1 million Hz). The speed of the CPU has been improved continuously. If you buy a PC now, you can get an Intel Pentium 4 Processor at 3 gigahertz (GHz) (1 GHz is 1000 MHz).

1.2.2. Memory

Computers use zeros and ones because digital devices have two stable states, referred to as zero and one by convention. Data of various kinds, such as numbers, characters, and strings, are encoded as a series of bits (binary digits: zeros and ones). Memory stores data and program instructions for the CPU to execute. A memory unit is an ordered sequence of bytes, each holding eight bits, as shown in Figure 1.2.

Figure 1.2. Memory stores data and program instructions.


The programmer need not be concerned about the encoding and decoding of data, which is performed automatically by the system based on the encoding scheme. The encoding scheme varies. For example, character 'J' is represented by 01001010 in one byte in the popular ASCII encoding. A small number such as 3 can be stored in a single byte. If a computer needs to store a large number that cannot fit into a single byte, it uses several adjacent bytes. No two data items can share or split the same byte. A byte is the minimum storage unit.
A program and its data must be brought to memory before they can be executed. A memory byte is never empty, but its initial content may be meaningless to your program. The current content of a memory byte is lost whenever new information is placed in it.
Every byte has a unique address. The address is used to locate the byte for storing and retrieving data. Since the bytes can be accessed in any order, the memory is also referred to as RAM (random-access memory). Today's personal computers usually have at least 128 megabytes of RAM. A megabyte (abbreviated MB) is about 1 million bytes. For a precise definition of megabyte, please see http://en.wikipedia.org/wiki/Megabyte. Like the CPU, memory is built on silicon semiconductor chips containing thousands of transistors embedded on their surface. Compared to the CPU chips, memory chips are less complicated, slower, and less expensive.

1.2.3. Storage Devices

Memory is volatile, because information is lost when the power is turned off. Programs and data are permanently stored on storage devices and are moved to memory when the computer actually uses them. The reason for this is that memory is much faster than storage devices. There are four main types of storage devices:
  • Disk drives (hard disks and floppy disks)
  • CD drives (CD-R, CD-RW, and DVD)
  • Tape drives
  • USB flash drives
Drives are devices for operating a medium, such as disks, CDs, and tapes.

Disks
There are two kinds of disks: hard disks and floppy disks. Personal computers usually have a 3.5-inch floppy disk drive and a hard drive. A floppy disk has a fixed capacity of about 1.44 MB. Hard disk capacities vary. The capacity of the hard disks of the latest PCs is in the range of 30 gigabytes to 160 gigabytes. Hard disks provide much faster performance and larger capacity than floppy disks. Both disk drives are often encased inside the computer. A floppy disk is removable. A hard disk is mounted inside the case of the computer. Removable hard disks are also available. Floppy disks will eventually be replaced by CD-RW and flash drives.

CDs and DVDs
CD stands for compact disc. There are two types of CD drives: CD-R and CD-RW. A CD-R is for read-only permanent storage, and the user cannot modify its contents once they are recorded. A CD-RW can be used like a floppy disk, and thus can be read and rewritten. A single CD can hold up to 700 MB. Most software is distributed through CD-ROMs. Most new PCs are equipped with a CD-RW drive that can work with both CD-R and CD-RW.
DVD stands for digital versatile disc. DVDs and CDs look alike. You can store data using a CD or DVD. A DVD can hold more information than a CD. A standard DVD storage is 4.7 GB in capacity.

Tapes
Tapes are mainly used for backup of data and programs. Unlike disks and CDs, tapes store information sequentially. The computer must retrieve information in the order it was stored. Tapes are very slow. It would take one to two hours to back up a 1-gigabyte hard disk.

USB Flash Drives
USB flash drives are popular new devices for storing and transporting data. They are small—about the size of a package of gum. They act like a portable hard disk that can be plugged into the USB port of your computer. USB flash drives are currently available with up to 2 GB storage capacity.

1.2.4. Input and Output Devices

Input and output devices let the user communicate with the computer. The common input devices are keyboards and mice. The common output devices are monitors and printers.

The Keyboard
A computer keyboard resembles a typewriter keyboard except that it has extra keys for certain special functions.
Function keys are located at the top of the keyboard with prefix F. Their use depends on the software.
A modifier key is special key (e.g., Shift, Alt, Ctrl) that modifies the normal action of another key when the two are pressed in combination.
The numeric keypad, located on the right-hand corner of the keyboard, is a separate set of number keys for quick input of numbers.
Arrow keys, located between the main keypad and the numeric keypad, are used to move the cursor up, down, left, and right.
The insert, delete, page up, and page down keys, located above the arrow keys, are used in word processing for performing insert, delete, page up, and page down.

The Mouse
A mouse is a pointing device. It is used to move an electronic pointer called a cursor around the screen or to click on an object on the screen to trigger it to respond.

The Monitor
The monitor displays information (text and graphics). The resolution and dot pitch determine the quality of the display.
The resolution specifies the number of pixels per square inch. Pixels (short for "picture elements") are tiny dots that form an image on the screen. A common resolution for a 17-inch screen, for example, is 1024 pixels wide and 768 pixels high. The resolution can be set manually. The higher the resolution, the sharper and clearer the image is.
The dot pitch is the amount of space between pixels. Typically, it has a range from 0.21 to 0.81 millimeters. The smaller the dot pitch, the better the display.

1.2.5. Communication Devices

Computers can be networked through communication devices. Commonly used communication devices are the dialup modem, DSL, cable modem, and network interface card. A dialup modem uses a phone line and can transfer data at a speed up to 56,000 bps (bits per second). A DSL (digital subscriber line) also uses a phone line and can transfer data at a speed 20 times faster than a dialup modem. A cable modem uses the TV cable line maintained by the cable company. A cable modem is as fast as DSL. A network interface card (NIC) is a device that connects a computer to a local area network (LAN). The LAN is commonly used in business, universities, and government organizations. A typical NIC called 10BaseT can transfer data at 10 mbps (million bits per second).

No comments:

Post a Comment