Download Chapter 9

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Stream processing wikipedia , lookup

Go (programming language) wikipedia , lookup

Compiler wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Parallel computing wikipedia , lookup

Very long instruction word wikipedia , lookup

Assembly language wikipedia , lookup

ILLIAC IV wikipedia , lookup

Transcript
Chapter 9
Fluency with Information Technology
4th edition
by Lawrence Snyder
(slides by Deborah Woodall : [email protected])
1
Instruction Execution Engine
•The computer is an "instruction execution
engine."
•Computers follow instructions precisely.
•They don’t have the mind of a human being.
2
Five Basic Parts of a Computer
• Arithmetic and Logic Unit (ALU)
• Control Unit (CU)
• Ram (Main Memory)
• Input device(s)
• Output device(s)
3
Five Basic Parts of a Computer
CPU
CU
ALU
Input Devices:
Register
Register
Register
Register
Register
Register
Keyboard
Mouse
Microphone
Hard drive
Flash drive
Output Devices:
RAMter
Printer
Monitor
Speakers
Hard drive
Flash drive
4
RAM (Main Memory)
• Purpose:
– Holding bin for programs currently running
– Holding bin for their data
• Size: measured in megabytes (MB) or
gigabytes (GB)
• Large memory is preferable
5
RAM is like post office boxes
• Each byte of RAM has a unique address.
• Each byte of RAM may have content as well
0
A
1
2
3
45
255
4
8
12
Add
3400,
3460,
4000
6
RAM (Main Memory)
• 1 byte can hold 1 ASCII character or a number
< 256
• 4 bytes can hold a software instruction or a
large number
7
Input/Output Devices
• Also called peripherals
• Connected via ports
• Considered add-ons
8
Input/Output Devices
• Input devices encode – convert TO high’s and
low’s
• Output devices decode – convert FROM high’s
and low’s
9
Input/Output Devices
• Some devices are for both input and output
e.g. hard drive, flash drive
• Every peripheral has a device driver
10
CPU (Processor)
• Has two primary
components
– ALU (Arithmetic and
Logic Unit)
– CU (Control Unit)
• Also in the CPU are tiny
storage bins called
registers
11
CPU or Processor
• The Control Unit (CU) works with the
Arithmetic and Logic Unit (ALU) and
the registers and
Random Access Memory (RAM)
to fetch and execute millions or billions of instructions
per second.
• The steps for handling each instruction are called the
fetch/execute cycle.
12
Fetch/Execute Cycle
• Instruction Fetch (IF)
• Instruction Decode (ID)
• Data Fetch (DF)
• Instruction Execution (EX)
• Result Return (RR)
13
Fetch/Execute Cycle
CPU
CU
PC
ALU
IR
2200
2200
ADD
800,
428,
884
14
Fetch/Execute Cycle
CPU
CU
PC
IR
2200
2200
ALU
ADD 800, 428, 884
ADD
800,
428,
884
15
Fetch/Execute Cycle
CPU
CU
PC
ALU
IR
2200
ADD 800, 428, 884
42
12
2200
ADD
800,
428,
884
16
Fetch/Execute Cycle
CPU
CU
PC
ALU
IR
2200
ADD 800, 428, 884
42
12
2200
54
ADD
800,
428,
884
17
Fetch/Execute Cycle
CPU
CU
PC
ALU
IR
2200
ADD 800, 428, 884
42
12
800
2200
54
54
ADD
800,
428,
884
18
Computer Clock
• Synchronizes the steps of the f/e cycle
• Partially determines the speed of the f/e cycle
• Speed is measured in gigahertz – billions of
clock ticks per second
19
Pipelining
• Pipelining is an "assembly line–like" process
for handling instruction execution.
• See figure 9.12
20
Pipelining
• Modern computers try to start an instruction
on each clock tick.
• So, a computer running at 1 GHz executes
somewhere around 1 billion instructions per
second.
21
Instruction Set
• Instruction set: those instructions that the CU can
decode
• There are only 100 or so
• They are very simple - most can be classified as
arithmetic, logical or move
• Complicated tasks must be expressed in terms of
combinations of the 100 or so simple instructions of
the computer’s Instruction Set.
22
Binary Machine Language Programming
• Writing instructions for the computer is what
programming is all about.
• In the earliest days of computing, programmers
wrote software using the binary instructions of the
computer’s Instruction Set - which can be directly
carried out by the hardware.
• These programs were said to be in binary machine
language.
E.g. 0000 0010 0001 1000 1010 0000 0010 0000
23
Assembly Language Programming
• Binary machine language programming was very
tedious and gave way to assembly language
programming.
• An assembly language instruction is an alternative
form of a binary machine language instruction in
which letters and recognizable numbers are used so
people can understand it.
E.g. ADD 20, 12, 24
• Assembly language instructions must be translated
into binary machine language instructions by an
assembler
24
High-Level Language Programming
• Today most programming is done using high-level
languages
e.g. C, C++, Java
• What characterizes a high-level language?
– Its instructions are more English-like
E.g. Total = Principal + Interest;
– A program requires fewer high-level language instructions
to get the job done
• High-level language instructions must also be
translated into binary machine language instructions,
usually by a compiler.
25
Operating System
A collection of programs that allows us to perform
the basic operations of our computer system
beyond the tasks built into the hardware level
• Start up the computer (boot)
• Manage I/O devices
• Manage application software
• Manage memory
• Manage the Internet connection
26
Making the Programmer’s Job Easier
• Use of powerful programming languages
• Use of previously developed software
(functional composition)
27