0% found this document useful (0 votes)
2 views19 pages

CHAPTER-1-6

This document provides an introduction to computer systems, detailing the hardware and software components that make up a computer. It explains the roles of the processor, main memory, secondary memory, input and output devices, and embedded systems, as well as the distinction between application and system programs. Additionally, it covers the functioning of operating systems and the basics of computer networking, including local-area and wide-area networks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views19 pages

CHAPTER-1-6

This document provides an introduction to computer systems, detailing the hardware and software components that make up a computer. It explains the roles of the processor, main memory, secondary memory, input and output devices, and embedded systems, as well as the distinction between application and system programs. Additionally, it covers the functioning of operating systems and the basics of computer networking, including local-area and wide-area networks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

CHAPTER 1 — Introduction to  Processor

Computer Systems  Main memory

A computer is a complex system consisting of  Secondary memory


both hardware and software components. Th
 Input devices
is chapter discusses these components.
 Output devices
Hardware and Software
For typical desktop computers, the processor,
The word hardware is used for physical
main memory, secondary memory, power
devices such as TV sets, DVD players and
supply, and supporting hardware are housed
computers. The word software is used for the
in a metal case. Many of the components are
information used with such devices: movies,
connected to the main circuit board of the
music, novels, web pages, computer
computer, called the motherboard. The power
programs, and data.
supply supplies power for most of the
When talking about computer components. Various input devices (such as
systems, hardware means the physical parts the keyboard) and output devices (such as the
of the computer. Software means the monitor) are attached through connectors at
programs and data used with the physical the rear of the case.
computer.
Hardware Components
Components of a Computer System

Information is funny stuff. The information for


the web page you are looking at is recorded
on a hard disk inside a computer located in
New Britain, Connecticut. The information
was copied from that physical device to other
physical devices perhaps hundreds of times
before it got to your computer where your
web browser is using it to display these words The terms input and output say if data flow
on your monitor. Clearly information is into or out of the computer. The picture shows
something different from the devices used to the major hardware components of a
store and transmit it. computer system. The arrows show the
direction of data flow.
A computer system consists of both hardware
and information stored on hardware. A bus is a group of wires on the main circuit
Information stored on computer hardware is board of the computer. It is a pathway for data
often called software. flowing between components. Most devices
are connected to the bus through
The hardware components of a computer a controller which coordinates the activities of
system are the electronic and mechanical the device with the bus.
parts.
The processor does the fundamental
The software components of a computer computing within the system, and directly or
system are the data and the computer indirectly controls all the other
programs. components. The processor is sometimes
The major hardware components of a called the "brains of a computer." The rest of
computer system are: the computer exists merely to supply it with
information and electrical power.
In a desktop computer, the processor is about o holds the programs and data
a one inch square of plastic. Inside the square that the processor is actively
is an even smaller square of silicon containing working with.
billions of tiny electrical parts. A modern
o interacts with the processor
processor may contain billions of transistors.
millions of times per second.
The processor is sometimes called the Central
o needs constant electric power
Processing Unit or CPU. A particular computer
to keep its information.
will have a particular type of processor, such
as an Intel Core i7 processor or an ARM  Secondary memory:
processor.
o connected to main memory
Memory through the bus and a
controller.
The processor performs all the fundamental
computation of the computer system. Other o stored data are easily
components contribute to the computation by changed, but changes are
doing such things as storing data or moving slow compared to main
data into and out of the processor. But the memory.
processor is where the fundamental action
takes place. o used for long-term storage of
programs and data.
A processor chip has relatively little
memory. It has only enough memory to hold a o before data and programs can
few instructions of a program and the data be used, they must be copied
they process. Complete programs and data from secondary memory into
sets are held in memory external to the main memory.
processor. This memory is of two fundamental o does not need electric power
types: main memory, and secondary memory. to keep its information.
Main memory is sometimes Main Memory
called volatile because it looses its
information when power is removed. Main memory is where programs and data are
Secondary memory is usually non-volatile kept when the processor is actively using
because it retains its information when power them. When programs and data become
is removed. (However, it needs power when active, they are copied from secondary
information is stored into memory or memory into main memory where the
retrieved from it.) processor can interact with them. A copy
remains in secondary memory.
Main memory is sometimes called main
storage and secondary memory is sometimes Main memory is intimately connected to the
called secondary storage or mass storage. processor, so moving instructions and data
into and out of the processor is very fast.
 Main memory:
Main memory is sometimes called RAM. RAM
o closely connected to the stands for Random Access Memory.
processor. "Random" means that the memory cells can
o stored data are quickly and be accessed in any order. However, properly
easily changed. speaking, "RAM" means the type of silicon
chip used to implement main memory.
When people say that a computer has "512 running, the processor can quickly read and
megabytes of RAM" they are talking about write small sections of that data in main
how big its main memory is. One megabyte of memory. When it is done, a large block of data
memory is enough to hold approximately one is written back to disk.
million (106) characters. A mid-priced desktop
Often, while the processor is computing with
has about 8 gigabytes or more of main
one block of data in main memory, the next
memory (2018). A gigabyte is approximately
block of data from disk is read into another
one billion (109) characters. (There will be
section of main memory and made ready for
more about bytes and megabytes later on in
the processor. One of the jobs of an operating
these notes.)
system is to manage main storage and disks
Nothing permanent is kept in main this way.
memory. Sometimes data are placed in main
memory for just a few seconds, only as long as Primary memory Secondary memory
they are needed by the processor.

