Introduction
Introduction
Engineers
Chapter 1
Dr.Nour khlaifat
IN THIS CHAPTER, YOU WILL:
Dr.Nour khlaifat
Elements of a Computer System
A computer is an electronic device capable of performing
commands. The basic commands that a computer performs
are input (get data), output (display result), storage, and
performance of arithmetic and logical operations. There are
two main components of a computer system: hardware and
software. In the next few sections, you will learn a brief
overview of these components. Let’s look at hardware first.
Dr.Nour khlaifat
Elements of a Computer System
Hardware
Dr.Nour khlaifat
Elements of a Computer System
Dr.Nour khlaifat
Elements of a Computer System
Central Processing Unit and Main Memory
Dr.Nour khlaifat
Elements of a Computer System
Central Processing Unit and Main
Memory
Main memory, or random access memory, is connected
directly to the CPU. All programs must be loaded into main
memory before they can be executed. Similarly, all data must
be brought into main memory before a program can
manipulate it. When the computer is turned off, everything in
main memory is lost.
Main memory is an ordered sequence of cells, called memory
cells. Each cell has a unique location in main memory, called
the address of the cell. These addresses help you access the
information stored in the cell. Figure 1-1(b) shows main
memory with some data
Dr.Nour khlaifat
Elements of a Computer System
Central Processing Unit and Main
Memory
Today’s computers come with main memory consisting of
millions to billions of cells. Although Figure 1-1(b) shows data
stored in cells, the content of a cell can be either a
programming instruction or data. Moreover, this figure shows
the data as numbers and letters. However, as explained later
in this chapter, main memory stores everything as sequences
of 0s and 1s. The memory addresses are also expressed as
sequences of 0s and 1s.
Dr.Nour khlaifat
Elements of a Computer System
SECONDARY STORAGE
Dr.Nour khlaifat
Elements of a Computer System
Input /Output Devices
Input /Output Devices For a computer to perform a useful
task, it must be able to take in data and programs and display
the results of calculations. The devices that feed data and
programs into computers are called input devices. The
keyboard, mouse, scanner, camera, and secondary storage are
examples of input devices. The devices that the computer uses
to display results are called output devices. A monitor, printer,
and secondary storage are examples of output devices.
Software
Software are programs written to perform specific tasks. For
example, word processors are programs that you use to write
letters, papers, and even books. All software is written in
programming languages. There are two types of programs:
system programs and application programs.
Dr.Nour khlaifat
Elements of a Computer System
Software
System programs control the computer. The system program
that loads first when you turn on your computer is called the
operating system. Without an operating system, the computer
is useless. The operating system handles the overall activity
of the computer and provides services. Some of these services
include memory management, input/ output activities, and
storage management. The operating system has a special
program that organizes secondary storage so that you can
conveniently access information. Some well-known operating
systems are Windows 10, Mac OS X, Linux, and Android.
Application programs perform a specific task. Word
processors, spreadsheets, and games are examples of
application programs. The operating system is the program
that runs application programs.
Dr.Nour khlaifat
The Language of a Computer
When you press A on your keyboard, the computer displays A
on the screen. But what is actually stored inside the
computer’s main memory? What is the language of the
computer? How does it store whatever you type on the
keyboard?
Remember that a computer is an electronic device. Electrical
signals are used inside the computer to process information.
There are two types of electrical signals: analog and digital.
Analog signals are continuously varying continuous wave
forms used to represent such things as sound. Audio tapes, for
example, store data in analog signals. Digital signals
represent information with a sequence of 0s and 1s.
Dr.Nour khlaifat
The Language of a Computer
A 0 represents a low voltage, and a 1 represents a high
voltage. Digital signals are more reliable carriers of
information than analog signals and can be copied from one
device to another with exact precision. You might have noticed
that when you make a copy of an audio tape, the sound
quality of the copy is not as good as the original tape. On the
other hand, when you copy a CD, the copy is the same as the
original. Computers use digital signals.
Because digital signals are processed inside a computer, the
language of a computer, called machine language, is a
sequence of 0s and 1s. The digit 0 or 1 is called a binary
digit, or bit. Sometimes a sequence of 0s and 1s is referred
to as a binary code or a binary number.
Bit: A binary digit 0 or 1.
A sequence of eight bits is called a byte. Table 1-1
summarizes the terms used to describe various numbers of
bytes.
Dr.Nour khlaifat
The Language of a Computer
Dr.Nour khlaifat
The Evolution of Programming
Languages
The most basic language of a computer, the machine
language, provides program instructions in bits. Even though
most computers perform the same kinds of operations, the
designers of the computer may have chosen different sets of
binary codes to perform the operations. Therefore, the
machine language of one machine is not necessarily the same
as the machine language of another machine. The only
consistency among computers is that in any modern computer,
all data is stored and manipulated as binary codes. Early
computers were programmed in machine language.
Dr.Nour khlaifat
The Evolution of Programming
Languages
To see how instructions are written in machine language,
suppose you want to use the equation:
wages = rate · hours
Dr.Nour khlaifat
The Evolution of Programming
Languages
To represent the weekly wages equation in machine language,
the programmer had to remember the machine language
codes for various operations. Also, to manipulate data, the
programmer had to remember the locations of the data in the
main memory. This need to remember specific codes made
programming not only very difficult, but also error prone.
Assembly languages were developed to make the
programmer’s job easier. In assembly language, an instruction
is an easy-to-remember form called a mnemonic.
Dr.Nour khlaifat
The Evolution of Programming
Languages
For example, suppose LOAD stands for the machine code
100100, MULT stands for the machine code 100110
(multiplication), and STOR stands for the machine code
100010. Using assembly language instructions, you can write
the equation to calculate the weekly wages as follows:
LOAD rate
MULT hours
STOR wages
Dr.Nour khlaifat
The Evolution of Programming
Languages
As you can see, it is much easier to write instructions in
assembly language. However, a computer cannot execute
assembly language instructions directly. The instructions first
have to be translated into machine language. A program called
an assembler translates the assembly language instructions
into machine language.
Assembler: A program that translates a program written in
assembly language into an equivalent program in machine
language.
Dr.Nour khlaifat
The Evolution of Programming
Languages
Moving from machine language to assembly language made
programming easier, but a programmer was still forced to
think in terms of individual machine instructions. The next
step toward making programming easier was to devise high-
level languages that were closer to natural languages, such as
English, French, German, and Spanish. Basic, FORTRAN,
COBOL, C, C11, C++, Java, and Python are all high level
languages. You will learn the high-level language C++ in this
course.
Dr.Nour khlaifat