Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Processing - Physical Devices MVNC1 Secondary Storage Devices Chapter 3.

Similar presentations

Presentation on theme: "File Processing - Physical Devices MVNC1 Secondary Storage Devices Chapter 3."— Presentation transcript:

1 File Processing - Physical Devices MVNC1 Secondary Storage Devices Chapter 3

2 File Processing - Physical Devices MVNC2 Secondary Storage Devices l Logical vs. Physical Devices »Rather then require user software to "know" about specific device types and names, "logical" device names are used to hide device specifics »If device changes (system changed or program moved to new system), user must simply assign new device physical name appropriate logical name.

3 File Processing - Physical Devices MVNC3 Secondary device types l Magnetic disk l Magnetic tape l Semiconductor memory devices l Mass storage devices

4 File Processing - Physical Devices MVNC4 Magnetic disks l Disk platters, coated with ferrous oxide, rotate on a spindle. l Read/write heads read and record information in single bit wide "tracks". l These tracks are broken up into blocks, or "sectors".

5 File Processing - Physical Devices MVNC5 Magnetic disks l Performance - 3 aspects to timing »seek time - time to move head to the correct cylinder. »Latency - time for disk to rotate to correct position. »Transfer rate - speed at which data may be read. l Instantaneous - rate at an instance in time l Average - rate including time for IBG

6 File Processing - Physical Devices MVNC6 Magnetic disks l Hard disks. »Sector - block size on disk (if fixed). »Track - all sectors in a concentric circle. »Platter - one physical disk - two surfaces. »May have multiple platters. All parallel tracks form a "cylinder".

7 File Processing - Physical Devices MVNC7 Magnetic disks l Disks spin fast (~ 3600 rpm). l Heads "fly" over surface. l If they touch, or "crash" both heads and surface may be damaged. l the closer the heads, the higher the density l Movable heads must accurately locate correct track. l Often one surface is used for timing and position sensing

8 File Processing - Physical Devices MVNC8 Magnetic disks l Fixed Winchester technology disks »since sealed, no dirt can cause crash, heads fly very close. »May have multiple heads per surface. »High density. »Fast (mult. heads & high dens.)

9 File Processing - Physical Devices MVNC9 Magnetic disks l Removable »Lower density then fixed.

10 File Processing - Physical Devices MVNC10 Magnetic disks l Fixed head »One head for every track. »Very fast. »Expensive

11 File Processing - Physical Devices MVNC11 Magnetic disks l Floppy disks: »single flexible platter »Rotate slowly (360 rpm) »Head in constant contact with surface »Easily damaged »Heads seek slowly

12 File Processing - Physical Devices MVNC12 Magnetic disks l Disk defects »due to the thinness of the surface coating, most disks have small flaws or defects »Spare tracks or sectors are provided for storage of data that normally would be stored in the damaged location. »Either the hardware or software must handle these "bad" sections.

13 File Processing - Physical Devices MVNC13 Magnetic disks l Disk track formats »Tracks are divided into either fixed length sectors or variable or user-defined length blocks.

14 File Processing - Physical Devices MVNC14 Sector-addressable devices l The disk tracks are subdivided into fixed size sectors. l Advantages: »simple allocation of storage space »simple address calculations l Disadvantages »Internal fragmentation

15 File Processing - Physical Devices MVNC15 Sector-addressable devices - interleaved l Disks spin too fast too fast to read adjacent blocks l Solution - interleave blocks »Logically adjacent blocks not physically adjacent »Interleaving facter - distance between blocks Interleave Factor: 3

16 File Processing - Physical Devices MVNC16 Sector-addressable devices - interleaved l If the factor is n, the n revolutions are required to read the whole track l High performace controller speeds now allow up to 1:1 interleaving! Interleave Factor: 3

17 File Processing - Physical Devices MVNC17 Sector-addressable devices - Clustered l File System groups sectors into logically contiguous clusters. l All allocation, reading, and writting is done on an entire cluster. l For Example, with 512 byte sectors, can have cluster sized ranging from 1 to 65,535 sectors.

18 File Processing - Physical Devices MVNC18 Sector-addressable devices - Clustered l Advantages over non-clustered »Blocking - do less reads and writes, to faster overall performance »Management - maintain information on file as a list of clusters, rather then a (longer) list of sectors File allocation tablecluster numberlocation

