CS1104: Computer Organisation

Download Report

Transcript CS1104: Computer Organisation

CS1104: Computer Organisation
http://www.comp.nus.edu.sg/~cs1104
Lecture 1: Introduction
Lecture 1: Introduction






Overview
History of Computers
Application Areas
Types of Computers
Computer Configurations
Computers as Information Processors
CS1104-1
Lecture 1: Introduction
2
Lecture 1: Introduction
 Basic Machine Hardware Architecture




CPU
Memory/Storage
Main Memory
Input/Output Devices
 Basic Machine Software





Flowcharts
Languages
Operating Systems
System Utilities
Applications
 What’s in CS1104
CS1104-1
Lecture 1: Introduction
3
Overview of Part 1 (1/2)
 Number system: how is information



represented in a computer.
Boolean Algebra: the basis for logic design
and manipulation of information.
Logic gates: what are the gates used, and how
circuits can be made from gates.
Function simplification: to reduce the size of
design, increase speed, etc.
CS1104-1
Lecture 1: Introduction
4
Overview of Part 1 (2/2)
 Combinational circuits: simple circuit design
without memory.
 Sequential circuits: circuit design with
memory.
 Disk: storage techniques.
 Bus: internal communication.
 I/O: devices, technology, etc.
CS1104-1
Lecture 1: Introduction
5
History of Computers (1/4)
 Abacus invented in Babylonia in 3000BC
 Adding machine by Blaise Pascal (1642)
 Difference engine and the analytical engine by
Charles Babbage (1842)
 IBM first electromechanical computer (using
relays) designed by Howard Aiken (1937) was
based on punched cards.
 used to calculate tables of mathematical functions
CS1104-1
Lecture 1: Introduction
6
History of Computers (2/4)
 1st Generation Computers (1940s to early 1950s)
– based on vacuum tubes technology.
 1943 – ENIAC: first fully electronic computer, designed
by John Mauchly
 1944 – Mark I: Howard Aiken
 1946 – EDVAC: first stored program computers,
designed by John von Neumann
 2nd Generation Computers (late 50s to early 60s)
– based on transistors technology.
 more reliable, less expensive, low heat dissipation
 IBM 7000 series, DEC PDP-1
CS1104-1
Lecture 1: Introduction
7
History of Computers (3/4)
 3rd Generation Computers (late 60s to early 80s)
– integrated circuits (IC).
 IBM 360 series, DEC PDP-8
 IC – many transistors packed into single container
 low prices, high packing density
 4th Generation Computers (present day) LSI/VLSI
 small size, low-cost, large memory, ultra-fast PCs to
supercomputers
 5th Generation Computers (future)
 massively parallel, large knowledge bases, intelligent
 Japan, Europe and US advanced research programs
CS1104-1
Lecture 1: Introduction
8
History of Computers (4/4)
 Websites
