auxilary memory
TRANSCRIPT
-
8/7/2019 auxilary memory
1/47
Jatinder singhJatinder singh
Secondary Storage Devices:Secondary Storage Devices:Magnetic DisksMagnetic Disks
Optical DisksOptical Disks
Floppy DisksFloppy Disks
Magnetic TapesMagnetic Tapes
-
8/7/2019 auxilary memory
2/47
Jatinder singhJatinder singh
Secondary Storage DevicesSecondary Storage Devices
Two major types of secondary storageTwo major types of secondary storagedevices:devices:
1.1. Direct Access Storage Devices (DASDs)Direct Access Storage Devices (DASDs)
Magnetic DiscsMagnetic DiscsHard disks (high capacity, low cost, fast)Hard disks (high capacity, low cost, fast)Floppy disks (low capacity, lower cost,Floppy disks (low capacity, lower cost,
slow)slow) Optical DisksOptical Disks
CDCD--ROM = (Compact disc, readROM = (Compact disc, read--onlyonly
memorymemory2.2. Serial DevicesSerial Devices
Magnetic tapes (very fast sequential access)Magnetic tapes (very fast sequential access)
-
8/7/2019 auxilary memory
3/47
Jatinder singhJatinder singh
Storage and FilesStorage and Files
Storage has major implications for DBMS design!Storage has major implications for DBMS design!
READREAD: transfer data from disk to main memory (RAM).: transfer data from disk to main memory (RAM).
WRITEWRITE: transfer data from RAM to disk.: transfer data from RAM to disk.
BothBoth operationsoperations areare highhigh--costcost operations,operations, relativerelative toto inin--memorymemory operations,operations, soso DBDB mustmust bebe plannedplanned carefully!carefully!
Why Not Store Everything in Main Memory?Why Not Store Everything in Main Memory?
CostsC
osts t
oot
oomuchmuch:: C
ostC
ost
ofofRAMRAM ab
outab
out 100100 timestimes thethe c
ostc
ost
ofof
thethe samesame amountamount ofof diskdisk space,space, soso relativelyrelatively smallsmall sizesize..
MainMain memorymemory isis volatilevolatile..
TypicalTypical storagestorage hierarchyhierarchy::
MainMain memorymemory (RAM)(RAM) ((primaryprimary storage)storage) fforor currentlycurrentlyusedused datadata..
DiskDiskfo
rfo
r thethe mainmain databasedatabase ((secondarysec
ondary st
orage)st
orage)..
TapesTapes forfor archivingarchiving olderolder versionsversions ofof thethe datadata ((tertiarytertiarystorage)storage)..
-
8/7/2019 auxilary memory
4/47
Jatinder singhJatinder singh
SStoragetorage HHierarchyierarchy
SSecondary storageecondary storage: magnetic disk/: magnetic disk/optical devices/ tape systemsoptical devices/ tape systems
typicaltypical capacitycapacity aa numbernumber ofof 100100GBGB forforfixedfixed mediamedia;; gg forfor removableremovable
costcost perper MBMB $$00..0101 forfor fixedfixed mediamedia,,moremore forfor removableremovable
typicaltypical accessaccess timetime 88msms toto 1212msms forfor
fixedfixed media,media, largerlarger forfor removableremovable
-
8/7/2019 auxilary memory
5/47
Jatinder singhJatinder singh
Magnetic DisksMagnetic Disks
Bits of data (0s and 1s) are storedBits of data (0s and 1s) are storedon circular magnetic platters calledon circular magnetic platters calleddisksdisks..
A disk rotates rapidly (& neverA disk rotates rapidly (& neverstops).stops).
AA disk headdisk head reads and writes bits ofreads and writes bits of
data as they pass under the head.data as they pass under the head. Often, several platters are organizedOften, several platters are organized
into ainto a disk packdisk pack (or(or disk drivedisk drive).).
-
8/7/2019 auxilary memory
6/47
Jatinder singhJatinder singh
A Disk DriveA Disk Drive
Disk drive with 4 platters and 8 surfaces and 8 RW heads
surfaces
Spindle Boom
Read/Write heads
-
8/7/2019 auxilary memory
7/47
Jatinder singhJatinder singh
Looking at a surfaceLooking at a surface
Surface of disk showing tracks and sectors
sector
tracks
-
8/7/2019 auxilary memory
8/47
Jatinder singhJatinder singh
Organization of DisksOrganization of Disks
Disk contains concentricDisk contains concentric tracks.tracks.
Tracks are divided intoTracks are divided intosectorssectors
AA sectorsector is the smallest addressableis the smallest addressableunit in a disk.unit in a disk.
-
8/7/2019 auxilary memory
9/47
Jatinder singhJatinder singh
Components of a DiskComponents of a Disk
Platters
Spindle
Disk head
Arm movement
Arm assembly
Tracks
Sector
The platters spin (say, 90rps).
The arm assembly ismoved in or out to position
a head on a desired track.Tracks under heads makea cylinder(imaginary!).
Only one head
reads/writes at anyone time.
Block size is a multipleof sector size (which is often
fixed).
-
8/7/2019 auxilary memory
10/47
Jatinder singhJatinder singh
Disk ControllerDisk Controller
DiskDisk controllerscontrollers:: typicallytypically embeddedembedded inin thethe diskdiskdrivedrive,, whichwhich actsacts asas anan interfaceinterface betweenbetween thetheCPUCPU andand thethe diskdisk hardwarehardware..
TheThe controllercontroller hashas anan internalinternal cachecache (typically(typically aanumbernumber ofof MBs)MBs) thatthat itit usesuses toto bufferbuffer datadata forfor
read/writeread/write requestsrequests..
-
8/7/2019 auxilary memory
11/47
Jatinder singhJatinder singh
Accessing DataAccessing Data
When a program reads a byte from theWhen a program reads a byte from thedisk, the operating system locates thedisk, the operating system locates thesurface, track and sector containing thatsurface, track and sector containing thatbyte, and reads the entire sector into abyte, and reads the entire sector into a
special area in main memory calledspecial area in main memory calledbufferbuffer..
The bottleneck of a disk access is movingThe bottleneck of a disk access is movingthe read/write arm.the read/write arm.
So
it makes sense to
store a
file in tracks thatS
oit makes sense t
ost
ore a
file in tracks thatare below/above each other on differentare below/above each other on different
surfaces, rather than in several tracks on thesurfaces, rather than in several tracks on thesame surface.same surface.
-
8/7/2019 auxilary memory
12/47
Jatinder singhJatinder singh
CylindersCylinders
AA cylindercylinder is the set of tracks at ais the set of tracks at agiven radius of a disk pack.given radius of a disk pack.
i.e. a cylinder is the setof
tracks thati.e. a cylinder is the setof
tracks thatcan be accessed without moving thecan be accessed without moving thedisk arm.disk arm.
All the information on a cylinder canAll the information on a cylinder can
be accessed without moving thebe accessed without moving theread/write arm.read/write arm.
-
8/7/2019 auxilary memory
13/47
Jatinder singhJatinder singh
CylindersCylinders
-
8/7/2019 auxilary memory
14/47
Jatinder singhJatinder singh
Estimating CapacitiesEstimating Capacities
Track capacity = # of sectors/track *Track capacity = # of sectors/track *bytes/sectorbytes/sector
Cylinder capacity = # of tracks/cylinder *Cylinder capacity = # of tracks/cylinder *track capacitytrack capacity
Drive capacity = # of cylinders * cylinderDrive capacity = # of cylinders * cylinder
capacitycapacity Number of cylinders = # of tracks in aNumber of cylinders = # of tracks in a
surfacesurface
-
8/7/2019 auxilary memory
15/47
Jatinder singhJatinder singh
ClustersClusters
UsuallyUsually File manager,File manager, under the operatingunder the operatingsystem, maintains the logical viewof a file.system, maintains the logical viewof a file.
File managerFile manager views the file as a series ofviews the file as a series ofclusters,clusters, eacheach of a number of sectors. Theof a number of sectors. The
clusters are ordered by their logical order.clusters are ordered by their logical order. Files can be seen in the form of logical sectors orFiles can be seen in the form of logical sectors or
blocks, which needs to be mapped to physicalblocks, which needs to be mapped to physicalclusters.clusters.
File manager uses aFile manager uses afile allocation ta
ble (FAT)
file allocation ta
ble (FAT)to map logical sectors of the file to the physicalto map logical sectors of the file to the physical
clusters.clusters.
-
8/7/2019 auxilary memory
16/47
Jatinder singhJatinder singh
ExerciseExercise
Consider aConsider a blockblock--addressableaddressable disk with thedisk with thefollowing characteristics:following characteristics: Size of track 20,000 bytes.Size of track 20,000 bytes. Nondata overhead per block = 300 bytes.Nondata overhead per block = 300 bytes. Record size = 100 byte.Record size = 100 byte.
Q) How many records can be storedQ) How many records can be storedper track ifblocking factor is 10 orper track ifblocking factor is 10 or60?60?
a) 10 (20000/1300*10=150)a) 10 (20000/1300*10=150)b) 60 (20000/6300*60=180)b) 60 (20000/6300*60=180)
-
8/7/2019 auxilary memory
17/47
Jatinder singhJatinder singh
The Cost of a Disk AccessThe Cost of a Disk Access T
heT
he timetime to
to
accessaccess aa secto
rsecto
r inin aa tracktracko
no
n aasurfacesurface isis divideddivided intointo 33 componentscomponents::
TimeTimeComponentComponent
ActionAction
Seek TimeSeek Time Time to move the read/writeTime to move the read/writearm to the correct cylinderarm to the correct cylinder
Rotational delay (orRotational delay (orlatency)latency)
Time it takes for the disk toTime it takes for the disk torotate so that the desiredrotate so that the desiredsector is under thesector is under theread/write headread/write head
Transfer timeTransfer time Once the read/write head isOnce the read/write head ispositioned over the data, thispositioned over the data, thisis the time it takes foris the time it takes for
transferring datatransferring data
-
8/7/2019 auxilary memory
18/47
Jatinder singhJatinder singh
Seek timeSeek time
Seek time is the time required to moveSeek time is the time required to movethe arm to the correct cylinder.the arm to the correct cylinder.
Largest in cost.Largest in cost.
Typically:Typically:
5 ms (miliseconds) to move from one track to5 ms (miliseconds) to move from one track tothe next (trackthe next (track--toto--track)track)
50 ms maximum (from inside track tooutside50 ms maximum (from inside track tooutsidetrack)track)
30 ms average (from one30 ms average (from one randomrandom track totrack toanotheranother randomrandom track)track)
-
8/7/2019 auxilary memory
19/47
Jatinder singhJatinder singh
Average Seek Time (Average Seek Time (ss))--11 It is usually impossible to know exactly how manyIt is usually impossible to know exactly how many
tracks will be traversed in every seek,tracks will be traversed in every seek, we usually try to determine thewe usually try to determine the average seek timeaverage seek time
((ss) required for a particular file operation.) required for a particular file operation.
If the starting positions for each access are random, itIf the starting positions for each access are random, itturns out that the average seek traversesturns out that the average seek traverses one third ofone third ofthe total number of cylindersthe total number of cylinders.. Why? There are more ways to travel short distanceWhy? There are more ways to travel short distance
than to travel long distancethan to travel long distance
Manufacturers specifications for disk drives often listManufacturers specifications for disk drives often list
this figure as thethis figure as the average seek timeaverage seek time for the drives.for the drives. Most hard disks today haveMost hard disks today have ss under 10under 10 ms, andms, and
highhigh--performance disks haveperformance disks have ss as lowas lowas 7.5 ms.as 7.5 ms.
-
8/7/2019 auxilary memory
20/47
Jatinder singhJatinder singh
Average Seek Time (Average Seek Time (ss))--22 Seek time depends only on the speedSeek time depends only on the speed
with which the head rack moves, andwith which the head rack moves, andthe number of tracks that the headthe number of tracks that the headmust move across to reach its target.must move across to reach its target.
Given the following (which are constantGiven the following (which are constantfor a particular disk):for a particular disk): HHss = the time for the I/ O head to start= the time for the I/ O head to start
movingmoving HHtt = the time for the I/ O head to move= the time for the I/ O head to move
fr
om
one track t
othe next
fr
om
one track t
othe next
Then the time for the head to move nThen the time for the head to move ntracks is:tracks is:
Seek(n)= HSeek(n)= Hss+ H+ Htt*n*n
-
8/7/2019 auxilary memory
21/47
Jatinder singhJatinder singh
Latency (Rotational Latency)Latency (Rotational Latency)--
11 LatencyLatency is the time needed for the disk to rotate so theis the time needed for the disk to rotate so thesector we want is under the read/write head.sector we want is under the read/write head.
Hard disks usually rotate at about 5000Hard disks usually rotate at about 5000--7000 rpm,7000 rpm,
1212--8 msec per revolution.8 msec per revolution.
Note:Note:
Min latency = 0Min latency = 0
Max latency = Time for one disk revolutionMax latency = Time for one disk revolution
Average latency (Average latency (rr)) = (min + max) / 2= (min + max) / 2
= max / 2= max / 2= time for disk revolution= time for disk revolution
Typically 6Typically 6 4 ms, at average4 ms, at average
-
8/7/2019 auxilary memory
22/47
Jatinder singhJatinder singh
Rotational LatencyRotational Latency--22
Given the following:Given the following: R = the rotational speed of the spindleR = the rotational speed of the spindle
(in rotations per second)(in rotations per second)
UU = the number of radians through= the number of radians throughwhich the track must rotatewhich the track must rotate
then the rotational latencythen the rotational latency UU radiansradians is:is:
Latency= (Latency= (UU/2/244))**(1000/(1000/R), in msR), in ms
-
8/7/2019 auxilary memory
23/47
Jatinder singhJatinder singh
Transfer TimeTransfer Time--11
Transfer time is the time for the read/write head to passTransfer time is the time for the read/write head to passover a block.over a block.
The transfer time is given by the formula:The transfer time is given by the formula:
number of sectorsnumber of sectors
Transfer time =Transfer time = ------------------------------------------------------------------ xx rotationrotationtimetimetrack capacity in number of sectorstrack capacity in number of sectors
e.g. if there are Se.g. if there are Stt sectors per track, the time to transfersectors per track, the time to transfer
one sector would be 1/ Sone sector would be 1/ Stt of a revolutionof a revolution..
-
8/7/2019 auxilary memory
24/47
Jatinder singhJatinder singh
Transfer TimeTransfer Time--22
The transfer time depends only on the speed at which theThe transfer time depends only on the speed at which thespindle rotates, and the number of sectors that must bespindle rotates, and the number of sectors that must beread.read.
Given:Given:
SStt = the total number of sectors per track= the total number of sectors per track the transfer time for n contiguous sectors on the samethe transfer time for n contiguous sectors on the same
track is:track is:
Transfer Time =(Transfer Time =(n/Sn/Stt)*()*(1000/1000/R), inR), in msms
-
8/7/2019 auxilary memory
25/47
Jatinder singhJatinder singh
Fast Sequential ReadingFast Sequential Reading We assume that blocks are arranged so thatWe assume that blocks are arranged so that
there is no rotational delay in transferringthere is no rotational delay in transferringfrom one track to another within the samefrom one track to another within the samecylinder. This is possible if consecutive trackcylinder. This is possible if consecutive trackbeginnings are staggered (like running racesbeginnings are staggered (like running raceson circular race tracks)on circular race tracks)
We also assume that the consecutive blocksWe also assume that the consecutive blocksare arranged so that when the next block is onare arranged so that when the next block is onan adjacent cylinder, there is no rotationalan adjacent cylinder, there is no rotationaldelay after the arm is moved to new cylinderdelay after the arm is moved to new cylinder
Fast sequential readingFast sequential reading: no rotational delay: no rotational delayafter finding the first block.after finding the first block.
-
8/7/2019 auxilary memory
26/47
Jatinder singhJatinder singh
Assuming Fast Reading,Assuming Fast Reading,
ConsequentlyConsequently
ReadingReading bb blocks:blocks:
i.i. Sequentially:Sequentially:
s + r +s + r + bb * btt* btt
bb * btt* btt
ii.ii. Randomly:Randomly:bb * (s + r + btt)* (s + r + btt)
insignificant for large files, where b is very large:
-
8/7/2019 auxilary memory
27/47
Jatinder singhJatinder singh
Secondary Storage Devices:Secondary Storage Devices:
Magnetic TapesMagnetic Tapes
-
8/7/2019 auxilary memory
28/47
Jatinder singhJatinder singh
CharacteristicsCharacteristics
No direct access, but very fastNo direct access, but very fastsequential access.sequential access.
Resistant to
different envir
onmentalResistant t
odi
fferent envir
onmentalconditions.conditions.
Easy to transport, store, cheaperEasy to transport, store, cheaperthan disk.than disk.
Before it was widely used to storeBefore it was widely used to storeapplication data; nowadays, itsapplication data; nowadays, itsmostly used for backups or archives.mostly used for backups or archives.
-
8/7/2019 auxilary memory
29/47
Jatinder singhJatinder singh
MT CharacteristicsMT Characteristics--22
A sequence of bits are stored onA sequence of bits are stored onmagnetic tape.magnetic tape.
For st
orage, the tape is
wound
on aF
or st
orage, the tape is
wound
on areel.reel.
To access the data, the tape isTo access the data, the tape isunwound from one reel to another.unwound from one reel to another.
As the tape passes the head, bits ofAs the tape passes the head, bits ofdata are read from or written ontodata are read from or written ontothe tape.the tape.
-
8/7/2019 auxilary memory
30/47
Jatinder singhJatinder singh
Reel 1 Reel 2
tape
Read/write head
-
8/7/2019 auxilary memory
31/47
Jatinder singhJatinder singh
TracksTracks
Typically data on tape is stored in 9Typically data on tape is stored in 9separate bit streams, orseparate bit streams, or trackstracks..
Each track is a sequenceof
bits.Each track is a sequenceof
bits. Recording density = # of bits perRecording density = # of bits per
inch (bpi). Typically 800 or 1600 bpi.inch (bpi). Typically 800 or 1600 bpi.30000 bpi on some recent devices.30000 bpi on some recent devices.
-
8/7/2019 auxilary memory
32/47
Jatinder singhJatinder singh
MT recording in detailMT recording in detail
0
1
10
1
1
0
1
0
0
1
10
1
1
0
1
0
0
1
10
1
1
0
1
0
0
1
10
1
1
0
1
0
parity bit
8 bits = 1 byte
-
8/7/2019 auxilary memory
33/47
Jatinder singhJatinder singh
Tape OrganizationTape Organization
2400
logical record
BOT
marker
Header block
(describes data blocks)
Data blocks Interblock gap(for acceleration &
deceleration of tape)
EOT
marker
-
8/7/2019 auxilary memory
34/47
Jatinder singhJatinder singh
Data Blocks and RecordsData Blocks and Records
Each data block is a sequence ofEach data block is a sequence ofcontiguouscontiguous recordsrecords..
A record is the unit of data that a usersA record is the unit of data that a users
program deals with.program deals with.
The tape drive reads an entire block ofThe tape drive reads an entire block ofrecords at once.records at once.
Unlike a disk, a tape starts and stops.Unlike a disk, a tape starts and st
ops.
When stopped, the read/write head is overWhen stopped, the read/write head is overan interblock gap.an interblock gap.
-
8/7/2019 auxilary memory
35/47
Jatinder singhJatinder singh
Secondary Storage Devices:Secondary Storage Devices:
CDCD--ROMROM
-
8/7/2019 auxilary memory
36/47
Jatinder singhJatinder singh
Physical Organization ofCDPhysical Organization ofCD--ROMROM
Compact DiskCompact Disk read only memory (writeread only memory (writeonce), R/W is also available.once), R/W is also available.
Data is encoded and read optically with aData is encoded and read optically with a
laserlaser Can store around +600MB dataCan store around +600MB data
Digital data is represented as a series ofDigital data is represented as a series ofPitsPits andand Lands:Lands:
PitPit = a little depression, forming a lower level= a little depression, forming a lower levelin the trackin the track
LandLand = the flat part between pits, or the= the flat part between pits, or theupper levels in the trackupper levels in the track
-
8/7/2019 auxilary memory
37/47
Jatinder singhJatinder singh
Organization of dataOrganization of data
Reading a CD is done by shining a laser at theReading a CD is done by shining a laser at thedisc and detecting changing reflections patterns.disc and detecting changing reflections patterns.
1 = change in height (land to pit or pit to land)1 = change in height (land to pit or pit to land)
0 = a fixed amount of time between 1s0 = a fixed amount of time between 1s
LANDLAND PITPIT LANDLAND PITPIT LANDLAND......------------+ ++ +--------------------------+ ++ +------......
|_____| |_______||_____| |_______|
..0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 ....0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 ..
Note : we cannot have two 1s in a row!Note : we cannot have two 1s in a row!=> uses Eight to Fourteen Modulation (EFM) encoding=> uses Eight to Fourteen Modulation (EFM) encodingtable.table. Usually, a pattern of 8 bits is translated to/from aUsually, a pattern of 8 bits is translated to/from apattern of 14pattern of 14 pitspits andand landslands..
-
8/7/2019 auxilary memory
38/47
Jatinder singhJatinder singh
CDCD--ROMROM
yy WhileWhile thethe speedspeed ofof CDCD--ROMROM readersreaders isisrelativelyrelatively higher,higher, suchsuch asas 2424X(X(2424 timestimes CDCDaudioaudio speed),speed), thethe speedspeed ofof writingwriting isis muchmuchslower,slower, asas lowlow asas 22XX..
NoteNote thatthat thethe speedspeed ofof thethe audioaudio isis aboutabout150150KBKB perper secondsecond..
yyTheThe DVDDVD (Digital(Digital VideoVideo DiscDisc oror DigitalDigitalVersatileVersatile Disc)Disc) technologytechnology isis basedbased onon CDCDtechnologytechnology withwith increasedincreased storagestorage densitydensity..
TheThe DVDDVD technologytechnology allowsallows twotwo--sidesidemedium,medium, withwith aa storagestorage capacitycapacity ofof upup toto1010GBGB..
-
8/7/2019 auxilary memory
39/47
Jatinder singhJatinder singh
CDCD--ROMROM
BecauseBecause ofof thethe heritageheritage fromfrom CDCD audio,audio, thethe datadata isisstoredstored asas aa singlesingle spiralspiral tracktrack onon thethe CDCD--ROM,ROM, contrarycontrarytoto magneticmagnetic hardhard disksdisks discretediscrete tracktrack conceptconcept..
Thus,Thus, thethe rotationrotation speedspeed isis controlledcontrolled byby CLVCLV--ConstantConstantLinearLinear velocityvelocity.. TheThe rotationalrotational speedspeed atat thethe centercenter isis
highest,highest, slowingslowing downdown towardstowards thethe outerouter edgeedge.. Because,Because,thethe recordingrecording densitydensity isis thethe samesame everyevery wherewhere..
NoteNote thatthat withwith CLV,CLV, thethe linearlinear speedspeed ofof thethe spiralspiral passingpassingunderunder thethe R/WR/W headhead remainsremains constantconstant..
CLVCLV isis thethe culpritculprit forfor thethe poorpoor seekseek timetime inin CDCD--ROMsROMs
TheThe advantageadvantage ofof CLVCLV isis thatthat thethe diskdisk isis utilizedutilized atat itsitsbestbest capacity,capacity, asas thethe recordingrecording densitydensity isis thethe samesame everyevery
wherewhere..
-
8/7/2019 auxilary memory
40/47
Jatinder singhJatinder singh
CDCD--ROMROM
Note that: Since 0's are represented by theNote that: Since 0's are represented by the length of timelength of timebetween transitions, we must travel atbetween transitions, we must travel at constant linearconstant linearvelocityvelocity ((CLVCLV)on the tracks.)on the tracks.
Sectors are organized along a spiralSectors are organized along a spiral
Sectors have same linear lengthSectors have same linear length
Advantage: takes advantage of all storage space available.Advantage: takes advantage of all storage space available.
Disadvantage: has to change rotational speed whenDisadvantage: has to change rotational speed whenseeking (slower towards the outside)seeking (slower towards the outside)
-
8/7/2019 auxilary memory
41/47
Jatinder singhJatinder singh
AddressingAddressing
1 second of play time is divided up into 751 second of play time is divided up into 75sectorssectors..
Each sector holds 2KBEach sector holds 2KB
60 min CD:60 min CD:60min * 60 sec/min * 75 sectors/sec =60min * 60 sec/min * 75 sectors/sec =270,000 sectors = 540,000 KB ~ 540 MB270,000 sectors = 540,000 KB ~ 540 MB
AA sectorsector is addressed by:is addressed by:Minute:Second:SectorMinute:Second:Sectore.g. 16:22:34e.g. 16:22:34
-
8/7/2019 auxilary memory
42/47
Jatinder singhJatinder singh
File Structures forCDFile Structures forCD--ROMROM
One of the problems faced in using CDsOne of the problems faced in using CDsfor data storage is acceptance of afor data storage is acceptance of acommon file system, with the followingcommon file system, with the followingdesired design goals:desired design goals: Support for hierarchical directory structure,Support for hierarchical directory structure,
with access ofone or two seekswith access ofone or two seeks Support for generic file names (as in file*.c),Support for generic file names (as in file*.c),
during directory accessduring directory access
If implement UNIX file system on CDIf implement UNIX file system on CD--ROM, it will be a catastrophe! The seekROM, it will be a catastrophe! The seektime per access is from 500 msec to 1 sec.time per access is from 500 msec to 1 sec.
-
8/7/2019 auxilary memory
43/47
Jatinder singhJatinder singh
File Structures forCDFile Structures forCD--ROMROM In this case, one seek may be necessary perIn this case, one seek may be necessary per
subdirectory. For examplesubdirectory. For example/usr/home/mydir/ceng351/exam1/usr/home/mydir/ceng351/exam1
will require five seeks to locate the file exam1 onlywill require five seeks to locate the file exam1 only
SolutionSolution
One approach place the entire directory structure inOne approach place the entire directory structure inone file, such that it allows building a left child rightone file, such that it allows building a left child rightsibling structure to be able to access any file.sibling structure to be able to access any file.
For a small file structure file, the entire directoryFor a small file structure file, the entire directory
structure can be kept in the memory all the time, whichstructure can be kept in the memory all the time, whichallows method towork.allows method towork.
-
8/7/2019 auxilary memory
44/47
Jatinder singhJatinder singh
File Structures forCDFile Structures forCD--ROMROM
The second approach is to create an indexThe second approach is to create an indexto the file locations by hashing the fullto the file locations by hashing the fullpath names of each file.path names of each file.
This method will not work for generic fileThis method will not work for generic fileor directory searches.or directory searches.
A third method may utilize both aboveA third method may utilize both abovemethods, one can keep the advantage ofmethods, one can keep the advantage of
Unix likeone
file per direct
ory scheme, atUnix like
one
file per direct
ory scheme, atthe same time allows building indexes forthe same time allows building indexes for
the subdirectories.the subdirectories.
-
8/7/2019 auxilary memory
45/47
Jatinder singhJatinder singh
File Structures forCDFile Structures forCD--ROMROM
A forth method, assume directories as filesA forth method, assume directories as filesas well and use a special index thatas well and use a special index thatorganizes the directories and the files intoorganizes the directories and the files intoa hierarchy where a simple parental indexa hierarchy where a simple parental index
indicates the relationship between allindicates the relationship between allentries.entries.Rec NumberRec Number File or dir nameFile or dir name ParentParent00 RootRoot11 Subdir1Subdir1 0022 Subdir11Subdir11 11
33 Subdir12Subdir12 1144 File11File11 1155 FileFile 0066 Subdir2Subdir2 00
-
8/7/2019 auxilary memory
46/47
-
8/7/2019 auxilary memory
47/47