19 File Processing - Physical Devices MVNC19 Sector-addressable devices - Clustered l Disadvantages »More Wasted Space - more Internal Fragmentation l Thus cluster size is a space/time tradeoff!

20 File Processing - Physical Devices MVNC20 Sector-addressable devices - extents l An extent is a physically contiguouus collection of clusters l If a file is in one extent, it is all physically continguious. »Reduces seek time to read entire file l A file may need more then one extent if not enough physical contiguous available »the disk is fragmented

21 File Processing - Physical Devices MVNC21 Block-addressable devices l Block size is programmable, as in magnetic tapes. l Blocks sizes may be mixed on a single device. l Advantages: »As with mag. tape, space is saved by blocking (fewer gaps) as a multiple of logical record size »no internal fragmentation! (unused area at end of block) l Disadvantages »External Fragmentstion »Complex space management

22 File Processing - Physical Devices MVNC22 Space utilization l Space utilization of sector addressable devices l Consider a disk with: »512 bytes per sector »32 sectors per track »20 track per cylinder »400 cylinders/disk pack l what is the disk size in bytes? »512 * 32 * 20 * 400 = 131,072,000 bytes »or 131 megabytes.

23 File Processing - Physical Devices MVNC23 Space utilization l How many sectors will be used to store 8,000 records on the above disk if record size is 100 bytes? »Blocking factor = 5 Thus

24 File Processing - Physical Devices MVNC24 Space utilization »Utilization - how much is used? »Thus:

25 File Processing - Physical Devices MVNC25 Nondata Overhead l Disk require space for nondata overhead »interblock gaps »block headers »synchronization marks l These fields are invisible on sector addressable devices, and usually need not be considered in space computations.

26 File Processing - Physical Devices MVNC26 Magnetic Disk Timing l Timing is a function of the following device specific factors: »Seek time »rotational delay (latency) »transmission time (read time) l The times for these is not fixed, but vary based on the previous status of the disk drive, disk and head position relative to desired position.

27 File Processing - Physical Devices MVNC27 Magnetic Disk Timing l Consider the following times: »Seek time: –Track to track time:1 milliseconds –Full disk movement:9 milliseconds –average move time:7.6 milliseconds »Rotational Speed: 7200 RPM »Average rotational delay: (60/7200)/2 = 4.16 milliseconds »Transfer rate:66.6 Mbytes/second »Sector size:512 bytes

28 File Processing - Physical Devices MVNC28 Magnetic Disk Timing l Thus is would take: to transfer a sector.

29 File Processing - Physical Devices MVNC29 Magnetic Disk Timing l Average access per sector is: average sector access time = seek time + l rotational delay + l transfer time l Thus, for the case above: l average sector access time is = ms

30 File Processing - Physical Devices MVNC30 Magnetic Disk Timing Clustering

31 File Processing - Physical Devices MVNC31 Magnetic tape l Typically nine tracks wide l 800, 1600, 6250 bits per inch (bpi) l Storage based on the magnetic polarity of ferrous oxide particles on the tape. l The tape moves over read/write heads to store and retrieve information

32 File Processing - Physical Devices MVNC32 Magnetic tape l The write head magnetizes small regions of the tape in one of two directions. l The read head senses the places where magnetic polarity changes, called "flux change". l Flux changes cause an electrical current to be produced in the windings of the read head. l Speed varies between 40 to 200 inches per second (ips)

33 File Processing - Physical Devices MVNC33 Magnetic tape l Vacuum loops hold a reservoir of tape. l This way the bulky reels do not have to keep up with acceleration/deceleration of tape, but can catch up a short time later.

34 File Processing - Physical Devices MVNC34 Magnetic tape l Streaming tape drive - No loops needed. l Very slow in start/stop mode (~20k/sec), but extremely fast in continuous mode. (~160k/sec). l Often these are cartridge type devices. l Used for high speed/low cost backup devices.

35 File Processing - Physical Devices MVNC35 Magnetic tape l Error checking and correction »Even/odd parity. –Vertical redundancy checking (VCR): An extra bit per column is set or clear to make the number of bits set either even or odd. –Longitudinal redundancy checking (LCR): Each "row" of bits in a block has a parity bit. –Using VCR and LCR together, errors may be found and corrected in flight.

36 File Processing - Physical Devices MVNC36 Magnetic tape l Error checking and correction »Checksum –addition of all data in a block together using modulo arithmetic. –Then this values is recorded at the end of the data block.