ACM Timeline of Computing History
(http://www.computer.org/computer/timeline)
The Virtual Museum of Computing
(http://www.comlab.ox.ac.uk/archive/other/mus
eums/computing.html)
IEEE Annals of the History of Computing
(http://www.computer.org/annals/)
and others (surf the web)
CS1104-1
Lecture 1: Introduction
9
Application Areas (1/2)
 Scientific: weather forecasting, simulation, spaceprogram.
 one of the earliest application areas.
 heavy computation but small amount of data.
 Commercial: accounting, banking, inventory,
sales.
 changes nature of business – information is money.
 high data throughput, simple calculations.
 Manufacturing: numerical control, CAD/CAM,
integration.
 graphics, interfacing, device-drivers, networks.
CS1104-1
Lecture 1: Introduction
10
Application Areas (2/2)
 Real-time & Control System: air-traffic
control, aircraft,nuclear power station.
real time, very fast, safety-critical.
 Educational & Recreational
CAI software, multi-media, games, Internet,
World Wide Web.
 Telecommunication
 Network, StarHub CableTV, Singapore One.
CS1104-1
Lecture 1: Introduction
11
Types of Computers (1/2)
 Supercomputers:
 very fast (Gflops) but expensive machine($10m), vector
or parallel processors, used in scientific applications
and simulations.
 Mainframes:
 fast (>10mips) but expensive ($1m), high-throughput,
used in large commercial organisations, support many
concurrent users interactively.
 Mini-computers:
 fast but affordable ($200k), used in medium-sized
organisations (e.g. SoC), support multiple users.
CS1104-1
Lecture 1: Introduction
12
Types of Computers (2/2)
 Workstations:
 affordable ($20k) and fast single-user systems (20
riscs mips), good graphics capabilities, engineering,
network-based computing.
 Micro/Personal/Home Computers:
 cheap and affordable ($3k), transportable, home use,
good for games and as educational tool, word
processing, suitable for small enterprise.
CS1104-1
Lecture 1: Introduction
13
Computer Configurations (1/3)
 Stand-alone computer system
 Modem connection
CS1104-1
Lecture 1: Introduction
14
Computer Configurations (2/3)
 Terminals-host connections
CS1104-1
Lecture 1: Introduction
15
Computer Configurations (3/3)
 Network of computers
CS1104-1
Lecture 1: Introduction
16
Computers as Information Processors (1/3)
Driver
Example: An automobile
augments our power of
locomotion.
A computer is a device
capable of solving problems
according to designed
program. It simply augments
our power of storage and
speed of calculation.
CS1104-1
Lecture 1: Introduction
Programmer
17
Computers as Information Processors (2/3)
 Unlike previous inventions, computers are special
because they are general-purpose.
 Could be used to perform a variety of tasks.
 Computer = Hardware + Software.
 Hardware: physical components for
computation/processing; should be simple, fast,
reliable.
 Software: set of instructions to perform tasks to
specifications; should be flexible, user-friendly,
sophisticated.
CS1104-1
Lecture 1: Introduction
18
Computers as Information Processors (3/3)
Computer are Information Processors
Raw
data
Computer
system
Processed
information
Data Units:
1 bit (binary digit): one of two values (0 or 1)
1 byte: 8-bits
1 word: 1, 2, or 4 bytes, or more (depends on ALU)
CS1104-1
Lecture 1: Introduction
19
Basic Machine Hardware Architecture (1/3)
 Main Components:
 CPU (Central Processing Unit: controls devices and
processes data).
 Memory: stores programs and intermediate data.
 Input Devices: accept data from outside world.
 Output Devices: presents data to the outside world.
 An analogy with Human Information Processors:
 CPU – brain’s reasoning powers
 Memory – brain’s memory
 Input Devices – eyes, ears, sensory sub-system
 Output Devices – mouth, hands, facial and body
expressions
CS1104-1
Lecture 1: Introduction
20
Basic Machine Hardware Architecture (2/3)
Headphone
(Output)
Monitor
(Output)
Hardware box
(contains processor,
memory, buses etc.)
Mouse and Keyboard (Input)
CS1104-1
Lecture 1: Introduction
21
Basic Machine Hardware Architecture (3/3)
Network card and
CRT card
Motherboard
(Printed Circuit
Board)
Floppy disk
drive and
Hard disk
drive
Cage for
mounting drives
Slots for RAM chips
Processor
© above picture: Patterson and Hennessy
CS1104-1
Lecture 1: Introduction
22
Hardware – CPU (1/3)
 CPU = control unit + ALU + registers
 Control Unit : monitors and directs sequences of
instructions
 Execution Cycle (repeated):
 fetch (next instruction)
 decode
 execute
CS1104-1
Lecture 1: Introduction
23
Hardware – CPU (2/3)
 ALU: performs simple arithmetic and logical
operations.
 Examples: Add, subtract, and, or, invert, increment etc.
A
B
R = A op B
select
ALU
n-bits operations
R
CS1104-1
Lecture 1: Introduction
24
Hardware – CPU (3/3)
 Registers: temporary results + status information
 ACC (accumulator) – current data
 PC (program counter) – points to next instruction
 IR (instruction register) – current instruction
 MA (memory address) – address to read/write
 MB (memory buffer) – data to read/write
CS1104-1
Lecture 1: Introduction
25
Hardware – Memory/Storage (1/2)
 Purpose: to store program and data.
 Desirable Traits: fast access, large capacity,
economical, non-volatile.
 However, most memory devices do not have all
these traits.
CS1104-1
Lecture 1: Introduction
26
Hardware – Memory/Storage (2/2)
 Solution: hierarchical combination
Fast, expensive
(small numbers),
volatile
registers
main memory
disk storage
magnetic tapes
CS1104-1
Lecture 1: Introduction
Slow, cheap
(large numbers),
non-volatile
27
Hardware – Main Memory (1/2)
 Fast BUT volatile (need power to maintain data)
 Logical structure – table of memory cells/units.
addresses
M
A
R
M
B
R
CS1104-1
address
8 bits or more
0
1
2
3
memory
cells
data
2m-3
2m-2
2m-1
Lecture 1: Introduction
28
Hardware – Main Memory (2/2)
 Memory cells may be grouped into pages (say
512 consecutive words per page).
 Units
 1 KBytes = 1024 (or 210) bytes
 1 MBytes = 1024 Kbytes (or 220 bytes)
 1 GBytes = 1024 Mbytes (or 230 bytes)
CS1104-1
Lecture 1: Introduction
29
Hardware – Input/Output Devices
 Input devices: read/accept data (into computer)
 obsolete: card reader, paper tape reader
 present: keyboard, mouse, light-pen, optical char
reader
 future: voice and vision recognition.
 Output devices: write/display data (to users)
 obsolete: card & paper punch, teletype
 present: VDU (visual display unit), printers, plotters,
graphics display, sound
 future: voice synthesis.
CS1104-1
Lecture 1: Introduction
30
Basic Machine Software (1/2)
 Software is the key to making computers general
purpose.
 Software are often built hierarchically, with layers
of software providing successive higher-level of
abstractions.
 This structure is reflected by the following onion
layer view of software.
CS1104-1
Lecture 1: Introduction
31
Basic Machine Software (2/2)
Hardware
Operating system
System utilities
Applications/User programs
CS1104-1
Lecture 1: Introduction
32
Software – Flowcharts (1/2)
 The sequence of instructions of a


software/program can be graphically specified
using flowcharts.
The flowchart technique maybe a little outdated
but could still be used in a clear manner for simple
problems.
As an example, the procedure to find the roots of a
quadratic equation, ax2 + bx + c = 0, can be written
using the following equation:
roots  (b  b  4ac) / 2a
2
CS1104-1
Lecture 1: Introduction
33
Software – Flowcharts (2/2)
 This procedure can be coded in the following
flowchart:
Read
a,b,c
roots  (b  b 2  4ac) / 2a
a=0?
yes
Write
not quadratic
no
d:=b2 - 4ac
=
CS1104-1
d>0
d=0
d<0
>
<
Write
Write
Write
real root
real roots
complex roots
Lecture 1: Introduction
34
Software – Languages (1/4)
 All programs will have to be coded in some
programming language – usually text-based.
 The native language of machine is called machine
language.
 This consists of a set of primitive instructions,
coded in numbers.
 An example is “0310 0412 0512”. But can you
understand what it does?
CS1104-1
Lecture 1: Introduction
35
Software – Languages (2/4)
 Possible to use more human-readable mnemonic

instructions.
These are know as assembly language
instructions.
Mnemonic
Description
ADD 10
AC:=AC+C(10)
SUB 12
AC:=AC-C(12)
STO 12
C(12)=AC
 Normally, assembly language has a 1-to-1
correspondence with machine language.
CS1104-1
Lecture 1: Introduction
36
Software – Languages (3/4)
 Assembly language is still very primitive.
 Higher-level Languages, like Pascal, C, Fortran,
which are a little closer to English language have
been developed.
CS1104-1
Lecture 1: Introduction
37
Software – Languages (4/4)
 An example Pascal program to find roots of
quadratic equation:
read(a,b,c);
if a=0
then writeln ("not a quadratic equation")
else
begin
d := sqr(b)-4*a*c;
if d>0 then writeln ("complex roots")
else if d=0 then writeln("single root =",-b/(2*a))
else writeln ("root1=",-b+sqrt(d)/(2*a),
"root2=", -b-sqrt(d)/(2*a));
end;
CS1104-1
Lecture 1: Introduction
38
Software – Operating Systems (1/2)
 Operating System (OS) is situated directly above
hardware. It controls and manages the available
hardware resources.
 Often, OS has special access privileges to
certain categories of instructions and certain
hardware
 User programs have to go through OS for these
privileges.
CS1104-1
Lecture 1: Introduction
39
Software – Operating Systems (2/2)
 Associated Functions/Tasks:
 boots up machine
 loads user program
 allocates main memory/storage space
 schedules concurrent user programs
 drivers to service various devices (terminals, printers,
etc.)
CS1104-1
Lecture 1: Introduction
40
Software – System Utilities (1/2)
 Above the OS, there is a set of frequently
executed programs,called System Utilities. These
utilities are often packaged with OS.
 Used by programmers/analyst to help develop
applications.
 Some examples
 Editor: compose/edit user programs or data files
 Assembler: translates assembly to machine code
 Compiler: translates high-level language to
assembler/machine code
 Spooler: temporary stores print files for queuing
CS1104-1
Lecture 1: Introduction
41
Software – System Utilities (2/2)
 Some examples (continued)
 Mailer: forwards/receives mails between users
 DBMS (Data-Base Management System): centralised
management of data at a more abstract level than files
 Window Management System: multiple windows can
appear on single screen. These together with various
graphical entities (e.g. menus,panels, buttons) can be
managed by WMS.
CS1104-1
Lecture 1: Introduction
42
Software – Applications
 Word-Processors: compose/edit reports/articles
 Accounting Package: keeps track of accounting
transactions, produces daily/weekly/monthly
(profit/loss) reports
 Inventory System: keeps track of stock levels
 Personnel/Payroll System: staff records, monthly
salary
CS1104-1
Lecture 1: Introduction
43
What’s in CS1104
Software
Application (Netscape)
Compiler
Assembler
Operating
System
(Windows XP)
Processor Memory I/O system
Datapath & Control
Hardware
CS1104-1
Instruction Set
Architecture
Computer Architecture
Digital Design
transistors
Lecture 1: Introduction
Digital Logic Design
44
End of file
CS1104-1
Lecture 1: Introduction
45