o Running programs are always located  Slow


 Fast
in main memory.
 Cheap
 Expensive
Secondary Memory
 Large
 Low
Secondary memory is where programs and capacity
capacity
data are kept on a long-term basis. Common
 Not
secondary storage devices are the hard disk  Works
connected
and optical disks. directly
directly to
with the
 The hard disk has enormous storage the
processor
capacity compared to main memory. processor

 The hard disk is usually contained Input and Output Devices


inside the case of a computer.
Input and output devices allow the computer
 The hard disk is used for long-term system to interact with the outside world by
storage of programs and data. moving data into and out of the
 Data and programs on the hard disk system. An input device is used to bring data
are organized into files. into the system. Some input devices are:

 A file is a collection of data on the disk  Keyboard


that has a name.  Mouse
A hard disk might have a storage capacity of  Microphone
one terabyte (room for about 1012 characters).
A hard disk is slow compared to main  Bar code reader
memory. If the disk were the only type of
 Graphics tablet
memory the computer system would slow
down to a crawl. The reason for having two An output device is used to send data out of
types of storage is this difference in speed and the system. Some output devices are:
capacity.
 Monitor
Large blocks of data are copied from disk into
 Printer
main memory. This operation is slow, but lots
of data is copied. Then, while a program is  Speaker
A network interface acts as both input and A typical embedded system is a cell phone.
output. Data flows from the network into the This is obvious, but there are many less
computer, and out of the computer into the obvious embedded systems. Your car contains
network. dozens of processors, and even more in its
audio system. For instance, each airbag is
I/O
controlled by its own computer chip. Digital
Input/output devices are usually cameras, DVD players, medical equipment,
called I/O devices. They are directly and even home appliances contain dedicated
connected to an electronic module attached processors.
to the motherboard called a device controller.
The overwhelming majority of processor chips
For example, the speakers of a multimedia
are used in embedded systems. Less than 1%
computer system are directly connected to a
of processor chips are used in the familiar
device controller called an audio card, which
desktop computer!
in turn is plugged into a bus on the
motherboard. Software

With many recent computers, the functions of Computer software consists of


a device controller are integrated with the both programs and data. Programs consist of
motherboard. Some motherboards have instructions for the processor. Data can be any
audio, graphics, and network controllers built information that a program needs: character
in. data, numerical data, image data, audio data,
and countless other types. The distinction
Often secondary memory devices like the hard
between programs and data is not as clear-cut
disk are called I/O devices (because they move
as you might think, however.
data in and out of main memory). What
counts as an I/O device depends on context. Fundamental Idea: Both programs and data
To a user, an I/O device is something outside are saved in computer memory in the same
of the computer case. To a programmer, way. The electronics of computer memory
anything outside of the processor and main (both main memory and secondary memory)
memory is an I/O device. To an engineer make no distinction between programs and
working on the design of a processor data.
everything outside of the processor is an I/O
The insight that both programs and data can
device.
be saved using the same electronic methods is
Embedded Systems an important concept in computer science.
Computer systems use memory for either
A computer system that is part of a larger
programs or data, as needed.
device and which controls how that device
operates is an embedded system. Usually the Types of Programs
processor constantly runs a single control
There are two categories of
program which is permanently kept in ROM
programs. Application programs (usually
(Read Only Memory).
called just "applications") are programs that
ROM is used to make a section of main people use to get their work done. Computers
memory read-only. Main memory looks the exist because people want to run these
same as before to the processor, except a programs. Systems programs keep the
section of it permanently contains the hardware and software running together
program the processor is running. This section smoothly. The difference between
of memory retains its data even when power "application program" and "system program"
is off.
is fuzzy. Often it is more a matter of marketing
 Web
than of logic.  Data backup
browsers
The most important systems program is
the operating system. The operating system is Operating Systems
always present when a computer is running. It
An operating system is a complex program
coordinates the operation of the other
that keeps the hardware and software
hardware and software components of the
components of a computer system
computer system. The operating system is
coordinated and functioning. It is like the
responsible for starting up application
owner of a small shop, who keeps everything
programs, running them, and managing the
in order by attending to customers, accepting
resources that they need. When an
deliveries, stocking the shelves, doing the
application program is running, the operating
bookkeeping, and so on. The shopkeeper must
system manages the details of the hardware
promptly attend to tasks as they arise.
for it. For example, when you type characters
Without the shopkeeper the shop could not
on the keyboard, the operating system
function.
determines which application program they
are intended for and does the work of getting Most computer systems can potentially run
them there. any of several operating systems. For example,
most Intel-based computers can run either
Some embedded systems do not use an
Linux or a Windows operating
operating system, but run their programs
systems. Usually only one operating system is
directly on the processor.
installed on a computer system, although
Modern operating systems for desktop some computers have several. In any case,
computers come with a user interface that only one operating system at a time can be in
enables users to easily interact with control of the computer system. The
application programs (and with the operating computer user makes a choice when the
system itself) by using windows, buttons, computer is turned on, and that operating
menus, icons, the mouse, and the keyboard. system remains in control until the computer
Examples of operating systems are Unix, Linux, is turned off.
Android, Mac OS, and Windows.
Starting a Program

