Docstoc

Input and Output

Document Sample
Input and Output Powered By Docstoc
					                         Types of I/O

     • Types of I/O
            – Programmed I/O
            – Direct memory access (DMA)
     • Both types use interrupts




ITEC 1011           Introduction to Information Technologies
                           Interrupts
    • Used to:
        – Stop the normal execution of the current program and
          do other processing
        – Implement system events
    • I/O operations are initiated by the device
    • The device, or its I/O module, includes a signal to
      interrupt the CPU
    • These signals are called interrupt lines
    • A typical CPU supports 8 to 16 interrupt inputs
    • Typical names: IRQ1, IRQ2, IRQ3, etc.

ITEC 1011          Introduction to Information Technologies
                              Example
     Many keyboards – input is coming from each
       of them
     • Processing input can be done
            – Theoretically: by using polling (wastes
              computer time)
            – Practically: by using interrupts (keyboard key
               interrupt line  CPU)



ITEC 1011            Introduction to Information Technologies
              Servicing an Interrupt
     • When an interrupt occurs (and is accepted), the
       execution of the current program is suspended
     • Must save PC, Registers in Program Control
       Block (PCB)
     • A special routine executes to service the interrupt
     • In most cases the interrupted program resumes
     • The service routine is called an interrupt handler
       or interrupt service routine (ISR)



ITEC 1011         Introduction to Information Technologies
              Servicing an interrupt




ITEC 1011   Introduction to Information Technologies
                       Saving Registers
     • For the interrupted program to resume, the CPU
       status and data registers must be saved (because
       they will change during the ISR)
     • They must be saved before the ISR executes
     • They can be restored after the ISR executes
     • They are saved either
            – On the stack (a special area of memory to temporarily
              hold information), or
            – In a process control block (PCB)



ITEC 1011             Introduction to Information Technologies
                 Use of Interrupts
     •   As an external event notifier
     •   As a completion signal
     •   As a means of allocating CPU time
     •   As an abnormal event indicator
     •   As software generated interrupts




ITEC 1011        Introduction to Information Technologies
            Interrupts for External Events
     • An interrupt signal occurs when an “event”
       occurs in a device – an event that requires
       the CPU’s attention
     • E.g.,
            – Keyboard: a key has been hit (the ISR reads the
              code for the key)
            – Notebook computer cover: the cover is closed
              (the ISR puts the computer in standby mode)


ITEC 1011            Introduction to Information Technologies
            Using a Keyboard Handler Interrupt




ITEC 1011         Introduction to Information Technologies
     Interrupts for Completion Signals
     • An interrupt signal occurs when a device
       has completed an operation – and the CPU
       should know about it
     • E.g.,
            – Printer: the output buffer is empty (the CPU
              can send more data)
            – Scanner: a data transfer is complete (the
              CPU/application can proceed to process the
              image data)


ITEC 1011            Introduction to Information Technologies
    Interrupts for Allocating CPU Time
     • Useful on multi-tasking systems – systems that
       can execute more than one program at a time
     • E.g.,
            – A timer is programmed to interrupt the CPU every
              100 µs (for example) – 1 µs = 10-6
            – The ISR is a “dispatcher program”
            – Execution switches to another program (for 100 µs),
              etc.




ITEC 1011             Introduction to Information Technologies
            Using an Interrupt for Time Sharing




ITEC 1011        Introduction to Information Technologies
       Interrupts for Abnormal Events
     • An interrupt signal occurs when an
       abnormal event occurs that needs immediate
       system attention
     • E.g.,
            – A heat sensor near the CPU chip – if the
              temperature is too high, an interrupt is
              generated, the ISR activates the fan near the
              CPU chip


ITEC 1011            Introduction to Information Technologies
               Software interrupts
     • Example: IBM SuperVisor Call
     • Used to force a jump/branch to a certain
       location
     • Application: centralize I/O




ITEC 1011       Introduction to Information Technologies
                    Multiple Interrupts
     • Are handled by:
            – Assigning priorities
            – Disabling other interrupts for a period of time
     • See next slide
     • Interrupts are checked at the end of each
       instruction



ITEC 1011            Introduction to Information Technologies
              Multiple interrupts




ITEC 1011   Introduction to Information Technologies
                   Direct Memory Access
     • Used for high-speed block transfers between a
       device and memory
     • During the transfer, the CPU is not involved
     • Typical DMA devices:
            – Disk drives, tape drives
     • Remember (1st slide)
            – Keyboard data rate  0.01 KB/s (1 byte every 100 ms)
            – Disk drive data rate  2,000 KB/s (1 byte every 0.5 µs)

  Transfer rate is too high to be controlled by
  software executing on the CPU