37 File Processing - Physical Devices MVNC37 Magnetic tape l Error checking and correction l Cyclic redundancy check (CRC) »Based on calculating polynomial functions of data. »Can correct multiple errors.

38 File Processing - Physical Devices MVNC38 Magnetic tape l Error checking and correction »Soft error - errors which can be corrected »Hard errors, errors that can not be corrected.

39 File Processing - Physical Devices MVNC39 Magnetic tape l Blocking »Tapes must be read at a constant speed. »To facilitate starting and stopping midtape, interblock gaps (IBG) are used to allow time for acceleration/ deceleration of tape. »Typical size 0.6 inch. IBG

40 File Processing - Physical Devices MVNC40 Magnetic tape l Buffering »Blocks of tape read into buffer for subsequent processing. »One physical block may hold several logical blocks. »blocking factor - number of logical blocks per physical block. »Optimizes slow I/O time.

41 File Processing - Physical Devices MVNC41 Space utilization »Blocking factor greatly affects utilization of tape. »Block size = record size x blocking factor »gap length = density (bytes per inch) x gap length (in)

42 File Processing - Physical Devices MVNC42 Space utilization l Consider: »6250 BPI tape »0.6 inch IBG »100 byte records

43 File Processing - Physical Devices MVNC43 Space utilization

44 File Processing - Physical Devices MVNC44 Timing considerations

45 File Processing - Physical Devices MVNC45 Timing considerations l Consider »6250 BPI tape »100 byte records »100 IPS (inches per second) ».03 second start time ».03 second stop time

46 File Processing - Physical Devices MVNC46 CR-ROM l 600 megabytes l read-only (write-once) l very cheap to produce l History: »Offspring of videodisk from late 60s, early 70s. Many standards caused problems. »Early 80s work began on developing a audio discs »Sony and Philips developed as a standard. »Introduced in 1984 »File system standard developed in »DVD is the latest in CD standards - 10 gigabytes

47 File Processing - Physical Devices MVNC47 CR-ROM l Strengths »High Capacity »Inexpensive »Durable l Weaknesses »extremely slow seek speed (transfer rate in reasonable)

48 File Processing - Physical Devices MVNC48 CR-ROM: Physical Organization l Creating »Bits stored as Pits and Lands: »CD-ROMs are stamped from a glass master disk which has a coating that is changed by the laser beam. »When the coating is developed, the areas hit by the laser beam turn into pits along the track followed by the beam. »The smooth unchanged areas between the pits are called lands.

49 File Processing - Physical Devices MVNC49 CR-ROM: Physical Organization l Reading »A beam of laser light is focused on the track as it moves under the optical pickup. »The pits scatter the light, but the lands reflect most of it back to the pickup. »This alternating pattern of high- and low-intensity reflected light is the signal used to reconstruct the original digital information.

50 File Processing - Physical Devices MVNC50 CR-ROM: Physical Organization l Digital Encoding » 1s are represented by the transition from pit to land and back again. » 0s are represented by the amount of time between transitions. »The longer between transitions, the more 0s we have.

51 File Processing - Physical Devices MVNC51 CR-ROM: Physical Organization l Digital Encoding »Given this scheme, it is not possible to have two adjacent 1s: 1s are always separated by 0s. »As a matter of fact, because of physical limitations, there must be at least two 0s between any pair of 1s. »Raw patterns of 1s and 0s have to be translated to get the 8-bit patterns of 1s and 0s that form the bytes of the original data.

52 File Processing - Physical Devices MVNC52 CR-ROM: Physical Organization l Digital Encoding »EFM encoding (Eight to Fourteen Modulations) turns the original 8 bits of data into 14 expanded bits that can be represented in the pits and lands on the disk. »Since 0s are represented by the length of time between transition, the disk must be rotated at a precise and constant speed. This affects the CD- ROM drives ability to seek quickly.

53 File Processing - Physical Devices MVNC53 CR-ROM: Physical Organization l CLV instead of CAV »CLV: Constant Linear Velocity »CAV: Constant Angular Velocity

54 File Processing - Physical Devices MVNC54 CR-ROM: Physical Organization l CLV instead of CAV »Data on a CD-ROM is stored in a single, spiral track. Constant Linear Velocity Constant Angular Velocity