Application When a computer is first started, the


Systems Programs
Programs hardware automatically loads the operating
system and starts it running. This process is
called booting. The reason for this odd term is
 Word  Operating
that the operating system is itself involved in
processors system
getting itself running—a process that is like
 Game  Networking someone "pulling themselves up by their
programs system bootstraps". Once the operating system is
running, it is used to start up application
 Spreadshee  Programmin
programs.
ts g language
software Here is a (simplified) list of what happens
 Data base
when the user (you) starts up an application.
systems  Web site
Assume that the operating system (OS) is
server
 Graphics already running.
programs
1. The user asks to run an application.
o This is done by clicking on an In a local-area network only a few dozen
icon, making a menu choice, computers are connected together, usually all
or by other means. located within the same building. Each
computer has a network address that the
2. The OS determines the name of the
other computers use to access it. Usually the
application.
computers share a printer. There may be an
3. The OS finds the files on the hard especially powerful computer called
disk where the application and its a server whose hard disk holds application
data are stored. programs and data that the other computers
are expected to need.
4. The OS finds an unused section of
main memory that is large enough for Each computer in a network has a network
the application. interface card. This is an input/output device
that sends and receives data over cables. The
5. The OS makes a copy of the network interface cards of computers on a
application and its data in that section network are connected together with cables.
of main memory.
Wide-Area Networks
o The software on the hard disk
is unchanged; main memory Large organizations need to connect many
holds a copy of what is on more computers than can be handled with a
disk. local area network. A wide-area network can
connect thousands of computers together
6. The OS sets up resources for the over great distances. The long distance
application. connections are made by using optical fiber,
7. Finally, the OS starts the application telephone lines, microwave radio, and satellite
running. communications. Each computer in the
network has a network address (as with local-
As the application runs, the OS is there in the area networks) to uniquely identify it.
background managing resources, doing input
and output for the application, and keeping Wide-area networks use a variety of special
everything else running. hardware to manage the flow of data. When
two computers share data, this hardware
Networks makes it appear that the two computers are
A computer network consists of two or more connected together directly. In reality, there
computers connected so that they can may be dozens of network devices between
exchange data and programs. When a the two computers.
computer is a member of a network, the All these devices use the same method for
programs it runs and the data it uses can be dealing with data. Without a common method
on the hard disk of some other computer on of dealing with data, a large network would
the network. In business and industrial become a hopeless muddle. An agreement
settings, most computers are on a network. about how to represent and transmit data
The operating system that runs on a over a network is called a protocol. Usually
networked computer must manage its share large networks use a protocol called TCP/IP
of the network (along with managing all its (for transmission control protocol / internet
other responsibilities). The operating system is protocol).
able to find programs and data that are stored
on other network computers, and copy them World Wide Web
into its own main memory.
Remember that important idea (discussed notes over the Web, you have been linking
several pages back): between Web pages by using hyperlinks.

Fundamental Idea: Both programs and data A Web browser usually displays a hyperlink in
are saved in computer memory in the same a distinguishing color (usually blue). When you
way. The electronics of computer memory click on it, the browser asks the operating
(both main memory and secondary memory) system to get a particular Web page from
make no distinction between programs and another computer connected to the Internet.
data.
The Web page to get is specified with
Communications equipment makes no a uniform resource locator URL. A URL
distinction between programs and data, specifies the exact computer (among all the
either. It is all information as far as it is Internet computers in the world) and the
concerned, and all information is transmitted exact Web page on that computer.
the same way. The Internet is like a worldwide
To see some examples of URLs, keep watching
package delivery service. It is concerned with
the box at the top of your browser labeled
moving packages from one address to
"Address".
another, without concern about what is in the
packages. CHAPTER 2 — Analog and Binary
The Internet provides the hardware and the Signals
information transmission protocols for
the World-Wide Web. Data intended for the Everyone knows that computers are "digital"
Web is transmitted over the Internet just like and that they use "binary" numbers. You
any data. What makes Web data special is that probably have some idea of what these terms
it is intended for Web browsers (such as the mean. But we need to be clear about their
one you are probably looking at). A browser is precise meaning and to be clear about why
a program that can read Web pages and computers are digital.
display them in a nicely formatted way. Binary
A Web page is a package of data that contains Binary means "two states." The two states are
information on how it is to be displayed on a sometimes called "1" and "0", or called "true"
monitor. This information is given using a and "false", or called "on" and "off", (or other
language called Hypertext Markup Language names.) The essential characteristic is that a
(HTML). If you want to see the HTML that single binary device can be in just one of two
describes this page, look at the menu at the possible states.
top of your Web browser, and select
Tools/Web Developer/Page Source. For older A bit is a single on/off value.
browsers, select View in the menu then left- A good example is a toggle switch, such as a
click on Source. On some browsers, hit light switch. You can turn it on or off but not
control-U. This will bring up a new window (in normal operation) anything else. A light
with the HTML of this page in it. After you are switch holds one bit of information.
done viewing, close the window by clicking on
the close button in its upper right corner (the A light dimmer is not a binary device: it has
button marked with X). many positions between off and fully on. If
you want a light dimmer to be set to 25%, you
Hyperlinks must carefully adjust it.
One Web page is connected to another with Why Computers use Binary
a hyperlink. If you have been reading these
There are many advantages to binary. Here just dropped into place. The method is robust
are four (somewhat overlapping) important and reliable; mistakes can be corrected. The
reasons for using binary: type can be reused many times.

