Computers - Department of Electronic and Information

Download Report

Transcript Computers - Department of Electronic and Information

THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
ENG224
Information Technology
Part I: Computers and Internet
Part II: Networking
– Dr W.Y. Tam, EIE
Part III: Data Processing
– Dr. Thomas Choi, COMP
1
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
ENG224
Information Technology
Part-I
Computers and Internet
2
Lecturer:
Dr. Wai-yip Tam
Room:
E-mail:
Web page:
DE604 Tel: 27666265
[email protected]
www.eie.polyu.edu.hk/~em/it0607.htm
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
Contents




3
Introduction to Computers
Operating System Case Study: Linux
Internet
Internet Programming – XHTML
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
Information Systems
Information Technology
Information
Engineering
4
Electrical
Engineering
Electronic
Engineering
Mechanical
Engineering
System
Engineering
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
An example – Mobile Banking

Information Systems
–

Information Technology
–
5
To study the various issues in running and managing a
mobile banking business
e.g. Risk management, Organizational behavior,
Psychologies of customers, etc.
To optimally integrate the required technologies to enable
a mobile banking business
e.g. Mobile Networking, Security control, Data
processing for mobile transactions, etc.
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
An example – Mobile Banking (Cont)

Information Engineering
–
6
To study the techniques required for the implementation
of a mobile banking business
e.g. Data transmission through mobile networks, Mobile
handset design for data transmission, Data encryption
algorithms, Database design and interface, etc.
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
Requirements of an IT Practitioner
7

To understand the needs of the customers of different
information systems and the organizations that provide
those systems

To know clearly well the attributes, limitations,
strengths and the integration methods of the
technologies that enable those information
systems

To understand the basic principles of the information
engineering techniques for the implementation of those
information systems
THE HONG KONG
POLYTECHNIC UNIVERSITY
Department of Electronic and Information Engineering
Three basic elements of IT
Computer
Networking
Data Processing
8
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
1. Introduction to Computers
9
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Reference
Peter Norton, Introduction to Computers, McGraw Hill,
5th Ed, 2003
G. Michael Schneider and Judith L. Gersting,
Invitation to Computer Science, 3rd Ed, 2004.
10
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
ENIAC
(Electronic Numerical Integrator And Calculator)
• The first practical
computer
• Built in 1945, weighed
more than 30 tons
• Require 1500 sq. feet
In 1949, Popular Mechanics magazine predicted
“computers in the future may perhaps only weigh 1.5
tons !!!”
11
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Components of a computer system
12
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware
13
(Single In-line Memory Module)
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware

CPU: Central Processing Unit
–
–
–
–
–
14
Brain of a computer
Manages all devices and performs the actual processing
of data
Carry out instructions given by user
For Personal Computer (PC), the CPU is usually
included in a single Integrated Circuit (IC) chip (called
Microprocessor)
Nowadays, one or more microprocessors (chips) can be
used to form a CPU
 Parallel Processing
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware

Input and Output devices (I/O devices)
–
–
–
–
15
Interface between the outside world and the computer
system
Input devices: keyboard, mouse
Output devices: monitors, printers
Other I/O devices: scanner, joystick, touch screen, …
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware

Memory
–
Internal memory / Main memory
 Random Access Memory (RAM)
–
–
–
16
Main feature 1: volatile
 requires continuous supply of electrical power to
retain information
Main feature 2: cheap in terms of bytes per dollar
 suitable for large volume data storage
Functions:
 Receive commands / data from keyboard
 Store information ready to be sent to output
 Store currently running programs/their data
 Store immediate data generated by the currently
running programs
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers

Another kind of memory
 Read
–
–
–
–
17
Only Memory (ROM)
Main feature 1: non-volatile
 data retain even when the power is off
Main feature 2: relatively expensive and can only be written
once
 suitable for storing essential data but in small volume
Usually used for system boot up and basic control of I/O
devices
 When a computer first powers up, nothing is in RAM
 Need ROM to store the instructions to set up various I/O
devices, such as disk interface card,
video adapter card,
sound card, etc.
ROM is used to store BIOS (Basic Input/Output Systems)
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware

Storage devices
–
External memory




18
Non-volatile
Used to store programs/data for future use
Also used when the capacity of the internal storage is
insufficient to keep the currently running programs and the
data required
Floppy disks, hard disks, CD ROMs, Magnetic tapes
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware

Main differences between storage & memory:
–
–
–
19
Larger capacity in storage than in memory
Data in storage are retained while data in memory
disappear when power is off
Storage is much cheaper than memory
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers

Buses
–
–
Path along which “bits” are transmitted
Linking up the CPU, Memory and I/O devices
Address
CPU
Instructions /
Data
Control
Memory
I I I I I D D D I I
00
01
02
03
04
05
06
07
08
09
I I I I D D D D D D
10
11
12
13
14
15
16
17
18
19
20
I: Instruction
D: Data
20
I/O
I/O
I/O
21
22
External
Storage
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers

21
Stored Program Concept
–
In 1949, Dr John Von Neumann defined the stored
program concept that greatly affected the development of
nowadays computers
–
Suggested that program instructions should be stored in
a memory unit just like data
 Instructions: Commands of user
 Data: Information that commands work on
–
Hence rather than hardware programmable (rewire was
required for a new problem), should be software
programmable
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware - Instructions