55 File Processing - Physical Devices MVNC55 CR-ROM: Physical Organization l CLV instead of CAV »This allows the data to be packed as tightly as possible since all the sectors have the same size (whether in the center or at the edge). »In the magnetic disk drive the data is packed more densely in the center than in the edge, thus Space is lost in the edge. »Since reading the data requires that it passes under the optical pick-up device at a constant rate, the disc has to spin more slowly when reading the outer edges than when reading towards the center.

56 File Processing - Physical Devices MVNC56 CR-ROM: Physical Organization l CLV instead of CAV »The CLV format is responsible, in large part, for the poor seeking performance of CD-ROM Drives: there is no straightforward way to jump to a location. »Part of the problem is the need to change rotational speed.

57 File Processing - Physical Devices MVNC57 CR-ROM: Physical Organization l CLV instead of CAV »To read the address info that is stored on the disc along with the users data, we need to be moving the data under the optical pick up at the correct speed. »But to know how to adjust the speed, we need to be able to read the address info so we know where we are. »How do we break this loop? By guessing and through trial and error ==> Slows down performance.

58 File Processing - Physical Devices MVNC58 CR-ROM: Physical Organization l CD Addressing »Each second of playing time on a CD is divided into 75 sectors. »Each sector holds 2 Kilobytes of data. »Each CD-ROM contains at least one hour of playing time. »Thus the disc is capable of holding at least: 60 min * 60 sec/min * 75 sector/sec * 2 Kilobytes/sector = 540, 000 Kbytes »Often, it is actually possible to store over 600, 000 KBytes. »Sectors are addressed by min:sec:sector e.g., 16:22:34

59 File Processing - Physical Devices MVNC59 I/O in Unix »I/O is performed by calls to the I/O portion of the Unix Kernel »The Kernel presents a simple view of I/O - as sequences of bytes. »The Kernal maintains a series of tables to keep track of I/O

60 File Processing - Physical Devices MVNC60 I/O in Unix - tables l File Descriptor Table »One for each process »Maps file descriptors onto specific open files in open file table l Open files table »System wide »Entry for each instance of open file »File may be opened by more then one process

61 File Processing - Physical Devices MVNC61 I/O in Unix - tables l Table of Index nodes (inodes) »Used to describe each file »Describes file, points to all blocks l Index nodes »Each contains a list of 13 pointers –first 10 point directly to first ten data blocks –11th points to another inode of 1000 pointers to blocks –12th points to block of 1000 pointers, each of which points to a block 1000 pointers (1 meg) –13th point to block adds one more level of indirection, giving 1 billion blocks!

62 File Processing - Physical Devices MVNC62 File Descriptor Table FileFile table descriptorentry 0 (keyboard) 1 (screen) 2 (error) 3 (normal file) 4 (normal file) FileFile table descriptorentry 0 (keyboard) 1 (screen) 2 (error) 3 (normal file) 4 (normal file) to open file table

63 File Processing - Physical Devices MVNC63 Open files table Number of Offsetptr toinode R/Wprocessesof nextwritetable modeusing itaccessroutine...entry..... write read Number of Offsetptr toinode R/Wprocessesof nextwritetable modeusing itaccessroutine...entry..... write read

64 File Processing - Physical Devices MVNC64 Index nodes (inodes) device permissions owners userid file size. block count file allocation table

65 File Processing - Physical Devices MVNC65 Index nodes (inodes) root Inode 10 blocks Inode 1000 blocks Inode 1000 inodes Inode 1000 pointers to inodes

66 File Processing - Physical Devices MVNC66 File Allocation l Consider A 1MB file on a system with a block size set to 8KB. »Then the file will have 125 blocks. »First 10 pointed at directly by root inode »next 115 pointed at indirectly through indirect inode l Max file size: »8KB*(10 + 2**10 + 2**20 + 2**30) »that is more than 16TB! »Depends of block (or cluster) size

67 File Processing - Physical Devices MVNC67 File performance l The first 10 blocks are accessed with a single read »the pointers are in main memory where the inode is brought when the file is opened. l The next 1K blocks require up to two reads, one for the index block, one for the data block. l The next 1M blocks require up to three reads, l The next 1G blocks require up to four reads. l Reads slower farther in file!