1. Binary devices are Simple and easy to Advances in technology often lead to easy
build. ways to do previously difficult tasks.
Woodcarving is complex; setting type is easy.
2. Binary signals are Unambiguous
Building special-purpose electronic equipment
(which gives them noise immunity).
is complex; programming a general-purpose
3. Flawless copies can be made of binary computer is (relatively) easy.
data.
The computer revolution (ca. 1950–) is often
4. Anything that can be represented with compared to the Gutenberg revolution (ca.
some sort of pattern can be 1450–).
represented with patterns of bits.
Advantage of Binary 2: Unambiguous Signals
These characteristics of binary were realized
Here again are the advantages of binary:
by Claude Shannon, a mathematician at Bell
Telephone Laboratories. His 1948 paper A 1. Simple, easy to build.
Mathematical Theory of Communication is
2. Unambiguous signals (hence noise
the foundation of information theory and
immunity).
much of computer science.
3. Flawless copies.
Advantage of Binary 1: Simple, easy to build
4. Anything represented with patterns
An on/off switch is simple and easy to
can be represented with patterns of
build. An on/off switch moves two pieces of
bits.
metal together or moves them apart. A light
dimmer must gradually and smoothly change Unambiguous Signals: Consider Paul Revere,
the current that reaches the light. It has more waiting for news of the attack of the British
components that an on/off switch and must troops. He is expecting to see a signal lantern
be carefully assembled. An accurate dimmer in the tower of Old North Church telling him
(where 25% means exactly 25%) is even how the British are attacking:
harder to build.
1.32456 if by land, 1.71922 if by sea.
The same is true for the tiny devices inside of
a silicon chip. Silicon on/off switches are The signal shines out! ...but Paul Revere's
relatively easy to fabricate. The devices are famous ride is delayed for several hours as he
cheap, small, and reliable, and millions of tries to figure out exactly how bright that
them fit into a small area. signal is.

Simplicity Lack of ambiguity is a tremendous


advantage. The signal that Paul Revere was
Carving a block of wood into a book page actually waiting for that night in 1775 was:
requires great technical and artistic skill. The
task is complex and labor intensive. A small One (lantern) if by land, and two (lanterns) if
mistake might ruin the whole block. The by sea.
Renaissance woodcarvers were as skilled as ...an easily interpreted signal. All Paul Revere
woodcarvers ever have been. had to do was count. Such signals are
Setting type is easy. Little artistic or technical called discrete because they have a fixed
skill is needed. Individual pieces of type are
number of definite states. Sometimes the Imperfect Transmission
word digital is used to mean the same thing.

An Analog Signal

The "ons" and "offs" of previous signal are


clear. But what if the signal is sent down a
long wire and someone nearby turns on a
An analog signal may continuously change in
vacuum cleaner? The graph shows the signal
value. Its values can be anything within a
at the other end of the wire.
range of values, and its exact value at any time
is important. The graph represents an audio Even though the signal is noisy (at the analog
signal. The exact value at each time is part of level), the binary values are transmitted
the information it contains. For example, the perfectly. You (and the electronics) can still tell
value at time "T2" must be measured exactly. that at time T1 the signal represents "off" and
that at time T2 the signal represents "on" The
Now say that you are observing the voltage of
receiving end just needs to get the binary
a wire. It has been agreed that any voltage
values.
below a threshold will be counted as an "off"
signal, and that any value above the threshold Since only the "on" "off" information matters,
will be counted as an "on" signal. the analog noise is irrelevant, and the original
signal is received perfectly (so far as the
Binary Signal
binary information goes.)

Advantage of Binary 3: Flawless copies can


be made.

Analog signals usually continuously change


their value. The information they convey is
contained in the exact value at any instant.

However, by using a threshold, a signal can


Review the advantages of binary:
represent binary data ("on/off" data). Such a
signal is called binary signal. 1. Simple and easy to build

It is easy and fast to determine if a voltage is 2. Unambiguous signals (noise


above or below a threshold. The signal in the immunity)
figure is "off" at time T1 and then "on" at time
3. Flawless copies
T2.
4. Anything represented with patterns second. The symbol MHz means megahertz, a
can be represented with patterns of million (106) clock ticks per second. The
bits. symbol GHz means gigahertz, a billion (109)
clock ticks per second.
Flawless copies can be made: The receiver of
the signal is only interested in the binary A 2 GHz processor checks binary values two
values. All it has to do it check if the signal is billion times in each second. In between these
above or below the threshold. This can be times values are allowed to change and settle
done perfectly (as long as the noise is not too down. The faster a processor chip is, the more
great.) For example, the picture shows the times per second values can be tested, and
noisy signal with the on/off values recovered the more decisions per second can be made.
from it.
Advantage of Binary 4: Representing
The original signal has been recovered Anything
flawlessly. This process can occur as many
Recall that last advantage of binary:
times as needed with a perfect copy made
each time. This is essential in a computer  Anything that can be represented with
system, where bit patterns (patterns of one patterns can be represented with
and zero, or on and off) are copied back and patterns of bits.
forth between the processor and memory
millions of times a second. The copies have to Since data of all kinds is stored in computer
be perfect. memory (main and secondary) using the same
electronic methods, this means that endless
Clocks perfect copies can be made of any type of
data or program.

