computer organization & assembly language...

43
1 Computer Organization & Assembly Language Programming CSE 2312 Lecture 5 Secondary Memory and I/O

Upload: others

Post on 05-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

1

Computer Organization &

Assembly Language Programming

CSE 2312

Lecture 5 Secondary Memory and I/O

Page 2: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

2

Memory Hierarchies

A five-level memory hierarchy.

• Access time gets bigger– several ns, several 10 ns,

10ms, several s

• Storage capacity

– Hundreds of bytes, tens of megabytes, tens to hundreds of gigabytes, hundreds of gigabytes to tens of terabytes

• # of bits per dollar increases

– Change rapidly

Page 3: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

3

Magnetic Disks

• Magnetic Disk– Consists of one or more platters with a magnetizable coating

– A disk head containing an induction coil floats just over the surface, resting on a cushion of air

• Scheme– When a positive or negative current passes through the head, it

magnetizes the surface just beneath the head, aligning the magnetic particles face right or left, depending on the polarity of the drive current

– When the head passes over a magnetized area, a positive or negative current is induced in the head, making it possible to read back the previously stored bits

• Track– The circular sequence of bits written as the disk makes a complete

rotation called a track

• Sector– Each track is divided into some sector with fixed length, typically, 512

bytes

Page 4: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

4

Disk Track

A portion of a disk track. Two sectors are illustrated.

• Sector

– Preamble: allow the head to be synchronized before reading or writing

– Data bits

– Error Correcting Code: either a Hamming code, or Reed-Solomon code

• Intersector gap

– Between consecutive sectors

Page 5: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

5

Platter

A disk with four platters.

• Most disks

– Consist of multiple platters stacked vertically

– Each surface has its own arm and head. All arms are ganged together so they move to different radial positions all at once

Page 6: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

6

Disk Performance

• Seek– To read/write a sector, the arm must be moved to the right radial direction

first– Seeking time: Average 5 – 10 ms

• Rotational Latency– The delay until the desired sector rotates under the head once after the

head is positioned radially– Average delay, 3- 6 ms, for disk rotation speed 5400RPM, 7200RPM, and

10800RPM.

• Transfer Time– Depending on the linear density and rotation speed.

Disk’s performance is dominated by the seek time and rotation latency

• Disk Controller– A chip that controls the drive. It is associated with each drive– Task: accepting commands from software, such as read, write, format– Controlling the arm motion; detecting and correcting errors– Converting 8-bit bytes read from memory into a serial bit stream and vice

versa

Page 7: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

7

Strategy

• Constant angular velocity– All magnetic disks rotate at a

constant angular velocity, no matter where the head are

• Strategy 1– Each one occupied 20

degrees of arc, no matter which cylinder

• Strategy 2– The number of sectors per

track is increased in each zone moving outward from the innermost track

Page 8: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

8

Floppy/IDE/SCSI Disks

• Floppy Disk (obsolete)– Its head actually touch the diskettes instead of float

above the surface on a cushion of rapidly moving air

• Integrated Drive Electronic (IDE)– The controller is closely integrated with the drives– 4 bits for head, 6 bits for sector, 10 bits for cylinder, the max

drive could have 63 sector, 16 heads and 1024 cylinders – Total 1,032,192 sectors, capacity 504 MB=1032192*512– Today enhanced ATAPI-7 standard and SATA (Serial AT

Attachment) bus interface are used, supporting LBA (logical block addressing) [48bit address for 29B sector)]and high-speed data transfer.

• Small Computer System Interface (SCSI)– Same organization of cylinders, tracks and sector ; – Different interface and much higher transfer rates– More than just a hard disk interface and it is a bus to which

a SCSI controller and up to 7 devices can be attached, such as SCSI disk, scanner, tape units, and others

– SCSI allows all the devices to run at once, improving performance

– IDE allows only one active device at a time

Page 9: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

9

RAID Redundant Array of Inexpensive Disks

• RAID vs. SLED– Redundant Array of Inexpensive

Disks

– Single Large Expensive Disk

• Idea behind RAID – Install a box full of disks next to the

computer, typically a large server, replace the disk controller card with a RAID controller.

– RAID should look like a SLED to the operating system but have better performance and reliability

– No software changes are required

– Data are distributed over the drives to allow parallel operations

Page 10: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

10

RAID 0-2

RAID levels 0 through 2. Backup and parity disks are shown

shaded.

• RAID 0– Striping: distribute data

over multiple drives

– No redundancy, not a really RAID

• RAID 1– Duplicate all disks

– True RAID

– “WRITE”: doubled

– “READ”: higher throughput

– Good Fault tolerance

• RAID 2– On a word basis or a

byte basis

– 7-bit hamming code over 7 drives, 1 bit per drive

– Exactly synchronized

Page 11: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

11

RAID 3-5

• RAID 3– Simplified version of RAID level 2

– A single parity bit is computed for each data word and written to a parity drive

• RAID 4– Work with strips of blocks