ITEC 1011                 Introduction to Information Technologies
                                       How
     • The CPU “prepares” the DMA operation by
       transferring information to a DMA controller
       (DMAC):
            –   Location of the data on the device
            –   Location of the data in memory
            –   Size of the block to transfer
            –   Direction of the transfer
            –   Mode of transfer (burst, cycle steal)
     • When the device is ready to transfer data, the
       DMAC takes control of the system buses (next
       few slides)

ITEC 1011                Introduction to Information Technologies
             “Taking Control” (1 of 2)
                                      Control Bus
                                      signals
              CPU                                          DMAC



                    BR                                    BR
                    BG                                    BG
               BGACK                                      BGACK


        BR      = Bus request (DMAC: May I take control of the system buses?)
        BG      = Bus grant (CPU: Yes, here you go.)
        BGACK = BG acknowledge (DMAC: Thanks, I’ve got control.)


ITEC 1011            Introduction to Information Technologies
            “Taking Control” (2 of 2)
   • DMAC issues a BR (“bus request”) signal
   • CPU halts (perhaps in the middle of an instruction!)
     and issues a BG (“bus grant”) signal
   • DMAC issues BGACK (“bus grant acknowledge”)
     and releases BR
   • DMAC has control of the system buses
   • DMAC “acts like the CPU” and generates the bus
     signals (e.g., address, control) for one transfer to take
     place
   • Then…
ITEC 1011         Introduction to Information Technologies
     Program-Controlled I/O (in DMA)

                                                        Data bus
                                                        Address bus
                                                        Control bus
     CPU

                                  DMAC
            Memory
                                                         The CPU
                                                         “prepares”
                                    Disk                 the DMAC



ITEC 1011    Introduction to Information Technologies
                           DMA

                                                        Data bus
                                                        Address bus
                                                        Control bus
     CPU
                                                        The transfer
                                  DMAC                  takes place
            Memory


                                    Disk



ITEC 1011    Introduction to Information Technologies
              I/O Interrupt (in DMA)

                                                             Data bus
                                                             Address bus
        IRQ                                                  Control bus
     CPU                                                   The DMAC
                                                           interrupts the
                                     DMAC
                                                           CPU when the
              Memory                                       transfer is
                                                           complete
                                       Disk



ITEC 1011       Introduction to Information Technologies
            Computer Peripherals – Part I




ITEC 1011        Introduction to Information Technologies
            Hard Disk Example




ITEC 1011   Introduction to Information Technologies
                            Hard Disk Layout
                     Head
                                                          Block        Head
         Platter                                                       motor

                                                     Sector
    Track




  Cylinder


                                                  Track


             Drive                                                         Head, on
             motor             Head                                       moving arm
                             assembly

ITEC 1011                   Introduction to Information Technologies
                              Terminology
            – Platter
               • A round surface – the disk – containing a magnetic coating
            – Track
               • A circle on the disk surface on which data are contained
            – Head
               • A transducer attached to an arm for writing/reading data
                 to/from the disk surface
            – Head assembly
               • A mechanical unit holding the heads and arms
               • All the head/arm units move together, via the head assembly
            – Cylinder
               • A set of tracks simultaneously accessible from the heads on the
                 head assembly

ITEC 1011                Introduction to Information Technologies
                             Terminology
            – Sector
               • That portion of a track falling along a predefined pie-shaped
                 portion of the disk surface
               • The number of bytes stored in a sector is the same, regardless
                 of where the sector is located; thus, the density of bits is
                 greater for sectors near the centre of the disk
               • The rotational speed is constant; i.e., constant angular velocity
               • Thus, the transfer rate is the same for inner sectors and outer
                 sectors
               • Each sector on a single track contains one block of data.
            – Block
               • The smallest unit of data that can be written or read to/from the
                 disk (typically 512 bytes)



ITEC 1011               Introduction to Information Technologies
              Locating a Block of Data
   Seek Time                     Latency Time                 Transfer Rate

                                      Latency                     Transfer

                      Head




                       Seek


            Desired
             track            Note: Access time = seek time + latency

ITEC 1011              Introduction to Information Technologies
                              Terminology
            – Seek time
               • The time for the head to move to the correct track
               • Specified as an average for all tracks on the disk surface
            – Latency time
               • The time for the correct block to arrive at the head once the
                 head is positioned at the correct track
               • Specified as an average, in other words, ½ the period of
                 rotation
               • Also called “rotational delay”
            – Access time is the time “to get to” the data (remember!)
               • Access time = seek time + latency
            – Transfer rate
               • Same as throughput