Any system of symbols can be translated into


bit patterns. An example is how English
characters are represented as eight-bit
patterns. The agreement about what patterns
represent what characters is called ASCII. The
hardware and the software of a computer
system (usually) follow this agreement when
the data is "text". (You will learn more about
Digital systems are built so that the on/off this later). Other types of data (non-character
(binary) value is tested only at certain points data) are represented using other methods.
in time. This gives the wire (or other device)
time to change. This is why computer systems More on Representing Anything in Binary
have a clock. The clock generates ticks, which Japanese and Chinese characters have been
are points in time when signals may be assigned bit patterns, and computers can
measured. In the picture, T1 and T2 are ticks. manipulate those characters just as easily as
The clock keeps all these time points ASCII. Unicode is an agreement created by an
synchronized. Faster clocks mean wires can be international committee on how to represent
tested more times per second, and the whole characters using 16 bits. Here is a 16-bit
system runs faster. pattern 111110011111110 and here is the
character it represents in Unicode:
Processor chips are often described in terms
of their clock speed. Clock speed is measured
in Hertz, where one Hertz is one clock tick per
Say that the international committee decides represent things using binary in ways that are
to represent a new Chinese character. How useful. For example, figuring out how best to
can they do this? Easy: they find a bit pattern represent video, image, and audio data.
not yet used to represent any symbol and
Important Point:
assign the new character to that pattern.
Computer memory (of all types) holds bit
The correspondence between human
patterns, and nothing else. What those bit
language symbols and bit patterns is
patterns represent depends on how they are
arbitrary. All you have to do is be sure that you
used.
are using enough bits so that all the symbols
of the language have a unique bit pattern to CHAPTER 3 — Computer Memory
represent them.
Characteristics of Computer Memory
Symbols and Patterns
Main memory is as vital as the processor chip
Recall that last advantage of binary: to a computer system. Fast computer systems
 Anything that can be represented with have both a fast processor and a large, fast
patterns can be represented with memory. Here is a list of some characteristics
patterns of bits. of computer memory. Some characteristics
are true for both kinds of memory; others are
What about representing things other than true for just one.
the written characters of a language or audio
or video signals? What about Truth and What do you remember about computer
Beauty? What about the Ultimate Meaning of memory from chapter one? In the table,
Life† ? This is a deep topic, and entire books decide what is true for main memory and for
have been written on it. secondary memory. (Click on the buttons to

Here is a very sloppy discussion: Pick some


subject. Use English sentences to describe it.
Represent those sentences in ASCII
(characters encoded as bit patterns.) Now the
subject is represented in binary. If something
can be represented in English, then it can be
represented in binary.

Notice that this says nothing about "meaning"


or "understanding." Printed books don't
understand their own contents. A digital
version of the book (say on CD ROM) doesn't
understand the book, either. It merely holds
the information waiting for a human mind to
do the understanding. However the book has
been represented as bit patterns.
see if you are correct.)
Nobody said that binary representations are Bit
easy to use. Some representation methods are
In both main and secondary memory,
very useful for computers (for instance, using
information is stored as patterns of bits. Recall
binary patterns to represent numbers), others
from chapter two what a bit is:
are nearly useless. Much of the work that
computer scientists do is figuring out how to
A bit is a single on/off value. Only these two a voltage signal in between.) From main
values are possible. storage it is copied (again with a voltage signal
in between) to a network interface card,
The two values may go by different names,
which temporarily holds it in many transistors.
such as true/false, or 1/0. There are many
From there it is sent as an electrical signal
ways in which a bit can be implemented. Here
down a cable.
are some ways that bits are implemented:
Along the route to your computer, there may
 A mechanical electrical switch (like a
be dozens of computers that transform data
light switch.)
from an electrical signal, into main memory
 Voltage on a wire. transistor form, then back to an electrical
signal on another cable. Your data may even
 A single transistor. be transformed into a radio signal, sent to a
 A tiny part of the surface of a satellite (with its own computers), and sent
magnetic disk. back to earth as another radio signal.
Eventually the data ends up as data in your
 A tiny part of the surface of a video card (transistors), which transforms it
magnetic tape. into a TV signal for your monitor.
 A hole punched in a card. The point of all of this is that the actual
 A tiny part of the light-reflecting information (in this example the picture) does
surface of a CD. not change from one medium to the next.

 Part of a radio signal. This easy transmission and copying of


information is a major part of the computer
 Part of an audio signal. revolution, perhaps even more important than
the actual computing that computers do.
 Many more ways