– Not individual word with parity

– Strip-to-strip parity written onto the extra drive

• RAID 5– Distributed the parity blocks

uniformly over all drive

– Eliminating the heavy load on the parity driveRAID levels 3 through 5.

Backup and parity disks are shown shaded.

Page 12: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

Solid-State Disks

A flash memory cell.

Page 13: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

13

NAND Type Flash Memory

• Operations

– Read / Write

Page unit (from half KB or a few KBs))

– Erase: Block unit (a set of pages)

• Characteristics

– Not in-place update

➢Erase an entire erase block for in-place update of page

Original block

Free block

1. Update page 0

in free block

2. Copy the rest of

Pages (1,2,3,4)3. Obsolete original

block

Page 14: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

14

Compact Disc (CD)

Recording structure of a

Compact Disk or CD-ROM.

• CD Preparation– Use a high power infrared

laser to burn 0.8-micron diameter holes in a coated glass master disk

– Pit: depression in the polycarbonate substrate

– Land: unburned areas

– Pit/land or land/pit transition is 1 and otherwise 0

• Rotation Rate– Constant linear velocity,

which different from magnetic disk with constant angular velocity

Page 15: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

15

CD-ROMs

Logical data layout on a CD-ROM (Sector)

• Mode 1– 16 bytes preamble, 2048 bytes data, 288 bytes error-correcting code– It takes 98 frames of 588 bits (7203 bytes) to carry a single 2048-byte payload, an

efficiency of only 28 percent.– Single Speed CD-ROM: 75 sectors/sec, so data rate: 75*2048=153,600 bytes/sec– 74 minutes audio CD: Capacity: 74*60*153,600=681,984,000 bytes ~=650 MB

• Mode 2– 2336 bytes data for a sector, 75*2336=175,200 bytes/sec

Page 16: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

16

CD-Recordables

Cross section of a CD-R disk and laser (not to scale). A CD-ROM has a

similar structure, except without the dye layer and with a pitted aluminum layer

instead of a reflective layer.

Page 17: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

17

Exercise

• Ex 1: TRUE OR FALSE, Why?

– The Hamming distance between 00001001 and 10011001 is 3

– Answer: F

– Reason: 2

Page 18: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

18

Exercise

• Ex 2: Which of following is true for the CD and magnetic disk?

– (a) CD has constant linear velocity

– (b) CD has constant angular velocity

– (c) Magnetic Disk has constant linear velocity

– (d) Magnetic Disk has constant angular velocity

– Answer: [a, d]

Page 19: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

19

Exercise

• Ex 3: In a CD-ROM, each sector includes a 16 bytes preamble, 1000 bytes data, and 108 bytes error-correcting code. – If the CD-ROM has speed 32 sectors/sec, so what is data rate?

– Answer:

– 32*1000=32,000 bytes/second

Page 20: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

20

Exercise

• Ex 4: In a CD-ROM, each sector includes a 16 bytes preamble, 2000 bytes data, and 208 bytes error-correcting code. – If the CD-ROM has speed 100 sectors/sec, so what is data rate?

– Answer:

– 100*2000=200,000 bytes/second

Page 21: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

21

Exercise

• Ex 5: In a mode-1 CD-ROM, each sector includes a 16 bytes preamble, 2000 bytes data, and 208 bytes error-correcting code. – If this CD is a 100-minute audio CD and it has speed 100 sectors/sec, so what

is its data capacity?

– Answer:

– 100*60*2000*100=1,200,000,000 bytes

Page 22: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

22

Input/Output

• I/O Device – Each I/O device consists of two parts: 1) controller; 2) I/O device itself

– Controller is used to control its I/O device and handle bus access for it

• Direct Memory Access – A controller reads or writes data to or from memory without CPU

intervention

– Controller is used to control its I/O device and handle bus access for it

• Interrupt – When the transfer is completed, the controller normally causes an

interrupt, forcing the CPU to immediately suspend running its current program and start running a special procedures, called an interrupt handler to check for errors, take any special action needed, and inform the operating system that I/O is now finished.

– When the interrupt handle is finished, the CPU continues with the program that was suspended when the interrupt occurred

Page 23: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

23

Physical Structure

Physical structure of a personal computer.

Page 24: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

24

Logical Structure

Logical structure of a simple personal computer.

• Bus – Used by the I/O controller and the CPU for fetching instructions and data

• Bus Arbiter– Decide who go first when the CPU and I/O controller want to use the bus

at the same time; I/O devices are given preference over the CPU

Page 25: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

25

Buses

A typical modern PC with a PCI bus and an ISA bus.

• ISA vs. PCI Bus – Industry Standard Architecture vs. Peripheral Component Interconnect

– CPU memory traffic does not go over the PCI bus, high-bandwidth peripherals can connect to the PCI bus directly

Page 26: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

26

Terminals

• Keyboards – On personal computer, when a key is

depressed, an interrupt is generated and the keyboard interrupt handler is started.

