Uploaded by Satish Kumar

COMPUTER PROGRAMMING LABORATORY-18CPL17-27 (1)

advertisement
COMPUTER PROGRAMMING
LABOURATORY
Sub Code: 18CPL 17 / 18CPL27
1
2
3
4
5
6
7
8
Laboratory Session-1
• Write-up on Functional block diagram of
Computer CPU, Buses
• Mother Board, Chip sets,
• Operating System & types of OS,
• Basics of Networking & Topology and NIC.
9
Functional block diagram of Computer
Arithmetic
and
logic
Input
Memory
Output
Control
I/O
Processor
10
Information Handled by a Computer
• Instructions/machine instructions
 Commands/statements to transfer information
between I/O devices, Memory
 Specify the arithmetic and logic operations to be
performed
 Source program
• Data
 Used as operands by the instructions
• Encoded in binary code – 0 and 1
11
Memory Unit
 Store programs and data
 Two classes of storage
• Primary storage
 Large number of semiconductor storage cells
 Programs must be stored in memory while they are
being executed
 Processed in words
 RAM – Random Access Memory
 Memory hierarchy – Registers, cache, main memory,
Secondary Storages
• Secondary storage – larger and cheaper
• Magnetic or Optical storages
12
Arithmetic and Logic Unit (ALU)
 Most computer operations are executed in ALU of
the processor.
 Load the operands into memory – bring them to the
processor – perform operation in ALU – store the
result back to memory or retain in the processor.
13
Control Unit
 All computer operations are controlled by the control unit.
 The timing signals are generated by the control unit to govern
the I/O transfers
Operations of a computer:
 Accept information in the form of programs and data through
an input unit and store it in the memory
 Fetch the information stored in the memory, under program
control, into an ALU, where the information is processed
 Output the processed information through an output unit
 Control all activities inside the machine through a control unit