ITEC 1011               Introduction to Information Technologies
                 Latency Example
     • A hard disk rotates at 3600 rpm
     • What is the average latency?

            Period of rotation = (1 / 3600) minutes
                               = (1 / 3600)  60 seconds
                               = 0.01667 s
                               = 16.67 ms

            Average latency      = 16.67 / 2 ms
                                 = 8.33 ms


ITEC 1011        Introduction to Information Technologies
    Factors Determining Transfer Rate
     • Transfer rate can be determined, given…
            – Rotational speed of the disk platters
            – Number of sectors per track
            – Number of bytes per sector




ITEC 1011            Introduction to Information Technologies
                  Transfer Rate Example
     • Q: Determine the transfer rate, in Mbytes/s, for a
       hard disk drive, given
            – Rotational speed = 7200 rpm
            – Sectors per track = 30
            – Data per sector = 512 bytes = 0.5 Kbytes
     • A:
            Transfer rate   = 7200 x 30 = 216,000 sectors/min
                            = 216,000 x 0.5 = 108,000 Kbytes/min
                            = 108,000 / 60 = 1,800 Kbytes/s
                            = 1,800 / 210 = 1.76 Mbytes/s


ITEC 1011              Introduction to Information Technologies
                Exercise - Transfer Rate
            – Q: Determine the transfer rate, in Mbytes/s, for
              a hard disk drive, given
               • Rotational speed = 7000 rpm
               • Sectors per track = 32
               • Data per sector = 1024 bytes


            A: Transfer rate   = 7000 x 32 = 224,000 sectors/min
                               = 224,000 x 1 = 224,000 Kbytes/min
                               = 224,000 / 60 = 3,733 Kbytes/s
                               = 3,733 / 210
                               = 3.65 Mbytes/s

ITEC 1011             Introduction to Information Technologies
                   Typical Spec’s
             Specification    3 ½” Floppy    2 GB Hard Disk
            Platters/heads       1/2              5/9
            Cylinders             80              4160
            Sectors/track         18             Varies
            Block size            512             512
            Capacity           1.44 MB           2.1 GB
            Rotation speed      360 rpm         7200 rpm
            Avg. seek time       95 ms           8.5 ms
            Latency              83 ms           4.2 ms
            Transfer rate     54 Kbyte/s       10 Mbyte/s




ITEC 1011       Introduction to Information Technologies
                  Disk Controller
     • Interface between the disk drive and the
       system is known as a “disk controller”
                        May also require special driver,
                        as in CD-ROM s

     • A primary function is to ensure data
       read/write operations from/to the correct
       sector
     • Since data rate to/from the disk is different
       than data rate to/from system memory,
       “buffering” is needed
                                                           Rv: kc


ITEC 1011       Introduction to Information Technologies
                                  Buffering
      Example: Reading data from a disk

            System                            Disk
                                            controller



             RAM
                                                 Buffer                        Disk
                                                (RAM)


              2. Transfer data from buffer to      1. Read data from disk into a
                 system RAM (Note: this is a          buffer in the disk controller
                 DMA operation)


ITEC 1011               Introduction to Information Technologies
             Disks Capacity in Windows
     • To determine the capacity of the C: hard
       disk on Windows
            – From the Desktop, double click on My
              Computer
            – Right click on C: and select Properties




                                                                Next slide

ITEC 1011            Introduction to Information Technologies
 Note:
 Varies on
 different
 systems                                                Demo
ITEC 1011    Introduction to Information Technologies
     Alternative Technologies (1 of 2)
     • Removable hard disks
            – Also called “disk packs”
            – A stack of hard disks enclosed in a metal or plastic
              removable cartridge
            – Advantages
               • High capacity and fast, like hard disk drives
               • Portable, like floppy disks
            – Disadvantage
               • Expensive




ITEC 1011              Introduction to Information Technologies
     Alternative Technologies (2 of 2)
     • R.A.I.D. = Redundant array of inexpensive
       disks
            – A category of disk drive that employs two or
              more drives in combination for fault tolerance
              and performance
            – Frequently used on servers, but not generally
              used on PCs




ITEC 1011            Introduction to Information Technologies
                       CD-ROM
     • CD-ROM stands for “compact disc, read-
       only memory”
     • Evolved from audio CDs
     • Disk size: 120 mm (5¼”)
     • Capacity: 550 MB




