Final Examination - PowerPoint PPT Presentation

1 / 48
About This Presentation
Title:

Final Examination

Description:

... file name unique to user/project. File names. Hierarchical (Multics, Unix, NT) ... free-list (a linked list); mapping table (file name to starting disk block) ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 49
Provided by: BillL161
Category:

less

Transcript and Presenter's Notes

Title: Final Examination


1
Final Examination
  • Class CS2200 Section A
  • Instructor Leahy
  • Date Monday, May 2, 2005
  • Time 800-1050 p.m.
  • Location CoC 17

2
Final Examination
  • Class CS2200 Section B
  • Instructor Ramachandran
  • Date Wednesday, May 4, 2005
  • Time 800-1050 p.m.
  • Location CoC 17

3
CS 2200
  • Presentation 34
  • Input/Output
  • The Condensed Version

4
Our Road Map
Processor
Memory Hierarchy
I/O Subsystem
Parallel Systems
Networking
5
Key Concepts
  • History
  • Characterization
  • Basic Techniques
  • Memory Mapped
  • Polling/Interrupts
  • DMA
  • IO Processor

6
Key Concepts
  • Disks
  • Technology
  • Scheduling
  • File Systems

7
First there was I/O...
  • then computers?

8
Roots of I/O Devices
  • Telecommunications
  • Smoke signals
  • Drums
  • Optical telegraphy
  • Electrical telegraphy
  • Wireless telegraphy
  • Teletype
  • Television
  • etc.

9
Roots of I/O Devices
  • Control/Tabulation
  • Jacquards Punched Cards
  • Holleriths tabulating machines
  • IBM
  • Other technologies
  • Magnetic recording
  • Wire
  • Tape

10
Characterization
  • Behavior Input, Output, Storage
  • Partner Human, Machine
  • Data Rate Peak rate
  • Character stream or block (Terminal vs. Disk)
  • Sequential or random-access (Modem vs. CD-ROM)
  • Synchronous or Asynchronous (Tape vs. keyboard)
  • Shareable or dedicated (Keyboard vs. tape)

11
Types
  • Device Behavior Partner DataRate
    kb/s
  • Keyboard I Human 0.01
  • Mouse I Human 0.02
  • Voice Input I Human 0.02
  • Scanner I Human 400
  • Voice Output O Human 0.6
  • Line Printer O Human 1
  • Laser Printer O Human 200
  • Graphics Display O Human 60,000
  • Modem IO Machine 8
  • Network IO Machine 6,000
  • Floppy Disk S Machine 100
  • Optical Disk S Machine 1,000
  • Magnetic Tape S Machine 2,000
  • Magnetic Disk S Machine 10,000

12
Memory Mapped I/O
  • Saw this in P2
  • Device controller
  • Interface between bus and device
  • Looks like memory locations
  • Registers can be in/out or both
  • Some systems have dedicated I/O instructions

13
Polling vs. Interrupts
  • Simple to output one word/byte
  • But how do we know when we can output again?
  • How do we know when there is input?
  • Polling Used when very high likelihood of
    finding something
  • Interrupt driven Much more efficient
  • But...

14
DMA
  • Direct Memory Access
  • Using sophisticated general-purpose processor to
    manage I/O inefficient use of powerful resource
    especially for large blocks of data.
  • Solution Add enough processing power to device
    controller (and possibly bus controller) to allow
    direct transfer between device and memory.

15
DMA
N
Processor to Controller Move N bytes from disk
location X to memory location M
16
DMA
N
Controller Read X into buffer BP 0 while(N gt
0) MemM BufferBP Interrupt
processor
17
DMA
N
Why is this efficient?
18
DMA
Processor
Memory
C
N
Processor can run out of cache
19
I/O Processor
  • For very high volumes of data specialized
    processors are used which actually use memory to
    store their control programs.
  • Multiplexor channel (character oriented)
  • Terminals
  • Block multiplexor (block oriented)
  • Tape Drives
  • Selector channel (high speed block oriented)
  • Disk drive

20
Magnetic Disks
  • Fixed head drums
  • Disks
  • Removable disk packs
  • Floppy disk
  • Invented for IBM Field Engineers
  • Contact
  • Slow speed

21
Magnetic Disks
  • Hard disk
  • Higher speed
  • Larger
  • Higher Density
  • Multiplatter
  • Flying heads!

22
Disk Terminology
(2 surfaces per platter)
Cylinder Track 'x' on all platters/surfaces
23
Magnetic Disks
24
Steps to Read/Write
  • Drive must move heads to desired track
  • Seek time
  • Must wait for data to be read to arrive under
    heads
  • Rotational Latency
  • Data read into or written from buffer on
    controller

25
Magnetic Disks
  • Hard disk
  • Higher speed (3600 - 7200)
  • Larger
  • Higher Density
  • Multiplatter
  • Flying heads!
  • Performance
  • Seek time (8-20 ms or faster)
  • Rotational latency (4-8 ms)
  • Transfer rate 2-40 MB/sec

26
Magnetic Disks
  • Originally all tracks had same number of sectors.
    No longer true.
  • Disk rotational speeds increasing
  • 12,000 RPM!?!?!?
  • seek time, rotational latency, data transfer rate
  • Typical numbers
  • 20 surfaces, 1000 tracks, 128 sectors

4 GB!!!
27
Disk Calculations
  • A disk has 3 platters.
  • Each platter has 100 tracks.
  • Each track has 20 sectors.
  • Each sector has 256 bytes
  • How many bytes per cylinder?
  • 3 x 20 x 256
  • 3 x 2 x 20 x 256
  • 3 x 20 x 100 x 256
  • 2 x 20 x 256