– The interrupt handler reads a hardware register inside the keyboard controller to get the number of the key that was just depressed

– When a key is released, a second interrupt is caused

• Monitors – CRT (Cathode Ray Tube) monitors

– Flat Panel Displays: LCD (Liquid Crystal Display) monitors

– Video RAM: both displays are refreshed 60-100 times per second from a special memory --- video RAM

Page 27: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

27

CRT Monitor

(a) Cross section of a CRT (b) CRT scanning pattern

• CRT – A gun shoots an electron beam against a phosphorescent screen

near the front of the tube

– Raster scan, a full screen is normally repainted between 30 and 60 times a second

Page 28: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

28

Flat Panel Displays

(a) The construction of an LCD screen.

(b) The grooves on the rear and front plates are

perpendicular to one another.

• LCD – Consists of two parallel

glass plates between which is a sealed volume containing a liquid crystal

– The rear plate contains tiny horizontal grooves and the front plate contains tiny vertical grooves

Page 29: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

29

Video RAM

• Video RAM – A special memory for displays to refresh

60-100 times per second

– On the display’s controller card, displaying a 128 x 128-pixel picture, each pixel is represented by a value

• Video RAM capacity – A video RAM with 1600 x 1200 pixels at

3 bytes per pixel, what is the size for the video RAM at least to store the image?

– 1600*1200*3= 5,760,000 bytes=5.5 MB

Page 30: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

30

Mice

• Design Purpose – Originally designed for people

with less expertise in computers

– When it moves, a little pointer on the screen moves too, allow users to point at screen item

• Three Kinds – Mechanical mice: wheel and ball

– Optical mice: no wheel and ball but LED (Light Emitting Diode)

– Optomechanical mice: newer mechanical mice with rolling ball

Page 31: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

31

Printer

(a) The letter “A” on a 5 x 7 matrix. (b) The letter “A” printed with 24 overlapping needles.

• Matrix Printer – Printer head contains 7-24

electromagnetically activatable needles

– Cheaper and reliable

– Slow, noisy, poor at graphic

• Print Quality – More needles

– Having circle overlap

Page 32: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

32

Printer (cont’d)

Operation of a laser printer.

• Laser Printer – The heart is a rotating

precision drum

– The printing scheme is an exceedingly complex combination of physics, chemistry, mechanical engineering and optical engineering

Page 33: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

33

Telecommunications

• Network – Most computers are connected to a computer network, often internet

• Equipment– Modems

– Digital Subscrible Lines (DSL)

– Internet over Cable

Page 34: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

34

Data Transmission

Transmission of the binary number 01001010000100 over a

telephone line bit by bit. (a) Two-level signal. (b) Amplitude

modulation. (c) Frequency modulation. (d) Phase modulation.

Page 35: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

35

Asymmetric Digital Subscriber Lines

Operation of ADSL.

• 256 independent channels, 4312.5 Hz each – Channel 0 is for telephone service

– Channel 1-5 is not used

– Remaining for upstream and downstream

– Like having 250 modems

– 32 for upstream

– Rest for downstream

Page 36: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

36

ASDL Equipment Configuration

A typical ADSL equipment configuration.

Page 37: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

37

Internet over Cable

Frequency allocation in a typical cable TV system

used for Internet access

• Different from ASDL – Headends are connected to main office by high-bandwidth cable

– Each headend has cables that run from it to many homes or offices

– While ASDL users has a dedicated wire, a cable is shared and its service quality may vary depending on number of active users.

Page 38: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

38

Digital Cameras

Charge-Coupled Devices (CCDs)─ A pixel is made up for 4 CCDs (one red, one blue, two green)─ 6 millions CCDs is just for 1.5 millions pixels

Page 39: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

39

Digital Camera (cont’d)

• Software Tasks in Camera– Setting the focus

– Determine exposure

– Performing the white balance

– Possibly localizing human faces

Page 40: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

40

ASCII Character Codes

The ASCII Character set: characters 0 – 31.

Page 41: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

41

ASCII Character Codes (cont’d)

The ASCII Character set: characters 32 – 127.

Page 42: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

42

Exercise

• Ex 1: Suppose we know a video RAM with 1000 x 1000 pixels at 3 bytes per pixel,

– What is the size for the video RAM at least to store the image?

– Answer:

– 1000*1000*3=3,000,000 bytes

Page 43: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_Lecture5.pdfcomputer, typically a large server, replace the disk controller card

43

Exercise

• Ex 2: A digital camera has a resolution of 1000*1000 pixels, with 5 bytes/pixel for RGB color.

– The manufacturer of the camera wants to be able to write a JPEG image at a 5x compression factor to the flash memory in 2 sec. What data rate is required? Assume that 1 MB means 106 bytes.

– Answer:

– Each uncompressed image file is 5*1000*1000 bytes. After 5x compression, it is 1 million bytes.

– To write this in 2 sec requires a data rate of 1 MB/2 sec=0.5 MB/sec.