ITEC 1011      Introduction to Information Technologies
     Layout of a CD-ROM versus a Standard Disk




ITEC 1011     Introduction to Information Technologies
            CD-ROM vs. Magnetic Disk
              CD-ROM                       Magnetic Disk
       • One spiral track (3           • Multiple tracks of
         miles long!)                    concentric circles
       • Constant bit density          • Variable bit density
       • Disk speed varies      • Disk speed constant
         (CLV, constant linear    (CAV, constant
         velocity)                angular velocity)
       • Constant transfer rate • Constant transfer rate
       • Capacity: 550 MB              • Capacity: varies

ITEC 1011         Introduction to Information Technologies
            CD-ROM Data Organization
     • 270,000 blocks of 2048 bytes each
       (typically)
     • 270,000  2048 = 552,960,000 bytes
     • Extensive error checking and correction
       (e.g., bad regions of the disk flagged)
     • Substantial overhead for error correction
       and identifying blocks
     • Capacity can be as high as 700 MB


ITEC 1011       Introduction to Information Technologies
            CD-ROM Drive Spec’s
            Speed       Seek Time          Transfer Rate
             1x           600 ms              150 KB/s
             4x        135-160 ms             600 KB/s
             8x        135-180 ms             1.2 MB/s
            16x        100-150 ms             2.4 MB/s
            24x        100-150 ms             3.6 MB/s
            32x        100-150 ms             4.8 MB/s

ITEC 1011         Introduction to Information Technologies
       Computer Peripherals – Part II

                         Display




ITEC 1011    Introduction to Information Technologies
                     Types of Displays
     • Two main types
            – CRT (cathode ray tubes)
            – LCD (liquid crystal display)
     • Related terms
            – Monitor or screen
               • A display is often called a “monitor” or “screen”
               • However, the term “monitor” usually refers to the
                 entire box, where as “screen” often implies just a
                 sub-assembly within the box

                                                           Rev: Sec 9.5 pg 262 ff

ITEC 1011             Introduction to Information Technologies
                               Pixels
    • A Pixel is a “picture element”
        – a single point in a graphic image
        – A graphics display is divided into thousands (or
          millions) of pixels arranged in rows and columns
        – The pixels are so close together, they appear connected
        – The number of bits used to represent each pixel
          determines how many colours or shades of grey can be
          represented
        – For a B&W (black and white) monitor, each pixel is
          represented by 1 bit
        – With 8 bits per pixel, a monitor can display 256 shades
          or grey or 256 colours (Note: 28 = 256)

ITEC 1011          Introduction to Information Technologies
            Display Screen Ratios




ITEC 1011   Introduction to Information Technologies
                     Display Size
     • Usually specified in “inches”
     • Value cited is the diagonal dimension of the
       raster -- the viewable area of the display
     • E.g., a 15” monitor:



                               15”



ITEC 1011       Introduction to Information Technologies
                            Resolution
     • Resolution is the number of pixels on a
       screen display
     • Usually cited as n by m
            – n is the number of pixels across the screen
            – m is the number of pixels down the screen
     • Typical resolutions range from…
            – 640 by 480 (low end), to
            – 1,600 by 1,200 (high end)


ITEC 1011            Introduction to Information Technologies
              Video RAM Requirements
     • Total number of pixels is n  m
     • Examples
            – 640  480 = 307,200 pixels
            – 1,600  1,200 = 1,920,000 pixels
     • Video RAM required equals total number of
       pixels times the number of bits/pixel
     • Examples
            – 640  480  8 = 2,457,600 bits = 307,200 bytes = 300
              Kbytes
            – 1,600  1,200  24 = 46,080,000 bits = 5,760,000 bytes
              = 5,625 Kbytes = 5.49 Mbytes
ITEC 1011             Introduction to Information Technologies
            Video RAM (KB) Per Image
                                           Bits per pixel
            Resolution
                               8 bit           16 bit        24 bit
             640 x 480         300              600            900
             800 x 600       468.75            937.5        1406.25
            1024 x 768         768             1536          2304
            1152 x 1024        1152            2304          3456
            1280 x 1024       1280             2560          3840
            1600 x 1200       1875             3750          5625

                 See previous slide for calculations

ITEC 1011           Introduction to Information Technologies
       Display Properties in Windows
     • Right click on the desktop (display) and
       select Properties
     • Click Settings to determine/change the
       setting for Colors and Screen area
       (Resolution)
     • To determine/change screen refresh rate,
       click on Advanced, then click on Adapter

                                                          Next 2 slides