Byte
The implementation of bits is different in main
memory and secondary memory, but logically,
po
both types of memory store information Number of
Name wer
represented as bit patterns. Bytes
of 2
Copied Information

Information stored in binary form does not byte 1 20


change when it is copied from one medium to
another. Also, an unlimited number of such kilobyt
copies can be made (remember the 1024 210
e
advantages of binary.) This is a very powerful
combination. You may be so accustomed to
this that it seems commonplace. When you mega
1,048,576 220
download an image from the Internet, the byte
data has been copied many dozens of times,
using a variety of storage and transmission gigaby 1,073,741,82
methods. 230
te 4
It is likely, for example, that the data starts out
on magnetic disk and is then copied to main
storage of the web site's computer (involving
when a binary device is working it is either
teraby 1,099,511,62 40
2 "on" or "off", never in-between.)
te 7,776
The address of a byte is not explicitly
One bit of information is so little that usually contained in memory. When the processor
computer memory is organized into groups of needs to access the byte at a particular
eight bits. Each eight bit group is called a byte. address, the electronics of the computer
"knows how" to find that byte in memory.
One byte is about enough memory to hold a
single character. When more than eight bits Contents of Main Memory
are required for some data, several of bytes
are used. Typically, four bytes are used to Main memory (as all computer memory)
represent integers. stores bit patterns. That is, each memory
location consists of eight bits, and each bit is
Often very much more than eight bits are either 0 or 1. For example, the picture shows
required for data, and thousands, millions, or the first few bytes of memory.
even billions of bytes are needed. These
amounts have names, as seen in the table. The only thing that can be stored at one
memory location is eight bits, each with a
If you expect computers to be your career, it value of 0 or 1. The bits at a memory location
would be a good idea to become familiar with are called the contents of that location.
this table. The only number you really need to
remember is that a kilobyte is 1024 Sometimes people will say that each memory
bytes. Often a kilobyte is called a "K", a location holds an eight bit binary number. This
megabyte is called a "Meg", and a gigabyte is is OK, as long as you remember that the
called a "Gig". "number" might be used to represent a
character, or anything else.
The table lists the number of bytes, not bits.
So one K of memory is 1024 bytes (which The information that a particular pattern
happens to be 1024*8 == 8,192 bits). represents depends on its context (how a
program is using it.) You cannot look at an
Picture of Main Memory arbitrary bit pattern (such as those in the
picture) and say what it represents.
Main memory consists of a very long list of
bytes. In most modern computers, each byte Reading and Writing Memory
has an address that is used to locate it. The
picture shows a small part of main memory: The processor can do two fundamental things
with main memory:
Each box in this picture represents a single
byte. Each byte has an address. In this picture 1. It can write a bit pattern to a byte at a
the addresses are the integers to the left of given memory location.
the boxes: 0, 1, 2, 3, 4, ... and so on. The o The previous bit pattern in
addresses for most computer memory start at that location will be
0 and go up in sequence until each byte has destroyed.
an address.
o The new bit pattern is now
Each byte contains a pattern of eight bits. saved for future use.
When the computer's power is on, every byte
contains some pattern or other, even when 2. It can read a bit pattern from a byte
those bytes are not being used for from a given location.
anything. (Remember the nature of binary:
o The processor gets the bit program are located in main memory, so
pattern stored at that those locations will not change.
location.
When you write a program in Java (or most
o The contents of that location other languages) you do not need to keep
are NOT changed. track of memory locations and their contents.
Part of the purpose of a programming
For example, if the processor needs to get the
language is to do these things automatically.
byte stored at location 5, it can read it. It
gets 0110 1110 as the data it needs (but Hard Disks
location 5 in memory does not change.)
The hard disk of a computer system records
Most processors can write (and read) more bytes on a magnetic surface much like the
than a single byte at a time. This speeds things surface of audio tape. The recording (writing)
up. But the two operations above are and reading of the data is done with
fundamental. a read/write head similar to that used with
audio tape.
Programs and Memory
The picture shows one disk and one
read/write head at the end of a movable
arm. The arm moves in and out along a radius
of the disk. Since the disk is rotating it will
record data in a circular track on the
disk. Later on, to read the data, it must be
moved to the right position, then it must wait
until the rotating disk brings the data into
position. Just as with audio tape, data can be
read without changing it. When new data it
recorded, it replaces any data that was
The processor has written a byte of data at previously recorded at that location. Unlike
location 7. The old contents of that location audio tape, the read/write head does not
are lost. Main memory now looks like the actually touch the disk but skims just a little
picture. bit above it.

When a program is running, it has a section of Usually the component called the hard disk of
memory for the data it is using. Locations in a computer system contains many individual
that section can be changed as many times as disks and read/write heads like the above. The
the program needs. For example, if a program disks are coated with magnetic material on
is adding up a list of numbers, the sum will be both sides (so each disk gets two read/write
kept in main memory (probably using several heads) and the disks are all attached to one
bytes.) As new numbers are added to the sum, spindle. All the disks and heads are sealed into
it will change and main memory will have to a dust-free metal can. Since the operation of a
be changed, too. hard disk involves mechanical motion (which
is much slower than electronic processes),
Other sections of main memory might not reading and writing data is much slower than
change at all while a program is running. For with main memory.
example, the instructions that make up a
program do not (usually) change as a program Files
is running. The instructions of a running Hard disks (and other secondary memory
devices) are used for long-term storage of
large blocks of information, such as programs system has to keep track of everything, all
and data sets. Usually disk memory is other programs ask it to do file manipulation
organized into files. tasks. For example, say that a program has just
calculated a set of numbers and needs to save
A file is a collection of information that has
them. The following might be how it does this:
been given a name and is stored in secondary
memory. The information can be a program or 1. Program: asks the operating system to
can be data. create a file with a name RESULTS.DAT

Information in a file is represented the same 2. Operating System: gets the request;
as with any digital information — it consists of finds an unused section of the disk
bits, usually grouped into eight bit bytes. Files and creates an empty file. The
are frequently large; their size is measured in program is told when this has been
kilobytes or megabytes. completed.

If you have never worked with files on a 3. Program: asks the operating system to
computer before study the documentation save the numbers in the file.
that came with your operating system, or look
4. Operating System: gets the numbers
at a book such as Windows for Dummies (or
from the program's main memory,
whatever is appropriate for your computer.)
writes them to the file. The program is
One of the jobs of a computer's operating told when this has been completed.
system is to keep track of file names and
5. Program: continues on with whatever
where they are on its hard disk. For example,
it is doing.
in DOS the user can ask to run the program
DOOM like this: So when an application program is running, it
is constantly asking the operating system to
C:\> DOOM.EXE
perform file manipulation tasks (and other
The "C:\>" is a prompt; the user typed in tasks) and waiting for them to be
"DOOM.EXE". The operating system now has completed. If a program asks the operating
to find the file called DOOM.EXE somewhere system to do something that will damage the
on its hard disk. The program will be copied file system, the operating system will refuse to
into main storage and will start running. As do it. Modern programs are written so that
the program runs it asks for information they have alternatives when a requests is
stored as additional files on the hard disk, refused. Older programs were not written this
which the operating system has to find and way, and do not run well on modern
copy into main memory. computers.

Files and the Operating System Types of Files

Most collections of data outside of main As far as the hard disk is concerned, all files
storage are organized into files. Keeping track are the same. At the electronic level, there is
of all this information is one of the jobs of the no difference between a file containing a
operating system. If the computer is part of a program and a file containing data. All files are
network, keeping track of all the files on all named collections of bytes. Of course, what
the computers is a big job, and involves all the the files are used for is different. The
operating systems on the network. operating system can take a program file, copy
it into main memory, and start it running. The
Application programs (including programs that
operating system can take a data file, and
you might write) do not directly read, write,
create, or delete files. Since the operating
supply its information to a running program Machine Instructions
when it asks.
Users and programmers of computers usually
Often then last part of a file's name don't think about the billions of tiny electronic
(the extension) shows what the file is operations that go on each second. The
expected to be used for. For example, situation is (very roughly) similar to when you
in mydata.txt the .txt means that the file is are driving your car. You think about the "big
expected to be used as a collection of text, operations" it can perform, such as
that is, characters. "accelerate", "turn left", "brake", and so on.
With doom.exe the .exe means that the file is You don't think about tiny operations, such as
an "executable," that is, a program that is the valves in your engine opening and closing
ready to. With program1.java the .java means 24,000 times per minute or the crankshaft
that the file is a source program in the spinning at 3000 revolutions per minute.
language Java (there will be more about
Each tiny electronic operation that a processor
source programs later on in these notes.) To
core can perform is called a machine
the hard disk, each of these files is the same
operation. A processor (a "machine")
sort of thing: a collection of bytes holding bit
performs these one at a time, but billions of
patterns.
them in a second.
CHAPTER 4 — The Processor A machine instruction consists of several
Electronic Operations of a Processor bytes in memory that tell the processor to
perform one machine operation. The
When a program is running on a computer the processor looks at machine instructions in
processor is constantly performing very many main memory one after another, and
tiny electronic operations. performs one machine operation for each
For example, one such operation reads one machine instruction. A collection of machine
byte of data from main memory into the instructions in main memory is called
processor. Another operation tests if one of a machine language program or (more
the bits in a byte is a 1 bit or a 0 bit. Most commonly) an executable program.
processors are able to perform several Don't panic if the above seems
thousand types of tiny operations like these, incomprehensible. It takes some getting used
and can perform billions of them per second. to. (And to really understand it all takes
Those are the only things that a processor can several courses.)
do. It has a set of tiny electronic operations Machine Language Program
that it can to perform, and that is all. These
tiny electronic operations are performed one This is, of course, a silly example. Actual
at a time. But billions of them are performed processors have many more machine
per second, and billions of small operations instructions and the instructions are much
can add up to a large and useful action. more detailed. A typical processor has a
thousand or more different machine
Everything that a processor does is built out of instructions. Those instructions do not directly
these tiny operations! Luckily, you don't need affect any output device (such as our light
to know the details of these operations to bulb.)
write programs in Java. The purpose of a high-
level language like Java is to organize the tiny Even the simplest controller has much more
electronic operations into large, useful units memory. But the essential ideas of the
represented by program statements. example are these:
 A machine language program is a A modern processor executes billions of