14
Introduction to CPU
• Central processing unit is a 1 inch silicon chip called
microprocessor
• Contain tens of millions of tiny transistors
• Key components:
– Central processing unit
– Registers
– System clock
15
Microprocessor Speeds
• Measure of system clock speed
– Clock Pulses per second
– Usually expressed in gigahertz (GHz)
• Billions of machine cycles per second
• Some old PCs measured in megahertz (MHz)
• CPU cycle time – inverse of clock rate
16
17
Actions Performed by CPU
Fetch cycle
CPU:
• Fetches an instruction from primary storage
• Increments a pointer to location of next instruction
• Separates instruction into components (instruction code
and data inputs)
• Stores each component in a separate register
Execution
cycle
ALU:
• Retrieves instruction code from a register
• Retrieves data inputs from registers
• Passes data inputs through internal circuits to perform
data transformation
• Stores results in a register
18
CPU Registers
• Primary roles
– General-purpose registers: Hold data for currently
executing program that is needed frequently ()
– Special-purpose registers: Store information
about currently executing program and about
status of CPU ()
19
General-Purpose Registers
• Hold intermediate results and frequently
needed data items
• Used only by currently executing program
• Implemented within the CPU; contents can be
read or written quickly
• Limited in number -8 or 16 or 32 or 64
20
Special-Purpose Registers
• Track processor and program status
• Types
– Instruction register
– Program Counter
– Program status word (PSW)
• Stores results of comparison operation
• Controls conditional branch execution
• Indicates actual or potential error conditions
21
Word Size
• Number of bits a CPU can process simultaneously
• Increasing word size usually increases CPU
efficiency
• system bus and memory should also match the
word size
22
The Physical CPU
• Electrical device implemented as silicon-based
microprocessor
• Contains millions of switches, which perform
basic processing functions
• Physical implementation of switches and circuits
23
Switches and Gates
• Basic building blocks of computer processing
circuits
• Electronic switches
– Control electrical current flow in a circuit
– Implemented as transistors
• Gates
– An interconnection of switches
– A circuit that can perform a processing function
on an individual binary electrical signal, or bit
24
The CPU in Action
The CPU
25
continued
The CPU Instruction Cycle
• The CPU executes a series of instructions by
looping through an instruction cycle.
The speed of the
instruction cycle
is controlled by
the CPU's clock.
26
BUS STRUCTURE
Connecting CPU and memory
The CPU and memory are normally connected by three
groups of connections, each called a bus: data bus, address
bus and control bus
Connecting CPU and memory using three buses
27
BUS STRUCTURE
•Group of wires which carries information form CPU to
peripherals or vice – versa
•Single bus structure: Common bus used to
communicate between peripherals and microprocessor
INPUT
MEMORY
PROCESSOR
SINGLE BUS STRUCTURE
OUTPUT
28
BUS STRUCTURE…..
• To
improve performance multi bus structure can
be used
•In two – bus structure : One bus can be used to
fetch instruction other can be used to fetch data,
required for execution.
•Thus improving the performance ,but cost
increases
29
BUS STRUCTURE…..
•Data bus: bidirectional : group of wires which carries data
information bit from processor to peripherals and vice – versa
•Control bus: bidirectional: group of wires which carries control
signals from processor to peripherals and vice – versa
•Figure in the next slide show address, data and control bus and
their connection with peripheral and microprocessor
30
31
PERFORMANCE
•Time taken by the system to execute a program
•Parameters which influence the performance are
•Clock speed
•Type and number of instructions in Program
•Average time required to execute an instruction
•Memory access time
•Number of I/O devices and types of I/O devices
connected
•The data transfer capacity of the bus
32
MEMORY LOCATIONS AND ADDRESSES
•Main memory It consists of a collection of storage
locations, each with a unique address.
•Data is transferred to and from memory in groups of
bits called words. A word can be a group of 8 bits, 16
bits, 32 bits or 64 bits.
•If the word is 8 bits, it is referred to as a byte. The term
“byte” is so common in computer science that
sometimes a 16-bit word is referred to as a 2-byte word,
or a 32-bit word is referred to as a 4-byte word.
33
Main memory
34
i
Memory addresses are defined using unsigned
binary integers.
35
Inside a PC
CD-ROM
drive
Power
supply
Hard disk
drive
Mother
board
Floppy
disk drive
Sound/network
cards
Wires and
ribbon cables
36
The Motherboard
• The most important part of a PC is the
motherboard. It holds:
–
–
–
–
the processor chip
memory chips
chips that handle input/output (I/O)
the expansion slots for connecting
peripherals
• Some chips are soldered onto the
motherboard(permanent), and some are
removable (so they can be upgraded).
37
Motherboard Picture
38
Expansion Slot Types
• There are several different types of expansion
slot:
– ISA: older technology, for modems and slow
devices
– PCI: for graphics, sound, video, modem or
network cards
– AGP: for graphics cards
39
Connector Cables
40
continued
41
RAM
• Random Access Memory (RAM).
• RAM is used to hold programs while they are
being executed, and data while it is being
processed.
• RAM is volatile, meaning that information written
to RAM will disappear when the computer is
turned off.
42
continued
• RAM contents can be accessed
in any (i.e. random) order i.e any word can
be accessed in same access time
43
RAM Storage
Each RAM location
has an address and
holds one byte of
data (eight bits).
44
How much RAM is Enough?
• Computers typically have between 4 and 64
GB (Giga Bytes) of RAM.
• RAM access speeds can be as fast as 8
nanoseconds (8 billionth of a second).
• The right amount of RAM depends on the
software you are using.
• You can install extra RAM.
45
Virtual Memory
• Virtual memory uses part of the hard disk to
simulate more memory (RAM) than actually
exists.
• It allows a computer to run more programs at
the same time.
• Virtual memory is
slower than RAM.
46
ROM
• Read-Only Memory can
be read but not changed.
• It is non-volatile storage: it remembers its
contents even when the power is turned off.
• ROM chips are used to store the instructions a
computer needs during start-up, called firmware.
• Some kinds of ROM are PROM, EPROM, EEPROM,
and CD-ROM.
47
CMOS Memory
• A computer needs a semi-permanent
way of keeping some start-up data
the battery
– e.g. the current time, the no. of hard disks
– the data may need to be updated/changed
• CMOS memory requires (very little) power to
retain its contents.
– supplied by a battery on the motherboard
48
Booting a Computer
• Booting is the sequence of computer
operations from power-up until the system is
ready for use
– this includes hardware testing, and loading the OS
– POST
49
Other Booting Tasks
• The computer checks the CMOS memory.
• The computer loads configuration settings
from Config.sys or the Windows Registry.
50
Semiconductor Memory Types
Memory Type
Random-access
memory (RAM)
Category
Read-write memory
Erasure
Electrically, byte-level
Read-only
memory (ROM)
Write Mechanism
Electrically
Volatility
Volatile
Masks
Read-only memory
Not possible
Programmable
ROM (PROM)
Erasable PROM
(EPROM)
UV light, chip-level
Nonvolatile
Electrically
Electrically Erasable
PROM (EEPROM)
Flash memory
Read-mostly memory
Electrically, byte-level
Electrically, block-level
51
Semiconductor Memory
• RAM
– semiconductor memory is random access
– Read/Write
– Volatile
– Temporary storage
– Static or dynamic
52
Dynamic RAM
•
•
•
•
•
•
•
•
•
•
Bits stored as charge in capacitors
Charges leak
Need refreshing even when powered
Simpler construction
Smaller per bit
Less expensive
Need refresh circuits
Slower
Main memory
Essentially analogue
– Level of charge determines value
58
SRAM v DRAM
• Both volatile
– Power needed to preserve data
• Dynamic cell
–
–
–
–
–
Simpler to build, smaller
More dense
Less expensive
Needs refresh
Larger memory units
• Static
– Faster
– Cache
61
Hard Disk Drive (HDD) Components
• Electromechanical
– Rotating disks
– Arm assembly
• Electronics
– Disk controller
– Cache
– Interface controller
62
HDD Organization
Arm
Assembly
Spindle
Arm
Cylinder
Head
Platter
Track
63
A Magnetic ‘Bit’
• Bit-cell composed of
magnetic grains
– 50-100 grains/bit
• ‘0’
– Region of grains of
uniform magnetic
polarity
• ‘1’
– Boundary between
regions of opposite
magnetization
Source: http://www.hitachigst.com/hdd/research/storage/pm/index.html
66
Tracks and Sectors
• Bits are grouped into sectors
• Typical sector-size = 512 B of data
• Sector also has overhead information
– Error Correcting Codes (ECC)
– Servo fields to properly position the head
70
Optical Media
• CD – Compact Disk
• DVD
• Digital Versatile Disk
• Digital Video Disk
• Both are organized as a single spiral track
• CD – 6 kilometers
• DVD – 12.5 kilometers
71
CD Areas
Manufacturer Code
Batch Number
Spindle Hole
Clamping Ring
Stacking Ring
Data Area
72
Sizes
• CDs
• 5.25 “ – 120 mm
• 3.15” – 80 mm
• Business Card
• DVDs
• 5.25” - 120 mm
• Could be different
73
CD & DVD Types
• CD
• CD-Rom
• CD-R
• CD-RW
• DVD
• DVD-Rom
• DVD-R
• DVD+R
76
Optical Storage
• CDs
• CD – R - 700 Mbytes
• CD –RW – 570 Mbytes
• DVDs
• Single layer – 4.3 Gbytes
• Two layer – 8.6 Gbytes
77
Interfaces
•
•
•
•
ATAPI or SATA
SCSI
USB
1394
84
What is Flash Memory?
• Flash memory is a form of computer memory
that is programmed and erased electrically.
• It is a type of electrically erasable
programmable read-only memory (EEPROM)
chip.
86
Types of Flash Memory
• SD Cards
• Compact Flash
Cards
• USB Drives
• Memory Sticks
• SmartMedia Cards
98
Major Manufactures of Flash Memory
•
•
•
•
•
•
•
•
•
•
•
•
SanDisk
Qmemory
Kingston
Transcend
Sony
Samsung
Kingston
Intel
Toshiba
Lexar
Kingmax
Fujifilm
99
Keyboard
• A keyboard is the most common input device. Several kinds
of keyboards are available, but they
• resemble each other with
• minor variations. The
• keyboard in most common
• use is the QWERTY board.
• Generally standard
• keyboard has 104 keys. In
• these keyboards, the cursor
• control keys are duplicated
• to allow easier use of the
• numeric pad.
101
Mouse
•
•
•
•
•
•
•
•
A mouse is an electro-mechanical, hand-held device (as shown
It is used as a pointer. It can perform functions
like selecting menu commands, moving icons, resizing windows,
starting programs, and choosing options.
The most common mouse uses an internal, magnetically coated
ball, to detect the movement of the mouse across a flat surface,
usually a desktop. Now a days Optical or laser mouse is used to
detect the movement.
102
Printer
• most commonly used printers are:
–
–
–
–
Laser Printer
Ink Jet Printer
Dot Matrix Printer
Line Printer
103
Plotter
• A plotter is a special kind of output
device that, like a printer, produces
images on paper, but does so in a
different way.
• Plotters are designed to produce
large drawings or images, such as
construction plans for buildings or
blueprints for mechanical objects.
104
Networking
• Computer network A collection of computing
devices that are connected in various ways in
order to communicate and share resources
Usually, the connections between computers
in a network are made using physical wires or
cables
However, some connections are wireless, using
radio waves or infrared signals
15-105
Networking
• The generic term node or host refers to any
device on a network
• Data transfer rate The speed with which data
is moved from one place on a network to
another
• Data transfer rate is a key issue in computer
networks
15-106
Networking
• Computer networks have opened up an entire
frontier in the world of computing called the
client/server model
15-107
Figure 15.1 Client/Server interaction
Networking
• File server A computer that stores and
manages files for multiple users on a network
• Web server A computer dedicated to
responding to requests (from the browser
client) for web pages
15-108
Types of Networks
• Local-area network (LAN) A network that
connects a relatively small number of
machines in a relatively close geographical
area
15-109
Types of Networks
• Wide-area network (WAN) A network that
connects two or more local-area networks over a
potentially large geographic distance
Often one particular node on a LAN is set up to serve as a
gateway to handle all communication going between that
LAN and other networks
Communication between networks is called
internetworking
The Internet, as we know it today, is essentially the
ultimate wide-area network, spanning the entire globe
15-110
Types of Networks
• Metropolitan-area network (MAN) The
communication infrastructures that have been
developed in and around large cities
15-111
Types of Networks Topology
• Various configurations, called topologies, have been
used to administer LANs
– Ring topology A configuration that connects all nodes in a
closed loop on which messages travel in one direction
– Star topology A configuration that centers around one
node to which all others are connected and through which
all messages are sent
– Bus topology All nodes are connected to a single
communication line that carries messages in both
directions
15-112
Types of Networks Topology
Figure 15.2 Various network topologies
• A bus technology called Ethernet has become the industry
standard for local-area networks
113
15-10
So, who owns the Internet?
Well, nobody does. No single person or
company owns the Internet or even controls it
entirely. As a wide-area network, it is made up
of many smaller networks. These smaller
networks are often owned and managed by a
person or organization. The Internet, then, is
really defined by how connections can be
made between these networks.
15-114
Internet Connections
• Internet backbone A set of high-speed
networks that carry Internet traffic
These networks are provided by companies
such as AT&T, GTE, and IBM
• Internet service provider (ISP) A company
that provides other companies or individuals
with access to the Internet
15-116
Internet Connections
• There are various technologies available that you can use to
connect a home computer to the Internet
– A phone modem converts computer data into an analog audio
signal for transfer over a telephone line, and then a modem at the
destination converts it back again into data
– A digital subscriber line (DSL) uses regular copper phone lines to
transfer digital data to and from the phone company’s central
office
– A cable modem uses the same line that your cable TV signals come
in on to transfer the data back and forth
15-117
Internet Connections
• Broadband A connection in which transfer speeds
are faster than 128 bits per second
– DSL connections and cable modems are broadband
connections
– The speed for downloads (getting data from the Internet
to your home computer) may not be the same as uploads
(sending data from your home computer to the Internet)
15-118
RJ45
Dongles
LC
Wired netcard
Fiber optic
BNC
Coaxial
119
Download