01-Understanding Computer Components and Operations - 2 (With Drawing)
01-Understanding Computer Components and Operations - 2 (With Drawing)
AN OVERVIEW OF
COMPUTERS
AND LOGIC
UNDERSTANDING COMPUTER COMPONENTS AND
OPERATIONS
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER
COMPONENTS AND OPERATIONS
UNDERSTANDING COMPUTER
COMPONENTS AND OPERATIONS
• Hardware and software are the two major components of any computer system.
• Hardware is the equipment, or the devices, associated with a computer.
• For a computer to be useful, however, it needs more than equipment; a computer needs to be
given instructions.
• The instructions that tell the computer what to do are called software, or programs, and are
written by programmers.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
HARDWARE SOFTWARE
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
TIPS
• Software can be classified as application software or system software.
• Application software comprises all the programs you apply to a task:
• word-processing programs, spreadsheets, payroll and inventory programs, and even games.
• System software comprises the programs that you use to manage your computer:
• operating systems, such as Windows, Linux, or UNIX.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
APPLICATION
SOFTWARE SYSTEM SOFTWARE
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Together, computer hardware and software accomplish four major operations:
1. Input
2. Processing
3. Output
4. Storage
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Hardware devices that perform input include keyboards and mice.
• Through these devices, data, or facts, enter the computer system.
• Processing data items may involve organizing them, checking them for accuracy, or
performing mathematical operations on them.
• The piece of hardware that performs these sorts of tasks is the central processing unit, or CPU.
• After data items have been processed, the resulting information is sent to a printer,
monitor, or some other output device so people can view, interpret, and use the results.
• Often, you also want to store the output information on storage hardware, such as magnetic
disks, tapes, compact discs, or flash media.
• Computer software consists of all the instructions that control how and when the data items are
input, how they are processed, and the form in which they are output or stored.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
INPU
T PROCESS OUTPU
T
STORAGE
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
STORAGE INPUT
OUTPUT PROCESS
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Computer hardware by itself is useless without a programmer’s instructions or software.
• just as your stereo equipment doesn’t do much until you provide music on a CD or tape.
• You can buy prewritten software that is stored on a disk or that you download from
the Internet, or you can write your own software instructions.
• You can enter instructions into a computer system through any of the hardware devices you
use for data; most often, you type your instructions using a keyboard and store them on a
device such as a disk or CD.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• You can enter instructions into a computer system through any of the hardware devices you
use for data;
• most often, you type your instructions using a keyboard and store them on a device such as a
disk or CD.
• You write computer instructions in a computer programming language, such as Visual Basic,
C#, C++, Java, or COBOL.
• Just as some people speak English and others speak Japanese,
• Programmers also write programs in different languages.
• Some programmers work exclusively in one language, whereas others know several and use
the one that seems most appropriate for the task at hand.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
UNDERSTANDING COMPUTER
COMPONENTS AND OPERATIONS
• No matter which programming language a computer programmer uses, the language has
rules governing its word usage and punctuation.
• These rules are called the language’s syntax.
• If you ask, “How the get to store do I?” in English, most people can figure out what you
probably mean, even though you have not used proper English syntax.
• However, computers are not nearly as smart as most people;
• with a computer, you might as well have asked,
“Xpu mxv ot dodnm cadf B?”
Unless the syntax is perfect, the computer cannot interpret the programming language
instruction at all.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
UNDERSTANDING COMPUTER
COMPONENTS AND OPERATIONS
• Every computer operates on circuitry that consists of millions of on/off switches.
• Each programming language uses a piece of software to translate the specific programming
language into the computer’s on/off circuitry language, or machine language.
• The language translation software is called a compiler or interpreter,
• and it tells you if you have used a programming language incorrectly.
• Therefore, syntax errors are relatively easy to locate and correct
• the compiler or interpreter you use highlights every syntax error.
• If you write a computer program using a language such as C++ but spell one of its words incorrectly
or reverse the proper order of two words,
• the translator lets you know that it found a mistake by displaying an error message as soon as you try to
translate the program
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
TIP
• Although there are differences in how compilers and interpreters work,
• their basic function is the same—to translate your programming statements into code the
computer can use.
• When you use a compiler, an entire program is translated before it can execute;
• when you use an interpreter, each instruction is translated just prior to execution.
• (example a program has a total of 10 instruction, in compiler all instruction is translated before
executed. While in interpreter 1 instruction is translated every execution)
• Usually, you do not choose which type of translation to use—it depends on the programming
language. However, there are some languages for which both compilers and interpreters are
available.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• A program without syntax errors can be executed on a computer, but it might not produce
correct results.
• For a program to work properly, you must give the instructions to the computer in a specific
sequence, you must not leave any instructions out, and you must not add extraneous
instructions.
• By doing this, you are developing the logic of the computer program.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Suppose you instruct someone to make a cake as follows.
• Stir
• Add two eggs
• Add a gallon of gasoline
• Bake at 350 degrees for 45 minutes
• Add three cups of flour
• Even though you have used the English language syntax correctly, the instructions
are out of sequence, some instructions are missing, and some instructions belong to
procedures other than baking a cake.
• Logical errors are much more difficult to locate than syntax errors;
• it is easier for you to determine whether “eggs” is spelled incorrectly in a recipe than it is for
you to tell if there are too many eggs or if they are added too soon
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Just as baking directions can be given correctly in French, German, or Spanish, the same
logic of a program can be expressed in any number of programming languages
• Once instructions have been input to the computer and translated into machine language, a
program can be run, or executed.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• You can write a program that
takes a number (an input step),
doubles it (processing),
and tells you the answer (output) in a programming language such as Java or C++,
but if you were to write it using English-like statements, it would look like this:
Get inputNumber.
Compute calculatedAnswer as inputNumber times 2.
Print calculatedAnswer.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
Get inputNumber.
Compute calculatedAnswer as inputNumber times 2.
Print calculatedAnswer.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
Get inputNumber.
Compute calculatedAnswer as inputNumber times 2.
Print calculatedAnswer.
• The logic of the input operation—that the computer must obtain a number for input, and that the
computer must obtain it before multiplying it by two—remains the same regardless of any specific
input hardware device.
• The same is true in your daily life. If you follow the instruction “Get eggs from store,” it does not really
matter if you are following a handwritten instruction from a list or a voice-mail instruction left on your cell
phone—the process of getting the eggs, and the result of doing so, are the same.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
Get inputNumber.
Compute calculatedAnswer as inputNumber times 2.
Print calculatedAnswer.
• Processing is the step that occurs when the arithmetic is performed to double the
inputNumber:
• the statement Compute calculatedAnswer as inputNumber times 2 represents processing.
• Mathematical operations are not the only kind of processing, but they are very typical.
• After you write a program, the program can be used on computers of different brand names,
sizes, and speeds. The hardware is not important; the processing will be the same.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
Get inputNumber.
Compute calculatedAnswer as inputNumber times 2.
Print calculatedAnswer.
• In the number-doubling program, the Print calculatedAnswer statement represents output.
• Within a particular program, this statement could cause the output to appear on the monitor.
• The logic of the process called “Print” is the same no matter what hardware device you use.
• Besides input, processing, and output, the fourth operation in any computer system is
storage.
• When computers produce output, it is for human consumption.
• For example, output might be displayed on a monitor or sent to a printer.
• Storage, on the other hand, is meant for future computer use (for example, when data items
are saved on a disk).
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Computer storage comes in two broad categories. All computers have internal storage, often
referred to as memory, main memory,
primary memory, or random access memory (RAM).
• This storage is located inside the system unit of the machine. This storage is located inside the
system unit of the machine.
• Computers also use external storage,
• which is persistent (relatively permanent) storage on a device such as a floppy disk, hard disk, flash
media, or magnetic tape.
• To use computer programs, you must first load them into memory.
• You might type a program into memory from the keyboard, or you might use a program that has
already been written and stored on a disk. Either way, a copy of the instructions must be placed in
memory before the program can be run.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• A computer system needs both internal memory and external storage.
• Internal memory is needed to run the programs,
but internal memory is volatile—that is, its contents are lost every time the computer loses
power.
• Therefore, if you are going to use a program more than once, you must store it, or save it, on
some nonvolatile medium.
• Otherwise, the program in main memory is lost forever when the computer is turned off.
• External storage (usually disks or tape) provides a nonvolatile (or persistent) medium.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
TIP
• Even though a hard disk drive is located inside your computer, the hard disk is not main,
internal memory.
• Internal memory is temporary and volatile.
• a hard drive is permanent, nonvolatile storage.
• After one or two “tragedies” of losing several pages of a typed computer program due to a
power failure
or other hardware problem,
most programmers learn to periodically save the programs they are in the process of writing,
using a nonvolatile medium such as a disk.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
• Once you have a copy of a program in main memory, you want to execute, or run, the program.
• To do so, you must also place any data that the program requires into memory.
• For example, after you place the following program into memory and start to run it, you need to
provide an actual inputNumber—for example, 8—that you also place in main memory.
Get inputNumber
Compute calculatedAnswer as inputNumber times 2.
Print calculatedAnswer.
• The inputNumber is placed in memory at a specific memory location that the program will call
inputNumber.
• Then, and only then, can the calculatedAnswer, in this case 16, be calculated and printed.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS
TIP
• Computer memory consists of millions of numbered locations where data can be stored.
• The memory location of inputNumber has a specific numeric address, for example, 48604.
• Your program associates inputNumber with that address.
• Every time you refer to inputNumber within a program, the computer retrieves the value at
the associated memory location.
• When you write programs, you seldom need to be concerned with the value of the memory
address; instead, you simply use the easy-to-remember name you created.
Chapter 1 -AN OVERVIEW OF COMPUTERS AND LOGIC - UNDERSTANDING COMPUTER COMPONENTS AND OPERATIONS