sequence of machine language instructions per second. A program without
instructions in main memory. loops would execute for only a few seconds
even if it had billions of instructions.
 A machine instruction consists of one
or more bytes (in this example, only A typical processor is made up of millions of
one). transistors on a small wafer of silicon called
an integrated circuit (also called a chip.) The
 The processor runs a program one
light bulb's processor could probably be built
machine instruction at a time.
with just a few hundred transistors. Integrated
 All the little machine operations add circuits are used for other electronic parts of a
up to something useful. computer. For example main memory is
implemented with memory chips.
In days long ago, the ones and zeros of a
machine language program were entered into Most modern processor chips have two or
main memory by flipping switches on the more processors on them. Each of the
front panel of a computer. The on-or-off state processors on the chip is called a "processor
of each bit was displayed by lights. You may core" or often just called a core. Each core has
have seen this in old science fiction movies. the same set of tiny electronic operations and
These days there are more convenient ways to runs programs independently of the other
put ones and zeros into main memory. But the cores. When a program is running, it runs on a
idea is still the same: machine instructions are single core, which performs the tiny electronic
patterns of ones and zeros, and data are operations of the program one at a time.
patterns of ones and zeros.
Different Processors
Executing Instructions
There are many types of processors used in
The word "execute" is often used to mean computer systems. You probably know
"perform the machine operation that an something about the processors used in many
instruction asks for." So you can say that desktop computers, Intel Corporation's Core
"execute the instruction 00000000 to stop the processors. But there are other types of
processor," or "billions of instructions execute processors, such as the processors used in cell
per second." "Execute" is also used for an phones and game machines. A computer
entire program or part of a program: "to system is designed around its processor. The
execute the program, turn the switch to on." electronics of a computer system are designed
for a particular type of processor.
Most programs have groups of instructions
that are executed again and again. The light Different types of processors have different
bulb program does this with an instruction machine operations and different machine
that causes the processor to return to the languages. A machine language program for a
beginning of the program and so to repeat typical Intel system would make no sense to a
what it just did. computer built around a different processor
type.
A group of machine instructions that executes
repeatedly is called a loop. However, the machine operations available
with all types of processors can be used to
You will in the near future write programs in build the same things. All processor types
Java that run continuously. Underneath your have enough power in their little machine
program, way down at the machine level, operations to create the same large
there will be machine operations performing a applications. Anything one processor can do
loop.
with its machine language program another The machine operations that correspond to
processor can do with a program written in its this big operation set up a part of main
machine language. For example, cell phones memory to hold a number, store the number
are built around a variety of processor types, zero there, and arrange things so other parts
but all cell phones can do the same things. of the program can use it. It might take a
hundred machine operations to do all
The architecture of a processor is the choices
this. Obviously, it is easier for a human
that have been made for its machine
programmer to ask for all these operations
operations, how they have been organized
using C.
and implemented, and how they interact with
main memory and other Source Programs
components. Architecture is concerned with
Programmers create programs by writing
the general plan and functions of a processor;
commands in a high level language. A high
it is not much concerned with electronic
level language program consists of lines of
details. A course in computer architecture is
text that have been created with a text editor
part of most computer science departments
and are kept in a file on the hard disk. For
High Level Programming Languages example, here is a complete program in C
(Java will be discussed later):
It is rare for programmers to write programs in
machine language like we did for the light #include <stdio.h>
bulb. The executable files (the directly
main()
runnable machine language programs) for
most applications contain hundreds of {
thousands (or even millions) of machine
language instructions. It would be very hard to int sum = 0;
create something like that from scratch. sum = 2 + 2;
As an experiment, look through your hard disk printf( "%d\n", sum );
with the file listing utility (the "Explorer" on
Microsoft systems.) Look at the size of }
the something.EXE files. There are about four This program could be saved on the hard disk
bytes per machine instruction on Intel in a file called addup.c. Like all files, it consists
processors, so divide by four to get the of a sequence of bytes. Since it is a text file,
number of instructions. these bytes represent character data. You can
Most programs are created using a high level edit the file with a text editor and print the file
programming language such as Java, C, C++, on a printer. It does not contain machine
or BASIC. With a high level language, a instructions. If the bytes are copied into main
programmer creates a program using memory, they cannot run as a program
powerful, "big" operations which will later be without some extra work being done.
converted into many little machine A source program is a text file that contains
operations. instructions written in a high level language. It
For example, here is a line from a program in can not be executed (made to run) by a
the language C: processor without some additional steps.

int sum = 0; A source program is also called a source


file, source code, or sometimes, just source.
This declares and initializes a variable to zero
(a big operation). Usually a source program is translated into a
machine language program. An application
program called a translator takes a source
program as input and produces a machine
language program as output.

A machine language program is also called


an executable program, executable file, or
sometimes, just executable.

For example, the C program addup.c could be


translated into an executable program. The
executable program might be
called addup.exe and can be saved on the
hard disk. Now the executable version of the
program can be copied into main memory and
executed.

The word compile means the same thing


as translate. So one can say that a source
program is compiled into an executable
program.

You might also like