File Organizations What an OS provides Creative Commons

  • Slides: 25
Download presentation
File Organizations What an OS provides Creative Commons License – Curt Hill

File Organizations What an OS provides Creative Commons License – Curt Hill

Why files? • Computer memory has several problems: – Expensive – Volatile • Persistant

Why files? • Computer memory has several problems: – Expensive – Volatile • Persistant data must be stored on disk or tape • The Operating System controls disk access – All disk access is somewhat platform dependent Creative Commons License – Curt Hill

The Memory Hierarchy CPU Cache Memory Disk Tape Creative Commons License – Curt Hill

The Memory Hierarchy CPU Cache Memory Disk Tape Creative Commons License – Curt Hill

Disks • Rotating magnetic media • Flat, round platter of metal or plastic and

Disks • Rotating magnetic media • Flat, round platter of metal or plastic and covered with magnetic coating • Information stored as magnetized spots on the magnetic coating called bits • Access arms hold the heads – Move to read different areas Creative Commons License – Curt Hill

Disk units • Organization of disk – Cylinders • Any area that can be

Disk units • Organization of disk – Cylinders • Any area that can be read without moving head – Tracks • Concentric circles on surface • Disk rotates under head – Sectors • Pie shaped divisions on surface Creative Commons License – Curt Hill

Hard Disk Organization Sector Track Creative Commons License – Curt Hill

Hard Disk Organization Sector Track Creative Commons License – Curt Hill

Disks are DASD • Direct Access Storage Device • Any sector may be read

Disks are DASD • Direct Access Storage Device • Any sector may be read directly • Disk address contains – Cylinder address • Forces moving heads – Track address • Selects a head – Sector address • Rotation of sector under head Creative Commons License – Curt Hill

Hard Disk Drives Creative Commons License – Curt Hill

Hard Disk Drives Creative Commons License – Curt Hill

Disk Access Time • Seek time – Movement of access arm to correct cylinder

Disk Access Time • Seek time – Movement of access arm to correct cylinder • Rotational delay – Movement of disk to position correct sector under read/write head • Activation of appropriate read/write head • Transfer rate of data from disk to main memory Creative Commons License – Curt Hill

Access Time Again • Seek time and rotational delay dominate. – Seek time varies

Access Time Again • Seek time and rotational delay dominate. – Seek time varies from about 1 to 20 msec – Rotational delay varies from 0 to 10 msec – Transfer rate is about 1 msec per 4 KB page • Goal is to reduce these delays – This is done with both hardware and software – RAID is a hardware solution – What are the software solutions? Creative Commons License – Curt Hill

Reducing Access Time • If you access the first block of a track –

Reducing Access Time • If you access the first block of a track – You have all the access delays • If you then access the second block of a track the only delay is transfer time Creative Commons License – Curt Hill

Quicker Access • • Blocks in same track Blocks in same cylinder Blocks in

Quicker Access • • Blocks in same track Blocks in same cylinder Blocks in adjacent cylinders Pre-fetching – Read the entire track at the time of the request for any block Creative Commons License – Curt Hill

Disk Reliability • How reliable are disk drives? • Reliable but not perfect •

Disk Reliability • How reliable are disk drives? • Reliable but not perfect • The advent of server farms with thousands of consumer disks has allowed for studies that give us some answers • Disk failures tend to make a “bathtub” curve • 80% survived four years Creative Commons License – Curt Hill

Failure Graph Creative Commons License – Curt Hill

Failure Graph Creative Commons License – Curt Hill

Explanation • The initial failures are usually manufacturing defects – They cause an early

Explanation • The initial failures are usually manufacturing defects – They cause an early death • Next comes a period of high reliability • Finally we see a period of drives wearing out • These were from a study of 25, 000 drives in a server farm Creative Commons License – Curt Hill

Failure Rates Again Creative Commons License – Curt Hill

Failure Rates Again Creative Commons License – Curt Hill

Common File Organizations • • Sequential Direct Indexed Sequential Most others are variations on

Common File Organizations • • Sequential Direct Indexed Sequential Most others are variations on these basic themes Creative Commons License – Curt Hill

Sequential Files • Records are stored one after another • Accessing 500 threcord requires

Sequential Files • Records are stored one after another • Accessing 500 threcord requires reading 499 prior records • Weakest file organization • Easiest to implement – Even tape drives support Creative Commons License – Curt Hill

Direct Files • AKA Relative files • The file is a linear sequence of

Direct Files • AKA Relative files • The file is a linear sequence of equal sized numbered slots • Each slot may be accessed directly • Slots may be empty or used • Key is an integer • Requires DASD 0 1 2 3 4 5 6 7 8 9 10 11 12 12 Creative Commons License – Curt Hill

Indexed Files • AKA Indexed Sequential File • Depending on the OS may actually

Indexed Files • AKA Indexed Sequential File • Depending on the OS may actually be two files – An index – The data • The index is a tree of keys • The data is a sequence of records at the bottom of the tree • Requires DASD • Key may be of any type Creative Commons License – Curt Hill

Index Sequential File Tree Charles Kline Roberts Zane Roberts Able Abel Bart Bag Casey

Index Sequential File Tree Charles Kline Roberts Zane Roberts Able Abel Bart Bag Casey Calvin Charles Dean Easy Frank Jam Kline Larry. Leestra Morris May Roberts Smith Singer. Taylor Smith. Vernon Taylor Vernon Zane Creative Commons License – Curt Hill

Indexed Files • Previous tree only had two levels – One index – One

Indexed Files • Previous tree only had two levels – One index – One data • • Usually many levels of index One level of data The index is a tree of keys The data is a sequence of records at the bottom of the tree Creative Commons License – Curt Hill

Linkage • Indexed files require links between records • The link is a disk

Linkage • Indexed files require links between records • The link is a disk address – Cylinder, Track, Sector or – Block number • The links connect the indices with their corresponding data • Different from Sequential or Direct – OS supports these Creative Commons License – Curt Hill

Access and Organization • There are two typical means to access a file: –

Access and Organization • There are two typical means to access a file: – Sequential – Random • Sequential access may be applied to any file organization • Random requires a key and may only be applied to Direct or Indexed files Creative Commons License – Curt Hill

Finally • • Not every OS provides each of these Always sequential Usually some

Finally • • Not every OS provides each of these Always sequential Usually some form of direct Indexed sequential seldom – Often provided by external software Creative Commons License – Curt Hill