68 File Processing - Physical Devices MVNC68 l What happens when the program statement: write(textfile, P, 1) is executed ? Part that takes place in memory: l Statement calls the Operating System (OS) which overseas the operation l File manager (Part of the OS that deals with I/O) »Checks whether the operation is permitted »Locates the physical location where the byte will be stored (Drive, Cylinder, Track & Sector) »Finds out whether the sector to locate the P is already in memory (if not, call the I/O Buffer) »Puts P in the I/O Buffer »Keep the sector in memory to see if more bytes will be going to the same sector in the file A Journey of A Byte:

69 File Processing - Physical Devices MVNC69 l Part that takes place outside of memory: l I/O Processor: Wait for an external data path to become available (CPU is faster than data-paths ==> Delays) l Disk Controller: » I/O Processor asks the disk controller if the disk drive is available for writing »Disk Controller instructs the disk drive to move its read/write head to the right track and sector. »Disk spins to right location and byte is written A Journey of A Byte:

70 File Processing - Physical Devices MVNC70 Data transfer time disparity l Disk access time is slowed by the time required for the heads to move into position (seek time), and the time for the disk to rotate to the correct position (latency). l There are several ways to avoid costly delays while waiting for the disk.

71 File Processing - Physical Devices MVNC71 Data transfer time disparity l Multiprogramming »In a single process environment, the CPU must usually sit "idle" while it waits for I/O to complete. »This is just wasted CPU time. »Solution: Share CPU among several users (processes). While one process is waiting for I/O, another runs. »The O.S. is responsible to arbitrate the use of the CPU among the waiting processes (users).

72 File Processing - Physical Devices MVNC72 Data transfer time disparity Single Process Multi-Process Run Wait

73 File Processing - Physical Devices MVNC73 Direct Memory Access (DMA) l Sophisticated I/O controllers transfer requested blocks directly into memory while CPU is working on something else. l The I/O controller is given the address of the data on the device. l The I/O controller locates the data, and "steals" bus cycles from the CPU to perform transfers. CPU Primary Memory I/O Controller

74 File Processing - Physical Devices MVNC74 Direct Memory Access (DMA) Process Memory Activity Stolen Cycles

75 File Processing - Physical Devices MVNC75 Buffering l Consider the following characteristics of disk access »the majority of I/O time is consumed by head movement time. »each I/O call has related overhead and »Data must often be read in a certain minimum size (physical block size) »Files are often read in a sequential order. »It doesn't take much more time to read several records then one.

76 File Processing - Physical Devices MVNC76 Buffering l Solution: Buffering »read or write of several records during each transfer operation. »Reading - Anticipatory buffering –Read several records at a time into buffer –Use records from buffer if possible –Read only when buffer empty »Writing –Write records to buffer rather then I/O device –Write buffer to I/O device when full

77 File Processing - Physical Devices MVNC77 Buffering Read 1 Process 1 Read 2 Process 2 Read 3 Read 4 Process 3 Process 4 Process 5 Read 5 Without Buffering Read 1-5 Process 1 Process 2 Process 3 Process 4 Process 5 With Buffering (5) Read 6-10 Process 6 Process 7 Process 8 I/O CPU I/O CPU

78 File Processing - Physical Devices MVNC78 Buffer Size l Blocking factor - number of records per block l usually an integral number of records. l the buffer size often is the same size as the block size of the physical device. l Example: »Record Size: 80 bytes »Physical Block Size: 512 bytes »Blocking Factor: floor(512/80) = 18

79 File Processing - Physical Devices MVNC79 Overlapped buffering or double buffering l Technique whereby a single process can overlap record processing with the I/O process. l Consider a case of double buffering »Allocate two buffers for the file »When file opened, fill both buffers »As soon as one block is requested by user program, a anticipatory read is begun for next block l concept of buffering is like passing buckets of water to a burning house.

80 File Processing - Physical Devices MVNC80 Single buffering Read 1 Process 1 Process 2 Process 3 Process 4 I/O CPU Read 2 Read 3 Read 4

81 File Processing - Physical Devices MVNC81 Double buffering Read 1 Process 1 Process 2 Process 3 Process 4 Read 2 Read 3 Read 4 Read 5 Read 6 Read 7 Process 5 Process 6 Process 7 Here the I/O time is greater then processing time, What if Processing time is greater?

Download ppt "File Processing - Physical Devices MVNC1 Secondary Storage Devices Chapter 3."

Similar presentations

Ads by Google