28
Disk Scheduling
  • FCFS
  • SSTF
  • SCAN
  • C-SCAN
  • LOOK
  • C-LOOK

29
Storage Abstraction
  • Process is the OS abstraction for processor
  • Data structures are the language abstraction for
    memory
  • Consider a program
  • Text, and data structures are meaningful for the
    life of the program (i.e. when it is executing as
    a process)
  • What about state that a program wants to leave
    behind after execution as a process terminates?
  • Magnetic/optical store on the hardware side
  • An abstraction of this hardware presented by the
    OS

30
Device independent I/O
  • What abstraction should the OS provide?
  • Virtual devices with generic API
  • open, seek, read, write, close
  • Advantages
  • programming API is device independent
  • easy to add new devices
  • Step towards such a device independent I/O
  • File systems...

31
File System
  • File A Collection of info with attributes
  • Data (the actual user info)
  • Attributes name, access rights, physical
    representation, logical representation,
    accounting info,
  • Where are the attributes?
  • Can be part of the file, and/or
  • Physical representation kept in directory

32
  • File names
  • Single level (Univac EXEC 8, circa late 1970s,
    DEC RT-11)
  • Unique name for each filerestrictive
  • Single directory to searchexpensive
  • Two-level (DEC TOPS-10, RSX-11M circa early 80s)
  • Top level user/project
  • Directory tells how to get to an individual
    user/project
  • Example dp033,077test.dat
  • Directory was named dp0,0033077.dir
  • Second level file name unique to user/project

33
  • File names
  • Hierarchical (Multics, Unix, NT)
  • A file name made of several parts
    (/users/leahy/grades)
  • Each part unique with respect to previous parts
  • Directory?
  • Just another file that contains info about files
    at next lower levels

34
  • Other naming issues
  • Aliases
  • Hard links
  • Deletion of a file
  • Symbolic links
  • File name extensions
  • Mandatory (TOPS 10)
  • Optional (Unix, NT)
  • Version numbers
  • Write implicitly creates new versions.
  • (RSX-11M)
  • Purging
  • Write over-writes previous version (Unix, NT)

35
Access Rights
  • Permissions on a file
  • Read, write, execute, delete, change permissions
  • Change permissions
  • Who can?
  • Who should?
  • Storing access rights
  • One per user per file feasible?
  • Compromise User/Group/Other

36
Physical Representation of File
  • Goals
  • Fast sequential access (SA)
  • Fast random access (RA)
  • Ability to grow the file
  • Easy allocation of storage
  • Data structure in the file system
  • A table that maps file name to disk address
  • Free list of disk blocks

37
Allocation Strategies
  • 1. Fixed contiguous regions
  • Regions
  • One track
  • One cylinder
  • Contiguous range of cylinders
  • Characteristics
  • Data structures (on the disk at a well-known
    place)
  • Free list bit map of free cylinders
  • Directory mapping table (file name to cylinder
    address)
  • SA and RA quick allocation is quick as well
  • Cannot grow file size above allocation
  • DEC RT-11

-(
38
Allocation Strategies
  • 2. Contiguous regions with overflow areas
  • Secondary area for growth (also contiguous)
  • Characteristics
  • RA requires some computation
  • SA as fast as 1.

39
Allocation Strategies
  • 3. Linked allocation
  • File divided into (sector sized) blocks
  • Each block points to next one disk becomes a
    giant linked list!
  • Characteristics
  • Data structures (on the disk at a well-known
    place)
  • free-list (a linked list) mapping table (file
    name to starting disk block)
  • SA slow due to seek time RA pointer chasing
  • Growth easy allocation is expensive

40
Allocation Strategies
  • 4. File Allocation Table (FAT) MS-DOS
  • At the beginning of each partition, a table that
    contains one entry for each disk block in that
    partition (0 indicates it is free)
  • A file occupies a number of entries in the FAT
  • Each entry points to the next entry in the FAT
    for SA (-1 indicates it is the last block)
  • Characteristics
  • FAT is the data structure efficient for
    allocation less chance of screwing up as in (3)
  • SA requires FAT lookup (can be alleviated by
    caching the FAT)
  • RA requires some computation
  • Limit on size of partition (this is BAD!) growth
    easy

41
Allocation Strategies
  • 5. Indexed Allocation
  • File represented by an index block (on the disk),
    a table of disk blocks for the file
  • Characteristics
  • Data structures
  • Mapping table (file name to index block)
  • Free list (can be a bit map of available disk
    blocks)
  • Limit on the size of the file
  • Wasted space
  • Could have mechanism for additional index blocks
  • OR...

42
Allocation Strategies
  • 6. Multilevel Indexed Allocation
  • File represented by an index block (on the disk),
    an indirection table of disk blocks for that file
  • One level indirection
  • Two level indirection
  • Triple indirection

43
Multilevel Indexed Allocation
44
Allocation Strategies
  • 7. Hybrid (BSD, Unix)
  • Combination of (5) and (6)
  • Each file represented by an i-node (index node)
  • Index to first n disk blocks, plus
  • A single indirect index, a double indirect index,
    a triple indirect index
  • Characteristics
  • SA requires i-node reference
  • overhead reduced by in-memory cache
  • RA requires some computation but much quicker
    than (3)
  • Growth is easy
  • Allocation overhead same as (3)

45
Unix Inode
46
Logical Representation
  • FS may treat a file as an un-interpreted stream
    of bytes (Unix approach)
  • Structured files of a user-defined record (not in
    Unix or NT)
  • Only feasible if FS implemented at user level
  • What happens when you edit a file?
  • Growth of a file is it always at the end of the
    file?
  • How does the storage system handle insertions in
    the middle of a file?

47
Questions?
48
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com