ITEC 1011      Introduction to Information Technologies
 Note:
 Varies on
 different
 systems

ITEC 1011    Introduction to Information Technologies
       Computer Peripherals – Part III




                                                        Chapter 9.6, ff

ITEC 1011    Introduction to Information Technologies
                               Plan
     •   Printers
     •   Scanners
     •   Keyboards
     •   Pointing Devices




ITEC 1011        Introduction to Information Technologies
                               Printers
     • Main types:
            – Dot matrix (sample impact)
            – Laser
            – Ink jet




ITEC 1011           Introduction to Information Technologies
       Dot Matrix Printer Example - 1

                                                  Specifications
                                                  • 800 cps
                                                  • 400 lpm
                                                  • 6-part forms (max)




            FormsMaster 8000 by Printek, Inc.
                  http://www.printek.com

ITEC 1011     Introduction to Information Technologies
       Dot Matrix Printer Example - 2
                                 Specifications
                                 • Printhead wires: 9
                                 • Printhead life: 200 million characters
                                 • Print speed:
                                      • near letter quality: 105 cps
                                      • utility: 420 cps
                                      • high speed draft: 550 cps
                                 • Number of copies: 8
                                 • MTBF: 8000 hours @ 25% duty cycle,
                                   35% density



            Pacemaker 3410 by OKI Data, Inc.
                 http://www.okidata.com
ITEC 1011     Introduction to Information Technologies
                               Printers
     • Main types:
            – Dot matrix
            – Laser
            – Ink jet




ITEC 1011           Introduction to Information Technologies
               Laser Printer Example




            Laserjet 5000 Series from Hewlett Packard Co.
                        (http://www.hp.com)

ITEC 1011          Introduction to Information Technologies
                               Printers
     • Main types:
            – Dot matrix
            – Laser
            – Ink jet




ITEC 1011           Introduction to Information Technologies
                     Background
     • Inkjet technology was developed in the
       1960s
     • First commercialized by IBM in 1976 with
       the 6640 printer
     • Cannon and Hewlett Packard developed
       similar technology
     • Also called bubble jet


ITEC 1011      Introduction to Information Technologies
            Inkjet Printer Example




ITEC 1011     Introduction to Information Technologies
                               Plan
     •   Printers
     •   Scanners
     •   Keyboards
     •   Pointing Devices




ITEC 1011        Introduction to Information Technologies
                             Scanners
     • Three main types
            – Flatbed
            – Sheet-fed
            – Handheld




ITEC 1011           Introduction to Information Technologies
            Flatbed Scanner Example




ITEC 1011      Introduction to Information Technologies
            Sheet-fed Scanner Example




             OfficeJet Series 700 from Hewlett Packard Co
                         (http://www.hp.com)

ITEC 1011          Introduction to Information Technologies
            Handheld Scanner Example




            QuickScan GP Bar Code Scanner from PSC, Inc.
                       (http://www.pscnet.com)

ITEC 1011           Introduction to Information Technologies
                               Plan
     •   Printers
     •   Scanners
     •   Keyboards
     •   Pointing Devices




ITEC 1011        Introduction to Information Technologies
                               Examples




      Natural keyboard by Microsoft                Internet keyboard by Microsoft




ITEC 1011             Introduction to Information Technologies
                               Plan
     •   Printers
     •   Scanners
     •   Keyboards
     •   Pointing Devices




ITEC 1011        Introduction to Information Technologies
                    Examples




ITEC 1011   Introduction to Information Technologies
                     Inside a CPU

     •   What are RISC and CISC?
     •   Indirect addressing modes
     •   Cache memory
     •   Virtual memory




ITEC 1011        Introduction to Information Technologies
                      What is CISC?

     • Complex Instruction Set Computer

            – Many instructions
            – Specific purposes




ITEC 1011          Introduction to Information Technologies
                       What is RISC?

     • Reduced Instruction Set Computer

            – Fewer instructions
            – Basic functions only




ITEC 1011           Introduction to Information Technologies
            Figure 10.14 Little Man indirect addressing
ITEC 1011     Introduction to Information Technologies
                  Figure 10.14 (continued)

ITEC 1011   Introduction to Information Technologies
            Figure 11.8 Step-by-step use of cache

ITEC 1011   Introduction to Information Technologies
            Figure 11.14 The page translation process

ITEC 1011    Introduction to Information Technologies

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:11
posted:3/21/2011
language:English
pages:82