22
Most CPUs have built in a few hundreds of standard
operations
– E.g. add, subtract, multiplication, division, AND, OR, NOT,
etc.
Each operation is represented by an instruction code
– E.g.
Add
1010100101
–
Subtract
1000100001
–
:
When an instruction code is fetched from memory to the CPU,
the CPU knows that the corresponding operation should be
performed
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware - Instructions
• A computer program is constructed by a combination of different
instruction codes
• Called as Machine Language Program, since it is written by 0 and 1,
the only language that the CPU can understand
•
Machine
Language
Program
23
0110001111000010
; the 1st instruction
0001000111100011
; the 2nd instruction
:
:
0011000100001000
; the n-1th instruction
1000001001010101
; the nth instruction
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers

Fetch and Execute
–
Every instruction should go through two phases of processing:
fetch & execute
Address 20
02
01
05
00
CPU
Instructions /
II
D
Data D
00
Control W
R
W
10
R
RW
W
02
05
01
20
00
24
EXECUTE
FETCH
Memory
I I I I I D D D I I
DD
01
02
03
04
05
06
07
08
09
I I I I D D D D D D
11
12
13
14
15
16
17
18
19
20
I/O
I/O
I/O
21
22
I: Instruction
D: Data
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
• Fetch
During the fetch phase, the control unit gets the next
instruction from memory and moves it into the CPU
Example:
– Send address 01 to address bus
– Send control signal Read
– Get instruction I at address 00
• Execute
Example: Store data D to address 05
– Send address 05 to address bus
– Send data D to data bus
– Send control signal Write
25
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Software - Programming
• Programming – the way to generate a program
• Computer can only understand 0 and 1
• The most direct way to communicate with the computer is to use
0 and 1  Machine Language Programming
•
0110001111000010
0001000111100011
Machine
Language
Program
:
Very tedious and can make error easily
:
0011000100001000
26
1000001001010101
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Software - Assembly Language
Programming
• Assembly Language is created to help human instructs CPU to
work
• By using a tool called Assembler, assembly language program can
be converted into machine language program
Assembly Language
mov
add
mov
mov
27
ax, #0
ax, $1234
:
:
bx, #22
$2345, bx
Machine Language
Assembler
0110001111000010
0001000111100011
:
:
0011000100001000
1000001001010101
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
• Different CPU will have different set of assembly language codes
• In fact, to understand an assembly language program, we need to
first understand the architecture of the CPU
Registers
ax
bx
cx
dx
Memory
ALU
CPU
28
ALU: Arithmetic and Logic Unit
: For doing arithmetic and
logic operation)
Registers: Some very fast memory
inside the CPU chip
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Registers
ax
bx
cx
dx
Memory
ALU
CPU
29
A simple assembly
language program
mov ax, #0
; ax =0
loop: add ax, $1234
; add the content at memory
; address 1234 to ax
mov bx, #22 ; bx = 22
add ax, bx ; ax = ax + bx
jmp loop
; go to the instruction with
; label “loop”
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Software - High Level Language
Programming
• Assembly language programming is still too complicated for
general users
• They are far from human used language
e.g. “Set W equal to W plus X minus Y divided by Z”
“Repeat the next sequence of instructions until X is less
than 0 or Y equals Z”
• A high level language is required to close the gap between human
and computers
30
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Executable
Machine Language Program
Linker
1011010101
0101010101
:
Library
Object code
Compiler
main()
{ cout <<
“Hello!”;
}
High Level Program
31
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers

Machine Language Programming
–

Assembly Language Programming
–
–
–

Advantage: Less complicated than Machine Language. Usually
generate more efficient code than HLL
Disadvantage: Need the understanding of CPU structure. Still difficult
to program
Application: Sometimes use in the programming of embedded
systems (e.g. CPU of printer, washing machines, etc.)
High Level Language Programming (such as C/C++)
–
–
–
32
No application nowadays
Advantage: Need the least amount of effort to write a program
Disadvantage: The program written may not be optimal (depends on
the compiler)
Application: For large scale programs
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hardware & Software
Banking System / Web Browser /
Media player
GUI /
Command interpreter
Application
Software
System Software
Operating System
Physical devices /
Micro-architecture level
33
Hardware
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers


34
User interacts with application software
System software enables the application software to
interact with computer CPU and help the computer to
manage its internal resources (hardware)
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Application Software


Develop to fulfill certain needs of users
Either customized or packaged
–
Customized software


–
Packaged software


35
Designed for a particular customer according to their needs
Payroll, inventory control, …
Developed for general use
Microsoft word, excel, Access, power-point, …
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
System Software




36
Exists primarily for the computer itself
Hides the hardware complexities
Brings the different hardware configurations into
common platforms and accessible by the users
Consists of several programs, the most important
one is the operating system (master control
program that runs the computer)
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Operating System

Master control program
–
Manage all resources of the computer

–




37
CPU, memory, disk, monitor, network, …
Co-ordinate running programs
Operating
System
Runs as soon as the computer boots
up, until the computer shuts down
BIOS
Usually store in the hard disk and load
into the memory when the computer
starts
Need the help of BIOS for I/O devices
E.g. Windows, Unix, Linux
I/O Devices
Other
resources
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
How the OS is loaded into memory?
• When power up, nothing is in RAM. No control is possible
•
•
to the hard disk to load the OS
CPU starts to read the BIOS instructions stored in the
ROM
Things that normally perform
– Initialize all I/O devices: hard disk, video, mouse,
keyboard, CD-ROM, etc
– Load the bootstrap loader of the operating system to
RAM
– Start to execute the bootstrap loader in RAM
• The bootstrap loader further loads the other part of the
38
operating system to the RAM
ENG224
INFORMATION TECHNOLOGY – Part I
1. Introduction to Computers
Hard Disk
Bootstrap
OS loader
Disk Interface
Monitor
Video
Interface
Main Memory (RAM)
Bootstrap loader
OS
CPU
Mother Board
39
BIOS
(Stored in
ROM)