You are on page 1of 28

CSC202

Fi
l
eOr
gani
zat
ion

Whatisaf i
l
e?Agr oupofdatai
scall
eda" f
il
e".Thestr
uctur
eandlogicrulesusedto
managethegr oupsofi
nfor
mationandthei
rnamesar ecall
eda"f
ilesystem".Fi
le
organi
zat
iontheref
ore,
dealswi
ththeor
ganizationofdat
aofafil
eintorecords,bl
ocks,
accessst
ructuresandthewayrecor
dsandblocksareplacedonthestoragedev i
ces.

Fi
l
esy st
emscanbeusedonnumerousdi
ff
erenttypesofstor
agedevi
cesthatuse
di
ff
erentki
ndsofmedi
a.Themostcommonstoragedeviceinuset
odayistheharddi
sk
dr
ive.

Conceptofdat
a,r
ecor
dsandf
il
es.

Tabl
e1.CAscor
es.

S/
N Name Mat
ri
c.No. CAScor
e.

1 Amosuwana FPS/
CSC/
17/11111 27

2 Jul
i
aOwol
abi FPS/
CSC/
16/
22222 12

3 OkonkwoJoshua FPS/
CSC/
16/
33333 21

Fi
l
est
ruct
ure.

Fi
l
eSt
ruct
uresdeal
wit
hdat
ainsecondar
yst
oragedev
ice(
Fil
e).

Dat
a.Dat
aisadi
sti
nctpi
eceofi
nfor
mat
ion

Recor
d:Recor
disacompl
etesetofi
nfor
mat
ion.Recor
dsar
ecomposedoff
iel
ds,

Fi
eld:
Fiel
dcont
ainsoneit
em ofi
nfor
mat
ionandi
tist
hesmal
l
estl
ogi
cal
l
ymeani
ngf
ul
uni
tofinf
ormat
ioninafi
l
e.

Pr
imar
ykey
:akeyt
hatuni
quel
yident
if
iesar
ecor
d.

Secondar
ykey
:ot
herkey
sthatmaybeusedf
orsear
ch.

Fi
l
e:Af
il
econt
ainsagr
oupofr
ecor
ds.

1
Fi
lenames:
Afi
l
ename(
orf
il
ename)i
susedt
oident
if
yast
oragel
ocat
ioni
nthef
il
e
sy
st em.

Bl
ock:
Agr
oupoff
il
esi
scal
l
edabl
ock.

Dir
ector
ies:Fi
l
esystemstypi
call
yhav edir
ector
ies(
alsocal
ledfol
ders)whichal
l
owt he
usertogroupf
il
esint
oseparat
ecollecti
ons.Thi
smaybei mplementedbyassociat
ing
thefi
l
enamewi thanindexi
nat abl
eofcont ent
soraninodeinafi
lesy st
em.

Metadata.Storedinf
ormati
onaboutt hefileiscall
edmet adata.Thisaretheother
bookkeepinginformati
onassociatedwitheachf il
ewithi
naf i
lesystem.I.
e.
Thelengthoft hedatacont
ainedinaf i
lemaybest or
edast henumberofbl ocks
al
locatedforthefil
eorasaby tecount.Thet imethatthefil
ewasl astmodifi
edmaybe
stor
edast hefile'
sti
mestamp.Filesystemsmi ghtst
orethefilecreat
iont
ime,theti
mei
t
waslastaccessed, t
hetimethefil
e'smet adatawaschanged, ort
hetimethefil
ewas
l
astbackedupandt heownerID.

Hi
stor
yoff
il
est
ruct
ure.
I
nt hebegi
nningitwast hephysical
punchedcards,
thenthepunchedtape,t
hemagnet i
c
tapeanddisk,theHarddisk,t
heCompactdisk,t
heflashdisk,memorycardetc.Each
havingadif
ferentf
il
essy stemsandf or
mat.Togetaf ul
lgraspoft
hist
opicread
“Timeli
neofComput erHistory

Punchedcar dsandtapes:I
nt heearlydaysofcomput ers,
thepunchedcar dswer eused
i
npr ocessingandstori
ngdataunt i
ltheintr
oductionofmagneti
c-basedst oragemedi a
i
nt he1950s.ThePunchedCar dpresenteddataandcommandsbyt heinclusionor
absenceofpunchedhol esinpredefi
nedl ocati
ons.Themostcommonl ypr oduced
punchcar dissaidt
ohav eheldtheequivalentof70by t
esofinf
ormat i
on.Thesi st
erto
PunchedCar ds,PunchedTape, or
igi
nall
ybeganasconnect edPunchedCar dsand
eventual
lyevolvedi
ntoarollofpaperwith6, 7,or8rowsofpunchedandnon- punched
area.

Magneti
ctapes;Magnet
icTapestor
agesyst
emsuseanarr
owstr
ipofpl
asti
cfi
lm or
metalwi
thathinmagneti
ccoati
ngthatr
ecordsdat
ausi
ngt
hechangesi
nint
ensi
tyand
pol
ari
tyofel
ectr
ici
ty.

TheUNISERVOwascapabl eofupto128bit
sofdat
apersquarei
nchonitsmetaltape
thatwas1200f
eetlong.Thisgav
eitanapproxi
mat
etot
alst
oragecapabi
l
ityof1843200
bit
sor230.4K(
0.2304M) .

Dir
ectAccessFi
les(Harddi
sk,
Floppydi
sk,
Compactdi
sk,
arer
efer
redt
oadi
rectaccess
fi
l
essystem dev
ices.
):

Thehar
ddi
sk;
TheHar
dDi
skst
oragesy
stem wasdesi
gnedt
obeabr
idgebet
weent
he

2
workingmemor yofacomput erandthelong-t
erm stor
ageopt i
onsofMagnet i
cTape.
Thef i
rstHar dDiskdri
vewascompr i
sedof502- footdiamet erplatt
ersandwas
containedi naspacenearl
ythesizeoftwor ef
ri
gerators.Thebasi cmechanism oft
he
harddi sk,consi
stsofaspi
nningdisk(knownasapl at
ter),
whi chiscoatedwit
ha
magnet i
cmat er
ialandamagneticheadwhichmov eonanact uatorarmthatr
eadsthe
stor
eddat a.

ThebenefitoftheHardDiskstoragesy st
em isthatdatacanbeaccesseddi r
ectl
yrather
thansequenti
allyasinmagneti
ct apes.HardDiskdr i
vesarest
il
lapopularform ofdata
stor
agetechnologytoday.Whereast hefi
rsthar
ddi skdri
vehadatotalstor
agecapaci t
y
of5Megaby tes,curr
entcommer cialgr
adehigh-capacit
yHardDiskdri
vescanst oreas
muchas6TB( or6,000,
000Megaby t
es).

FloppyDisk;FloppyDisksar east oragesystem thatconsist


sofat hi
ndi skofmagnetic
storagemedi um, nor
mallyaf l
exiblemat eri
alwithamagnet i
cally
-responsivecoati
ng,
housedwi thi
naf l
exi
blerectangularcasing.Theyfir
sttypesoff l
oppydi skcouldstor
e
datafrom asl owas80ki lobytes.Thestandardf l
oppydiskhas1. 44Megaby tes
capacity,
whileaspeci al
ty peoffloppydiskcalledtheSuperdiskcouldst oreasmuchas
240Megaby tes.Curr
entPCmanuf actur
ersnol ongeri
ncludesuppor tfornati
v eFl
oppy
Drivestoragesy st
emsbey ondexternalUSBadapt orsandpr oducts.

Opti
caldisk;Opti
caldatast
oragesy stemsar eaf l
at,
circulardiskthatencodesbinar
y
dataintheform ofpit
sonitssurface.TheDi sciscompr isedofmul t
iplel
ayer
sthat
i
ncludear efl
ecti
velayer
,adif
fusesubst rat
elayerofplast i
c,andanencodi nglay
erthat
contai
nsthepi t
s.DataonanOpt i
cal Discisreadwiththeuseofal aserdi
odethat
regi
ster
st hedist
ort
ionofli
ghtcreatedbyt hesurfacepitswhent hedi sci
sspuninthe
dri
ve.

CD-ROMs, DVD,
andBlue-r
ayDiscsar
eexamplesofopti
caldisks.TheCDhasst orage
capaci
tyof700Megabytes,t
heDVDcapacit
yisapproxi
mat el
y4.7Gigabytes(4,
700
Megabytes),
whil
eBl
ue-raydi
scscanstor
eupwardsofov er300Gigabytes(300,
000
megabytes).

FlashStor age;Flashmemor ysyst


emswer edev el
opedf rom EEPROM (
Electr
ical
ly
ErasablePr ogrammabl eReadOnl yMemor y )
.Theyar eregardedassol
idstatedrive
(SSD)becauset heyThememor ychi
pareei t
hermadeofNANDorNORLogi c
gates.Flashst oragecomesi nmanydiff
erentshapesandsi zes,i
ncl
udingbutnot
l
imi t
edtoMemor ySt i
cks,Multi
MediaCard,Micr
oSD, miniSD,Secur
eDigit
alcards,soli
d
statedri
v es,andUSBt humbdr i
ves.Whil
et hepioneerFlashmemor ywas2Megaby tes,
currentcapacities,dependinguponappli
cat i
onandt ype,canbeover32Gigaby t
e.

Fi
l
eSy
stem

3
Af
il
esy
stem consi
stsoft
wol
ayer
s.Thel
ogi
cal
fil
esy
stem andt
hephy
sical
fil
esy
stem.

Thel ogicalfi
lesystem isresponsiblefori
nter
acti
onwi ththeuserappl icat
ion.I
t
providest heappli
cat i
onpr ogram i
nter
face(API)forfi
leoper ations
—OPEN, CLOSE, READ, etc.,andpassestherequestedoper ationt othelayerbelowi
tfor
processing.Thel ogicalfi
l
esy st
em "managesopenf il
etableent r
iesandper -pr
ocessfi
le
descr i
ptors.
"Thislayerprov i
des" f
il
eaccess,di
rectoryoperations, securi
tyand
protecti
on. "

Thesecondl ayeri
sthephysicalf
il
esyst
em.Thi slayerisconcernedwiththephy si
caloperat
ion
ofthestoragedevi
ce.Itpr
ocessesphysi
cal bl
ocksbei ngreadorwr i
tt
ento,ithandles
buffer
ingandmemor ymanagementandi sresponsibl
ef orthephysi
calpl
acementofbl ocksin
specif
iclocati
onsonthestoragemedium.Thephy sicalfil
esystem i
nter
actswiththedev i
ce
dri
versorwi t
hthechanneltodriv
ethestoragedevice.

Thefil
esy st
em managesaccesstobot ht
hecontentoffi
l
esandt hemet adat
aabout
thosefi
les.I
tisr
esponsi
bleforar
rangingstor
agespace;r
eli
abi
li
ty,ef
fi
ciency,and
tuni
ngwi t
hregar
dtothephysicalst
oragemedi um ar
eimpor
tantdesi
gnconsi der
ati
ons.

Theoperat
ingsyst
em (OS)issaddledwithther esponsi
bil
it
yofprov
idi
ngservi
cesfor
fi
lemanagement.I
thandlestheformatti
ngoft hestoragedevi
cesandcontr
olshow
dataandfi
lesar
estor
edandaccessf rom t
hedev i
ces.Eachoper
ati
ngsyst
em haveit
s
ownformatformanagi
ngf i
leinstoragedevices.

Obj
ect
ivesoff
il
eor
gani
sat
ion

1.Toar rangefilesinthemostcompactf or
mf easibletoconservespaceinthe
storagedev i
ses
2.Easyandqui ckaccesst ofil
ewhenneededf orpr ocessingandeasystorage
process.
3.All
owsf oreasyfileaddit
ion,updatestofi
l
esandr ecordsanddeleti
onoffil
esno
l
ongerneeded.
4.All
owsal lr
elatedrecordsandf i
eldsindef
erentrecordst obeassociat
edwith
eachot her.
5.Tocopyandr eorgani
zethef i
lewhennecessary .
6.Topr eservether ecor
dasl ongasi ti
sneededf orprocessingorhist
ori
cal
archivi
ng.

Ty
peoff
il
es;
Logi
cal
fil
esandPhy
sical
fil
es.

Aphy
sical
fil
eisthefi
leasiti
sst
oredonar
ecor
dingmedi
um,
suchasadi
skort
ape.
(
Moreonthisinl
atersessi
on)

Alogi
calfi
leisastructur
edeclaredwithi
naprogram.Whenapr ogr
am execut
esan

open’operat
ionforalogical
fil
e,thesyst
em connectsthatl
ogicalf
il
etoaphy si
calf
il
e
onaperipher
aldevice.Theprogram canthenreaddatafrom andwrit
edatatothat

4
physi
calf
il
e.Thepr ogr
am usesfi
l
eat t
ri
butestocontr
olt
heselect
ionofthephysi
calfi
le,
est
abli
shproperti
esofthelogi
calandphysical
fil
es,
andtestt
hestatusofthel
ogical
andphysi
calfi
les.

Char
act
eri
sti
csofPhy
sical
Fil
es

 Physicalfil
eshav efil
enames.
 Thephy sical(ext
ernal)fi
lenamei srecordedi
nadiskf
il
eheaderfordi
skfi
l
es
andinat apelabelfortapefil
es.
 Moret hanonel ogicalfil
ecaninter
actwi t
hthesamephysi
calf
il
e,andonelogi
cal
fi
lecani nter
actwi t
hmul tipl
ephysicalf
il
es.

Char
act
eri
sti
csofLogi
cal
fil
es;

 Logicalfil
eshavef i
lenames.
 Thelogical (
int
ernal)f
il
enamei saf i
levariabledecl
aredwit
hinaprogram and
knownonl ywi t
hinthatprogram orwithi
npr ogramstowhichithasbeenpassed
asaf ormal par
amet er.
 Moret hanonel ogicalf
il
ecaninteractwiththesamephy si
calfi
le,
andonel ogi
cal
fi
lecani nter
actwithmul t
ipl
ephy si
calfi
les.

Fi
leattr
ibutes;
Fil
eattr
ibutesarespeci
fi
cat
ionsincl
udedwitheachfi
let
hatdefi
nebasi
c
i
nformationaboutthatfi
le.Someoftheseattr
ibut
esident
if
ythefi
le,
whil
eothers
descr
ibet hest
ruct
ureoft hefi
l
e.

Fi
l
eat
tri
but
est
hati
dent
if
ythef
il
eincl
ude;

 Fi
lename,
 Vari
ablequali
fi
er,
 Versi
on(creat
ionti
meanddat
e).

Fi
l
eat
tri
but
est
hatdescr
ibet
hest
ruct
ureoft
hef
il
eincl
ude

 Fi
eldl
ength,
 Dat
atype,
 Bl
ocksize,et
c.

Manyoft
hef
il
eat
tri
but
esf
oradi
skf
il
ear
est
oredi
nthef
il
eheader
.

Fi
lename;Eachf
il
ehasauniquenamethatdi
sti
ngui
shesitf
rom ever
yot
herf
il
e.Afi
le
nameconsist
sofpar
ts,
cal
l
ednodes,separat
edbyaslash(/
).Afil
enamecanhave

5
f
rom 1t
o12nodes.Thef
oll
owi
ngf
il
enamehast
hreenodes:

NODE1/
NODE2/
NODE3

Eachnodebegi nswithanumberorl et
terandconsist
sofamaximum of17number s
andlett
ers.Hyphens(-)andunder
scores( _)canbeusedaschar
acter
sinthenode.Any
othercharact
ersrequi
respeci
alprocessingbythesystem,
sotheyareavoi
ded.

Fi
leHeaders:
Fi
leheader
smai nl
ycontai
nthefol
lowi
ngi
nformati
on;Fi
l
ename,
Poi
nter
stot
he
physi
call
ocati
onsofthedataonthedi
sk,
Fil
eattr
ibut
es.

TheRecor
dsofaFi le;
Arecor
dofaf i
le–al sor
eferr
edtoasal ogi
calrecor
d–i sacol
l
ect
ionofr
elat
edf
iel
ds
ofi
nfor
mation.Foreachfi
eld,youdef
ineinyourprogram:

 Thedat
atype(bi
nar
yorcharacter
,forexample)
.
 Thel
engthtohol
dthel
argesti
tem ofdatathatmayoccur
.

Thesum ofal
lfi
eldl
engt
hsi
nar
ecor
dist
hel
engt
hoft
her
ecor
d.

Fi
gur
e1;
Logi
cal
Recor
d

Frequentl
y,t
helengt
hofafi
le'sl
ogical
recor
dsisal
waysthesame.I
fthisl
engthist
he
sameast helengthoft
heunitofdatat
ransf
er,
thi
sfi
lei
ssaidtohav
efixed-
lengt
h
unblockedrecor
ds.

Var
iabl
e-Lengt
hRecor
ds

Fi
gur
e2.St
oredRecor
dofVar
iabl
eLengt
h

Wher
e,

BL=Blocklengt
h:Afour-
byt
efiel
dcall
edblockdescri
ptor
.Neededal
soforvar
iabl
e-
l
engthunbl
ockedrecor
dsbecausetheyar
econsideredasblockswi
thablocki
ngfact
or
of1.Thevaluei
nBLincl
udesthelengt
hofbothBLandRL.

RL=Recor
dlengt
h:Af
our
-by
tef
iel
dcal
l
edr
ecor
ddescr
ipt
or.Thev
aluei
nRLi
ncl
udes

6
t
hel
engt
hoff
iel
dRL.

BlockingandDebl ockingrecords
Tosav etimeandspacei npr ocessing,recordscanbegr oupedintoblocks.Thisresul
ts
i
nl ar
gertransferunits.Forexampl e,datastoredont apebyonewr i
teoperati
onis
separatedfrom thedat astoredbyt henextwr it
eoper at
ionbyani nt
er-r
ecordgap.The
smalleryourrecordsar e,t
hemor egaps( unusedspace)occurwi thi
naf il
eofdata.
Gapsal l
owt hetapedev i
cetoaccel erat
ebef oreitst
artstoreadorwr i
tethedata.They
al
lowt hetapet ocomet oahal taft
erhav ingreadorwr i
ttenarecordofdata.Fewer
gapst her
eforeresultinfasterprocessing.

Tor educethenumberofgaps, youcangrouptwoormor er ecor


dsintoabl ock, a
techniquecall
edblocki
ng.Thenumberofr ecordsinonebl ockiscall
edbl ocking
factor.Onceyouhavedefinedyourbl
ockingfactori
ny ourpr ogr
am, t
heI /
OCont rol
System routi
nes,
automatical
lyhandl
eBlockingandDebl ockingoflogicalrecords

Contr
olI
nterv
al;Theunitoft
ransferi
sthecontr
olint
erv
al(CI)
.Thi
sdefi
nesthenumber
ofbl
ocksthatarewri
ttenatatime.i.
eifwehaveablocksizeof512byt
es,andthe
syst
em wri
testwoblocksofadi skatonce,
thenthecontr
oli
nter
vali
s1024bytes.

ACIcanhol
doneormor
elogi
cal
recor
ds.I
tcani
ncl
udef
reespace.

BASI
CMETHODSOFFI
LEORGANI
ZATI
ONANDPROCESSI
NG

Afil
eisorganisedinapart
icul
arwaytoensurethatr
ecordsareavail
abl
eforpr
ocessi
ng
andstorageiseffi
ci
ent
.Indesigni
ngorchoosi
ngaf i
lemethod,themediaty
pe,dat
a
pri
vacy,
integr
ity,
secur
it
yandconf i
dent
ial
i
tyaremajorconsi
derati
on.

Therear
enumberofwaysrecordscanbeor
gani
sedonsecondar
yst
orage.Themai
n
methodsoff
il
eorgani
zat
ionusedforfi
l
esar
e:

1. Seri
al,
2. Sequenti
al,
3. I
ndexed-Sequenti
al.
4. Random (di
rectaccess)
.

Ser
ial
fil
eor
gani
zat
ion

I
naser
ial
fil
eor
gani
zat
ion,
recor
dsi
naf
il
ear
est
oredandaccessedoneaf
teranot
her
.
Thati
s,a
se ac
hr ecor
di sr
ecei
vedi
tisst
oredinthenextavai
l
ablestora
gepos i
ti
on. Ingener
ali
tisonl
y
use
donas eri
a l
me diumsuchasma g
neti
ctape.Thist
ypeoffi
leorgani
sati
onme a nsthatt
herecor
dsare
i
nnopa r
tic
ularorderandthere
for
etoretri
eveasingl
erecor
dt hewholefil
enee dstobereadfr
omt he
begi
nni
ngtoe nd.Seria
lorga
nis
ati
onisusual
l
ytheme thodusedforcreat
ingTransacti
onfi
les(
unsort
ed)
,
WorkandDumpf i
les
.

7
Adv
ant
agesofser
ial
fil
eor
gani
zat
ion

 I
tissi
mple
 I
tischeap

Di
sadv
ant
agesofser
ial
fil
eor
gani
zat
ion

 I
tiscumbersomet oaccessbecauseyouhav etoaccessallpr
oceedi
ngrecor
ds
bef
oreret
ri
evingtheonebeingsearched.
 Wastageofspaceonmedi um i
nform ofint
er-r
ecor
dgap.
 I
tcannotsupportmodernhighspeedrequir
ementsforquickrecor
daccess.

Sequent
ial
fil
eor
gani
zat
ion

Sequentialfilesareser ialfil
eswhoser ecordsar
esortedandst oredi nanascendi ngor
descendingonapar ticularkeyf i
eld.
Thephy sical orderoft her ecor dsont hediskisnotnecessar i
lysequent ial,asmost
manuf acturer ssuppor tanor gani sati
onwher ecert
ainr ecords( insertedaf terthefil
ehas
beensetup)ar eheldinal ogical sequencebutarephy sicallyplacedi ntoanov erf
low
area.Theyar enol ongerphy sicallyconti
guouswiththepr ecedingandf ollowinglogical
records,butt heycanber etri
ev edi nsequence.
Sincether ecor dsaresor ted, i
ti spossibletoknowinwhi chhal fofthef il
eapar ti
cular
recordbeingsear chedi slocat ed, Hencethismethodr epeat edlydividest hesetof
recordsint hef i
leintot wohal v esandsear chesonlythehal fonwhi cht her ecordsis
l
ikelytobef ound.

Adv
ant
agesofsequent
ial
fil
eor
gani
zat
ion

1 Thesortingmakesiteasyt
oaccessrecords.
2 Thebinarychoptechni
quecanbeusedt oreducer
ecor
dsear
cht
imebyasmuch
ashalftheti
met aken.
3 Si
mplet odesign.
4 Bestuseofstoragespace.

Di
sadv
ant
agesofsequent
ial
fil
eor
gani
zat
ion

1 Thesor t
ingdoesnotr emovetheneedtoaccessot herrecordsasthesear
ch
l
ooksf orpar t
icularrecords.
2 Sequentialrecordscannotsuppor tmoderntechnologi
est hatrequi
ref
astaccess
tostoredrecor ds.
3 Therequi r
ementt hatallr
ecordsbeofthesamesi zeissomet imesdif
fi
cul
tto
enforce.
4 Addingrecor datt hemi ddl
eofthefi
lei
snotpossi ble.

Sequent
ial
fil
esareei
therunor
dered(HeapFi
l
e)ororder
ed(sor
ted)
.Inaheapfi
l
e,
recor
dcanbeplacedanywhereinthefi
l
ewheret
hereisspacef
orarecor
d.Therei
sno

8
or
der
ingofr
ecor
ds.

Inor
der
edfi
l
e,akeyfi
eldisarr
angedser
ial
l
y(or
der
ed)
.Thi
sfi
eldi
susedwhen
sear
chi
ngf
orafi
leofrecords.

Indexed-sequenti
al f
il
eor ganizati
onmet hod
IndexedSequent i
al fi
l
eor ganisati
onislogicall
ythesameassequent i
alor
ganisati
on,but
ani ndexisbuil
tindicati
ngt heblockcontainingtherecordwi t
hagi venvaluefortheKey
field.Therearethreeareasassoci atedtot hefi
leinthestorage;pri
mear ea,overfl
ow
ar eaandindexarea.Thepr imear eahosttheor i
ginalr
ecords,theov er
fl
owcont ains
recor dsaddedthatcannotbepl acedinthel ogi
calsequence,theindexareacontains
key st or
ecordsandt hei
rlocat i
onont hedisk.

Thismethodcombi
nest
headv
ant
agesofasequent
ial
fil
ewi
tht
hepossi
bil
i
tyofdi
rect
accessusi
ngthePr
imar
y.

Thesedays,manufact
urer
sprovi
dingIndexedSequent
ial
Softwaret
oall
owforthe
bui
ldi
ngofindexesusi
ngfiel
dsotherthanthepri
maryKey.Theseaddi
ti
onal
fiel
dson
whichi
ndexesarebuil
tarecal
ledSecondaryKeys.

I
nindexsequent
ialor
gani
zati
on,iti
stheusualpract
icetohav
eahierar
chyofindexes
wi
ththelowestl
eveli
ndexpoint
ingtotherecor
dswhi l
ethehi
gherl
evelonespointt
o
t
heindexbelowthem.

Adv
ant
ages;

1 Reducesthesearcht
imecompar
edtosequenti
almet
hod
2 Recordscanbeinser
tedatt
hemiddl
eofthefi
l
e.

Di
sadv
ant
ages;

1 Uni
quekeyisrequir
ed
2 Per
iodi
creor
ganizati
oni
srequi
red.

Random (orDir
ectaccess)fil
eor gani sati
on
Arandomlyorganisedfi
lecontainsr ecordsarr
angedphy sical
lywi t
houtregar
dt othe
sequenceoftheprimarykey.Recor dsar el
oadedtodiskbyest abli
shi
ngadi r
ect
rel
ati
onshipbetweentheKeyoft her ecordanditsaddressont hefil
e,normall
ybyuseof
aformula(oral
gorit
hm)t hatconv ertst hepri
maryKeytoaphy sicaldiskaddress.Thi
s
rel
ati
onshipi
salsousedf orretr
iev al Recordsar
estoredr andoml ybutaccesseddirect
ly.

 Toaccessaf i
l
estoredrandomly
,ar
ecor
dkeyisusedt
odeterminewherea
recordi
sstor
edont hestor
agemedi
a.
 Ma gnet
icandopt
icaldi
sksall
owdat
atobestor
edandaccessedrandomly
.

9
Toaccessf
il
einar
andom accessst
ruct
ure,
var
iousf
il
eaccessmet
hodsar
eused

1. Or
deredI
ndex
2. Hashedi
ndex

I
ndexisadat
astr
uctur
ethatusesakeyf
iel
dandapoi
ntert
olocat
ethememor
y
addr
esswher
erecor
dsarestore.

Thi
sissi
mil
art ot
hef
uncti
onoft
hei
ndexi
nat
ext
bookwhi
chpoi
ntt
oapagewher
ean
i
ndexedi
tem canbef
ound.

Indexi
nghelpstospeedupthesear
chprocesswhensear
chi
ngforarecor
dinafi
le
system.Theindexfi
l
eisusual
lysmall
enoughtobereadi
ntothepr
ocessormemory.

HashFi l
es.Indirectfi
leorganizati
ons,t
hekeyv al
ueismappeddi r
ectlytothestorage
l
ocat i
on,avoidi
ngt heuseofi ndexes.Theusualmethodofdi r
ectmappingisby
perf
or mingsomear i
thmeticmani pul
ati
onofthekeyv alue.Thisprocessiscal
led
hashing.Howev erhashingschemesusual l
ygiveri
setocol l
isi
onswhent woormor e
di
stinctkeyvaluesar emappedt othesamev al
ue.Coll
isionsarehandledinanumberof
ways. Thecolli
dingrecordsmaybeassi gnedtothenextav ail
abl
ef r
eespaceort hey
maybeassi gnedt oov er
flowar ea.

I
nusi ngthehashf unct
iont
ogenerateaval
ue,whi
chistheaddr
essofabucketwhere
thepairvaluesofrecor
dsarest
ored,wecanhandleli
mit
edcoll
i
sionsaswel
lasre-
organizat
ionsofthefil
ewit
houtaff
ecti
ngthehashfunct
ion.

Hashingfield:
Theat t
ri
but
eonwhichqui
ckaccessi
sneededandonwhi chhashi
ngi
s
perf
ormed
Datafil
e:organizedasabucket
swit
hnumbers0,1,
…,(
M −1)(bucket-ablockoraf
ew
consecutiveblocks)
Hashf unctonh:
i mapstheval
uesf
rom t
hedomainoft
hehashing
att
ri
but etobucketnumbers.

Fi
g6Hashf
unct
ionexampl
e

. Ma
inBuc
ket
s Ov
erf
lowbuc
ket
s

Ov
erf
lowc
hai
n
1
10

2
I
nserti
ngar ecor
d:Toinsertar ecord,weapplyhashonthevalueofhashi
ngattr
ibut
eto
getthebucketnumber.Ifthereisspacei nt
hebucket,t
herecordispl
acedther
e.Ift
her
e
i
snotenoughspace, t
her ecordi splaceint
heov erf
lowbucket.Theover
fl
owchainsof
al
lthebucketsaremaintainintheov erfl
owbuckets.

Ther
ear
etwot
ypesofhashi
ng;
stat
ichashi
nganddy
nami
chashi
ng.

1.Stat
ichashi
ng.Whatwehavedi
scussedi
npr
evi
oussect
ioni
sst
ati
chashi
ng.
Thenumberofmainbucket
sisfi
xed.

Thecapacit
yoft
hehashfi
leC=r*M recor
ds.Wher
eri
sthenumberofr
ecor
ds
perbl
ock,andM i
sthenumberofmai
nbuckets.

Thedi
sadv
ant
agesofst
ati
chashi
ngar
e;

o Wastageofdiskspace,
ift
heact
ual
recor
dsi
naf
il
eismuchl
esst
hant
he
bucketcapaci
ty.

o Degr
adeper
for
mancei
flongov
erf
lowchai
noccur
s.

2.Dynamichashi
ng.Fi
leswher
erecordsi
nsert
ionanddel
eti
ontakespl
ace
fr
equentl
y,t
hefi
lekeepsgr
owingandshri
nking.Dy
namichashi
ngisemploy
edt
o
handl
etheseevent
sautomati
cal
ly.

Dynamichashi
ngfil
eorgani
sat
ionusesbucket
sinet
gernumberswhichare
repr
esent
edinbinar
ynumbers.Itusest
woschemes;Extendabl
eandLinear
hashi
ng.

Ext
endabl
ehashi
ngr
equi
reweuse;

 K-
bitsequencecor
respondi
ngt
oar
ecor
dR,

 appl
yhashi
ngf
unct
iont
othev
alueoft
hehashi
ngf
iel
dofRt
ogett
he

11
bucketnumberr
,

 conv
ertri
ntoi
tsbi
nar
yuni
tst
ogett
hebi
tsequence,

 Thent
aket
het
rai
l
ingkbi
ts.

 Locati
ngarecord
Matchthed-bi
tsequencewit
hanent
ryinthedi
rect
oryandgot
o
thecorr
espondi
ngbuckettofi
ndt
herecor
d.

B0

00
B1

01
Di
rec
tor
y B2
d=
2
10
B3

11 L
oca
lde
pt=2

LinearHashingmethodsdoesnotr
equireseparat
edi
rector
yst
ruct
ure.I
tusesa
fami l
yofhashfunct
ionsh0,
h1,
h2,
….,
hi.Therangeofhii
sdoubl
etherangeofhi-1.
i
Hi(x)=xmod2M.

Wher
e,Mistheini
ti
alnumberofbucket
s.Thest
ruct
urehasM mai
nbucket
sandaf
ew
ov
erf
lowbucket
s.

12
I
nit
ial
hashf
unct
ions;

H0(
x)=xmodM

H1(
x)=xmod2M

Toi
nser
tar
ecor
dwi
thhashf
iel
dval
uex,

 Pl
acet
her
ecor
dinbucketh0(
x).

 Whenov er
fl
owi
nanybucketoccur
s,i
nser
tther
ecor
dint
heov
erf
lowoft
hat
bucket
.

 Cr
eat
eanewbucketM

 Spl
i
tthebucketh0,

 Somer
ecor
dsst
aysi
nh0whi
l
ether
estgoest
oM

Onf
ir
stov
erf
low,
irr
espect
iveofwher
eitoccur
s,

 bucket0i
sspl
i
t

 Onsubsequentov
erf
lows

 bucket
s1,2,
3,…ar espl
i
tinthator
der
(Thi
siswhytheschemeiscall
edli
nearhashi
ng)
.

Di
rect
oryf
il
esy
stem (
DIRECTORYSTRUCTURE)
Mostcomput er
sor gani
zef i
lesintohier
archiesusi ngfolders,di
rector
ies,orcatalogs.
Theconcepti sthesamei r
respecti
veoft heterminologyused.Eachf oldercancont ai
n
anarbi
trar
ynumberoff i
les,anditcanalsocont ainotherf older
s(subfolders).
Subfol
derscancont ai
nst i
ll
mor efil
esandf olders.Thesef oldersinsi
deot herfolder
s
buil
datree-l
ikestructureinwhichone" mast erfolder"(or"rootfol
der")cancont ainany
numberoflev elsofotherfoldersandf i
l
es.Theuseoff oldersmakesi teasierto
organi
zefil
esi nalogicalwayf oreasyaccess.

Ther
ear
efi
vedi
rect
oryst
ruct
ures.Theyar
e;

1.Si
ngl
e-l
evel
dir
ect
ory

2.Two-
lev
eldi
rect
ory

13
3.Tr
ee-
Str
uct
ureddi
rect
ory

4.Acy
cli
cGr
aphdi
rect
ory

5.Gener
alGr
aphdi
rect
ory

Thef
ir
stt
hreeoft
hiswi
l
lbedi
scussed.

1.Si
ngl
e–Lev
elDi
rect
ory

Thesimplestdir
ect
oryst
ructur
eist
hesi
ngl
e-l
evel
dir
ect
orywher
eal
lfi
l
esar
e
cont
ainedi
nt hesamedir
ectory
.

Di
sadv
ant
age:

Whenthenumberoffi
l
esincreasesorwhenthesyst
em hasmor ethanoneusert
her
e
maybefil
enameconfl
ict
s,si
nceallfi
lesar
einthesamedirect
ory.Fi
lesmusthav
e
uni
quenameswithi
nafolder
.

Fi
g7

2.Two–Lev
elDi
rect
ory

Thisstructureall
owsf ortwoleveldi
rect
ori
es,
whereeachuseri sassigneda
di
rect
ory /
folderbutisnotallowedtocreat
esubfol
der.Eachuserfi
lesaresepar
ated
fr
om thatofanot heruser.Thereisnonameconfli
ctsbetweenthefolders.

Di
sadv
ant
age:

User
scannotcr
eat
ethei
rownsub-
dir
ect
ori
es.

14
3.Tr ee–St r
ucturedDirect
orythi
sist
hemostcommonoft hecomputerfi
lesy
stem
usedbycur r
entoperati
onsy st
em.Iti
scal
ledatreestr
uct
urebecauseithasaroot
di
r ectorywhichinturncontai
nssubdir
ect
ories/
subfol
der
sandsoonunt ilt
heindi
vi
dual
fi
les( cal
ledl
eaf)isreached.

1.Al
ldi
rect
ori
eshav
ethesamei
nter
nal
for
mat
.

2.Onebi
tineachdi
rect
oryent
rydef
inest
heent
ryasaf
il
e(0)orasasubdi
rect
ory
(
1).

3.Speci
alsy
stem cal
l
sar
eusedt
ocr
eat
eanddel
etedi
rect
ori
es.

Pat
hnamescanbeoft
wot
ypes:
absol
utepat
hnamesorr
elat
ivepat
hnames.

 Anabsolut
epathnamebegi
nsatt
her
ootandf
oll
owsapat
hdownt
othe
speci
fi
edfi
le.

 Ar
elat
ivepat
hnamedef
inesapat
hfr
om t
hecur
rentdi
rect
ory
.

Onl
i
neSt
orage

Onli
nestorageal l
owsi mmedi ateaccesstorecor
dstoanyoneonthesy
stem’snetwork.
Properl
ydesignedst oragewillprovi
deaccesstoappr
opri
ateuser
sonly
.Onl i
nestorage
maintai
nsthegr eatestfunct
ionalit
ybutrequi
resmoreexpensi
venet
workstorage.

Exampl
esofonl
i
nest
oragei
ncl
ude:

 Stor
ageAr
eaNetwor
ks(SAN).SANsall
owaccesstoremotedri
veswitht
he
sameconv
eni
enceofint
ernal
har
ddri
ves.ASANi sanetworkedsyst
em.

 RedundantArrayofInexpensi
ve/I
ndependentDi
sks(
RAID).RAI
Dusesagr oupof
di
skst obackupdat aonadailybasi
s.AlthoughRAI
Disusedtobackupl
ocal
fi
l
es,itisnoti
ntendedtobeusedasamai nbackupmethod.

 CloudComput i
ng.Mor erecent
ly,
onl
inestorageal
soref
erstofi
lest
hatcanbe
accessedonli
nev i
atheInter
net.Wit
hcloudcomput i
ngfi
lesar
estor
edbyat hi
rd-
partyandaccessedthr
oughawebser vice.

 I
nter
nal
har
ddr
ive

Of
fl
ineSt
orage

Fi
l
est
hatcannotbeaccessedi
mmedi
atel
yar
esai
dtobest
oredof
fl
ine(
e.g.
,fi
l
esnot

15
accessibl
ethroughyournetworksuchasonremovablemediali
keexternal
harddriv
es
ormagnet i
ctape).Olderr
ecordsorrecor
dsthatdonotneedtobeaccessedfrequentl
y
areoftenstor
edof f
li
ne.Thereisafocusondataaccuracy
,pr
otect
ion,andsecuri
tydue
tothelong-t
erm st
oragenecessit
y.

Thelongerr ecor
dsneedtobemai nt
ainedthemor eimportantpreser
vat
ionmet hods,
back-upprocedures,
stor
ageconditi
ons,handli
ngprocedures,andsecur
itybecome.
Offl
i
nest oragecanbestoredi
n-house,off
-si
te,orout
sourced.

Exampl
esofof
fl
inest
oragei
ncl
ude:

 Remov abl
emagnet
icoropti
cal
medi
a(t
ape,
CD,
DVD)
.Fori
ntegr
it
ypur
poses,
read-
onlymedi
aispref
err
ed.

 Fl
ashmedi
a(sol
i
dst
atemedi
ahasnomov
ingpar
ts)

 Ext
ernal
har
ddr
ives(
wit
hmov
ingpar
ts)

Phy
sical
stor
agedev
icesandcont
rol
uni
ts
Present
ly,
thecommonsecondar yst
oragemedi ausedt ostoredat
aarediskandt ape.
Tapeisgeneral
l
yusedf orarchi
v aldat
a.Disksont heotherhandareforgeneralpurpose
st
orage.Theimportanceofthest udyoffi
leorganizat
ionmet hodsist
hatdiff
erent
methodshavediff
erentpropert
iesandhenceef fici
enciesfordif
fer
entappl
icati
ons.

Tapes
Tarerel
ati
velyinexpensi
vedev
icesandcanst
orev
eryl
argeamount
sofdat
aespeci
all
y
i
nar chi
valdatastorage.

Themai
ndr
awbacksoft
apesar
e;

1.Theyar
esequent
ial
accessdev
ices

2.Wemustessent
ial
l
yst
ept
hroughal
lthedat
ainor
der
.

3.Cannotdi
rect
lyaccessagi
venl
ocat
ionont
ape.

4.Most
lyusedt
obackupoper
ati
onal
dat
aper
iodi
cal
l
y

Themagnet i
ctapeconsistsofarol
loftapewit
hpar al
l
el t
racks.Thereareninetr
acks
madeupof8bi t(1byte)ofdataandapar i
tybi
t.Theyalsoincl
udeinter-
blockgapsthat
separat
eoneblockfrom thenext
.Theinter
-bl
ockgapsal l
owsf orstar
ti
ngandst oppi
ng
ofthetapedri
ve.

16
Thepar
it
ybi
tisusef
orer
rorcor
rect
ion.

Fi
g.3Tapedr
ives; 1111
Re
el1 0000
Re
el2
1111
1111
1/
2” 0000 8bi
t=1by
te
T
ape
1111
0000
0000
RW he
ad 1111 Pa
rit
ybi
t

TapeOr
gani
sat
ion

Fi
g.4.Tapeor
gani
sat
ion

Fact
orst
hatdet
ermi
nedat
atr
ansmi
ssi
onr
atei
nat
ape;

1.I
nter
-bl
ockgaps

2.Ef
fect
iver
ecor
dingdensi
ty

3.Speedofr
/whead

4.Ti
met
ost
art
/st
opt
het
ape

17
Disk;
Ar edir
ect-accessst
oragedevi
ce.Therearetwomai nt ypesofdiskstor
age,the
magnet i
cdiskandt heopti
caldi
skstorage.Themagneticdi sksaremaj or
lyt
hehard
di
skswhi charemadeupofnumberoff l
atdisksur
faces.Thedi skstoresdataal
ong
concentri
ctracks.Eachtr
ackisdivi
dedintosector
s.Ther ead/writeheadmov efr
om
onetracktoanot her(i
nandout)toaccessdatainthedisk.

St
ruct
ureofDi
sks
Di
skconsi
stsof
;

1.Sev
eral
plat
ter
sst
ackedonar
otat
ingspi
ndl
e.

2.Oner
ead/wr
it
eheadpersur
facef
orf
astaccess.

3.Pl
att
erhassev
eral
tracks.

4.Eacht
rackhassev
eral
sect
ors.

5.Eachsect
orcont
ainssev
eral
blocks.

6.Uni
tofdat
atr
ansf
eri
sabl
ock.

7.Acy
li
nderi
sat
rackonal
lpl
att
ers.

Fi
g.5Har
ddi
skSt
ruct
ure.

S
pindl
e S
ect
or
Pl
att
ers
W/
RHe
ad

T
rac
k

Ac
tua
torAr
m

Dat
aTr
ansf
er;

SeekTime,seekti
meist heti
mei tt
akesfort
heread/wri
tesheadt
omov ef
rom one
tr
acktoappropri
atet
rack.Theseektimedependsonthedist
ancebetweenthecurr
ent
headposi
ti
onandt hetargetheadposi
ti
on.Typi
calval
uesarefr
om 10to50ms.

Theav
eragel
atencyt
ime(
Rot
ati
onal
del
ay)
,ist
het
imeneededt
oposi
ti
ont
hehead

18
ov
ert
heappr
opr
iat
ebl
ock.

Accessti
meisthetimeneededtoposi
ti
ontheread/wr
it
eheadatther
equi
redposi
ti
on.
Theaccesst
ime,theref
ore,
dependsontheseekti
meandthelat
encyt
ime.

Dat
atransf
erti
meisthet
imeneededt
omov
edat
afr
om t
hesecondar
yst
oragedev
ice
t
oprocessormemory
;

Thedatatransfertimedependsonphysi
caldevicechar
acteri
sti
csandcannotbe
opti
mized.Inthecaseofr eadi
nga1KB(kil
obyte=1024bytes)bl
ockofdatafr
om a
devi
cethatcant ransf
eritat100KB/
sec(
KB/ sec=kil
obyt
e/second)
,thedatatr
ansf
er
ti
mei s10msec.

Atthebeginni
ngofthefil
e,weall
ocat
eacert
ainnumberofbyt
esasafi
l
eheader.The
headerwill
contai
nav ar
iet
yofinf
ormati
onaboutt
hefi
le.Thef
oll
owi
ngaret
ypi
cal
contentofafi
leheader.

1)Thenumberofr
ecor
dent
ri
esi
ntheheader
.

2)Theendoff
reespacei
nthebl
ock

3)Anar
raywhoseent
ri
escont
aint
hel
ocat
ionandsi
zeofeachr
ecor
d.

Opt
ical
stor
age;

Sol
i
dst
atest
orage(
SSD)
.

Thesearememor ydevicesthatar emadef rom sil


i
conmi crochip.Theyst
oredat a
elect
roni
call
yinsteadofmagnet ically.Theyar eref
erstoassol idstat
edevices,because
theydon’thavespinni
ngmechani cal part
s.Theyar ealsocalledfl
ashmemor y.Theyare
usuall
ymadef rom NANDorNORf lashmemor yunits.Theyuseel ect
roni
cinterfaces
compat i
blewit
htradit
ionalblockinput /outputharddiskdri
v e.

Theyar
efoundmost
lyi
nthr
eef
ormf
act
ors;
sol
i
dst
atedr
ive,
sol
i
dst
atecar
dandsol
i
d
st
atemodule.

Adv
ant
ages

3.Theycont
ainnomechani
cal
par
ts.

4.Tr
ansf
ersdat
atost
orageathi
ghspeedf
ast
ert
hanmechani
cal
type.

5.Requi
rel
esspowerandpr
oducel
essheat
.

19
Di
sadv
ant
age

1.Hi
ghcostcompar
edt
omagnet
icdr
ive.

2.Notsuit
abl
eforl
ongt
imear
chi
vi
ngbecauset
heyt
endt
olosst
hei
rdat
aint
egr
it
y
wi
thtime.

Spa
ceAl
l
oca
ti
onondi
sk
Fi
l
es ar
e al
l
ocat
ed di
sk spaces byoper
ati
ng sy
stem.Oper
ati
ng sy
stems depl
oy
f
oll
owi
ngt
hreemai
nway
stoal
l
ocat
edi
skspacet
ofi
l
es.

 Cont
iguousAl
l
ocat
ion

 Li
nkedAl
l
ocat
ion

 I
ndexedAl
l
ocat
ion

1.Cont
iguousAl
l
ocat
ion

I
nt hisscheme,eachfil
eoccupiesacontiguoussetofblocksonthedisk.Forexample,
i
faf il
erequir
esnblocksandi sgi
venabl ockbast hestar
ti
nglocati
on,thentheblocks
assignedtothefi
lewill
be:b,b+1,b+2,
……b+n- 1.Thismeansthatgiv
enthestarti
ng
blockaddressandthelengthofthefi
le(i
nt er
msofbl ocksrequi
red)
,wecandet ermine
theblocksoccupiedbythefil
e.
Thedi r
ector
yentryforafi
lewithconti
guousallocati
oncontai
ns

 Addressofstar
ti
ngblock
 Lengthoftheal
locat
edport
ion.
Di
rec
tor
y
Forexampl
e,i
fwehav
efourf
il
est
obeal
l
ocat
edspacei
na
Fi
l
e S
tar
t L
eng
th di
sk,thefi
gur
ebell
owil
l
ust
rat
ehowt
hisi
sdoneby
Name cont
iguousmethod.
Cs
c202 0 2
(
a) (
b)
Cs
c111 5 4

Cs
c112 9 1
Me
mor
ybl
ock
s
Cs
c101 15 6
0 1 2 3 4 5 6 7 8 9

10 11 12 13 14 15 16 17 18 19

20
20 21 22 23 24 25 26 27 28 29

T
hecolouroft
hefil
einfi
g(a
)is
i
l
lus
tra
tedinfi
g(b)bythebl
ock
soc
cupi
edbyt
hef
il
e.E
achf
il
eiss
tor
edi
ncont
iguousbl
ock
s.

I
nes
senc
e;

 Eachf
il
eoccupi
esacont
iguousaddr
essspaceondi
sk.

 Assi
gneddi
skaddr
essi
sinl
i
nearor
der
.

 Easyt
oimpl
ement
.

 Ext
ernal
fragment
ati
oni
samaj
ori
ssuewi
tht
hist
ypeofal
l
ocat
iont
echni
que.

2.Li
nkedAl
l
ocat
ion

I
nthi
sscheme, eachfil
eisali
nkedlistofdiskbl
ockswhichneednotbeconti
guous.
Thedi
skblockscanbescat t
eredany whereonthedisk.
Thedi
rect
oryentrycontai
nsapointertothestart
ingandtheendi
ngfi
l
eblock.Each
bl
ockcontai
nsapoi nt
ertothenextblockoccupiedbythefi
le.

 Eachf
il
ecar
ri
esal
i
stofl
i
nkst
odi
skbl
ocks.

 Di
rect
orycont
ainsl
i
nk/poi
ntert
ofi
rstbl
ockofaf
il
e.

 Noext
ernal
fragment
ati
on

 Ef
fect
ivel
yusedi
nsequent
ial
accessf
il
e.

 I
nef
fi
cienti
ncaseofdi
rectaccessf
il
e.

 Becauset
hef
il
ebl
ocksar
edi
str
ibut
edr
andoml
yont
hedi
sk,
alar
genumberof
seeksar
eneededt
oaccessev
erybl
ocki
ndi
vi
dual
l
y.Thi
smakesl
i
nkedal
l
ocat
ion
sl
ower
.
 I
tdoesnotsuppor
trandom ordi
rectaccess.Wecannotdi
rect
lyaccesst
he
bl
ocksofaf
il
e.Abl
ockkofaf
il
ecanbeaccessedbyt
rav
ersi
ngkbl
ocks
sequent
ial
l
y(sequent
ial
access)f
rom t
hest
art
ingbl
ockoft
hef
il
evi
abl
ock
poi
nter
s.
 Poi
nter
srequi
redi
nthel
i
nkedal
l
ocat
ioni
ncursomeext
raov
erhead.

21
3.I
ndexedAl
l
ocat
ion

I
nt hi
sscheme,aspecialblockknownastheIndexblockcontai
nsthepoint
erstoal
lthe
bl
ocksoccupiedbyafile.Eachfil
ehasi
tsownindexblock.Theithentr
yinthei
ndex
bl
ockcontai
nsthediskaddr essofthei
thfi
lebl
ock.Thedirect
oryentr
ycontai
nsthe
addressoft
heindexblockint hememory.

 Pr
ovi
dessol
uti
onst
opr
obl
emsofcont
iguousandl
i
nkedal
l
ocat
ion.

 Ani
ndexbl
ocki
scr
eat
edhav
ingal
lpoi
nter
stof
il
es.

 Eachf
il
ehasi
tsowni
ndexbl
ockwhi
chst
orest
headdr
essesofdi
skspace
occupi
edbyt
hef
il
e.

 Di
rect
orycont
ainst
headdr
essesofi
ndexbl
ocksoff
il
es.

Di
skManagement

1.Di
skFor
mat
ti
ng:
Low-
lev
elf
ormat
ti
ngorphy
sical
for
mat
ti
ng:

Befor
eadi skcanstoredata,t
hesectorisdivi
dedintovari
ousparti
ti
ons.
Thisprocessiscal
ledlow-l
evelfor
mat t
ingorphysicalf
ormatt
ing.I
tfil
l
s
thedi
skwi thaspecial
datastruct
ureforeachsector.

Thedat
ast
ruct
uref
orasect
orconsi
stsof

 Header,
 Dataarea,
 Trai
ler
.

Theheaderandt r
ail
ercont
aini
nformati
onusedbyt hediskcont
rol
l
er,
suchasasectornumberandanerror
-cor
rect
ingcode(ECC).

2.Touseadi
sktoholdf
il
es,t
heoperat
ingsy
stem st
illneedst
orecor
d
i
tsowndat
astr
uct
uresonthedi
sk.I
tdoessointwosteps.

(a)Parti
ti
ont hedi
ski nt
ooneormoregroupsofcy
li
nders.Amongt
he
part
it
ions,onepar t
it
ioncanholdacopyoftheOS‘sexecut
abl
ecode,
whil
eanot herhol
dsuserfil
es.

22
(b)Logi
calf or
matti
ng .The oper
ati
ng syst
em stores the i
nit
ialfi
le-
system datast
ruct
uresontot
hedisk.Thesedatast
ruct
uresmayi ncl
ude
mapsoff reeandall
ocat
edspaceandani ni
ti
alemptydi
rector
y.

BootBl ock:
Foracomput ertostartrunni
ng-forinstance,wheni ti
spower edupor
rebooted-i
tneedst ohaveani ni
ti
alpr ogram torun.Thisi
niti
alpr ogr
am
i
scal led bootstr
ap program & itshoul d be simple.Itinit
iali
zesall
aspectsoft hesystem,fr
om CPUr egi
sterstodev i
cecontrol
lersandt he
contentsofmai nmemor y,andthenstartstheoperati
ngsy st
em.

Todoi
tsj
ob,
theboot
str
appr
ogr
am;

 Fi
ndst
heoper
ati
ngsy
stem ker
nel
ondi
sk,

 Loadst
hatker
nel
int
omemor
y,

 Jumpt
oani
nit
ial
addr
esst
obegi
ntheoper
ati
ng-
syst
em execut
ion.

3.BadBl
ocks:

Thediskdefect
ivesectorisknownasbadblock.Dependingont
hedi
sk
andcontr
oll
erinuse,theseblocksar
ehandl
edinav ar
iet
yofways;

Met
hod1:
“Handl
edmanual
l
y

I
fbl
ocksgobadduri
ngnormaloperat
ion,aspeci
alpr
ogram mustberun
manual
l
ytosearchf
orthebadblocksandtolockthem away.Dat
athat
r
esi
dedonthebadbl
ocksusual
lyarelost
.

Met
hod2:
“sect
orspar
ingorf
orwar
ding”

Thecontr
oll
ermaintai
nsal i
stofbadblocksont hedi
sk.Thenthe
cont
rol
l
ercanbetoldtorepl
aceeachbadsectorlogi
cal
l
ywithoneoft
he
spar
esect
ors.Thi
sschemei sknownassectorspari
ngorf
orwardi
ng.

At
ypi
cal
bad-
sect
ort
ransact
ionmi
ghtbeasf
oll
ows:

23
1. Theoper
ati
ngsy
stem t
ri
est
oreadt
hel
ogi
cal
block.

2. Thecont
rol
l
ercal
cul
atest
heECCandf
indst
hatt
hesect
ori
s
bad.

3. I
trepor
tst
hisf
indi
ngt
otheoper
ati
ngsy
stem.

Thenextti
met hatthesyst
em isreboot
ed,aspeci
alcommandi
srunt
otel
lthe
cont
rol
lert
oreplacethebadsect
orwithaspar
e.

Afterthat,wheneverthesyst
em request
slogicalblockmarked asbad,t
he
r
equestistr
anslat
edintot
herepl
acementsect
or'
saddressbythecont
roll
er.

Method3: “sectorsli
pping”
Foranexampl e,supposet hatlogicalblock17becomesdef ect
ive,andthefir
st
avai
lablesparef ol
lowssect or202.Then,sectorsli
ppingwoul dremapal l
thesect
ors
fr
om 17t o202, mov ingthem alldownonespot .Thatis,sector202wouldbecopied
i
ntot hespar e,thensect or201i nt
o202,andt hen200i nto201,andsoon,unt i
l
sect
or18i scopi edintosector19.Slippi
ngt hesector
si nthiswayfreesupthespace
ofsector18,sosect or17canbemappedt oit
.

DMA(
Dir
ectMemor
yAccess)
Directmemor yaccess(DMA)i safeatur
ei ncomputersy
stemst hatall
owsome
systemshar dwar etoaccessthemai nmemor y(
RAM)directl
ywithoutthecentral
processinguni t(
CPU)indirectcontr
ol.WithDMA, t
heCPUonl yneedst oini
tiat
ethe
i
nput /outputoperati
onofthedev i
ceandr eli
nqui
shcontr
ol whi
lethedatat r
ansferi
s
goingon.

Manyhardwar
eusesDMAf
ordat
aaccess,
e.g.di
skdr
ive,
graphi
ccar
ds,
net
wor
kcar
ds
andsoundcar
ds.

Modeofoper
ati
on;

 Bustmode

 Cy
clest
eal
i
ng

24
 Tr
anspar
entmode.

Burstmode.Inburstmode,anenti
reblockofdatai stransferi
nonecont i
guous
sequence.OncetheDMAdev i
cecont
roll
eri
sgr antedaccesst othesystem busbythe
CPU, i
ttr
ansfer
sallbyt
esinthedatabl
ockbef orereleasingcontr
olofthesystem bus
backtotheCPU.Itisalsoknownasblocktransfermode.

Cy cl
esteali
ngmode,t
heDMAdev iceusesthebustmodebuti nst
eadofreli
nqui
shing
contr
olafteri
tsbl
ockt
ransfer
,iti
ssuesanotherrequestf
ortheuseofthesystem bus
andmayendupt r
ansf
err
ingmor eblocksofdatabeforeevent
uall
yrel
i
nquishi
ngcontrol
ofthebus.

Transparentmodei
swhentheDMAusest hesyst
em bustoquickl
ytr
ansfer
sblocksof
datawhent heCPUi
sperf
ormingfunct
ionst
hatdonotrequi
retheuseofthesyst
em
bus.Thismodeismostef
fi
cientoft
hemodebuttakesmostt i
meintransf
err
ingblock
ofdata.

Fi
l
epr
otect
ion
Wheninf
ormati
oniskepti
nacomput ersy
stem,wewantt
okeepi
tsaf
efr
om phy
sical
damage(r
eli
abi
li
ty)andi
mproperaccess(
prot
ecti
on)
.

 Reli
abil
ityisgenerallyprovi
dedbyduplicat
ecopi esoffi
les.Manycomput ers
havesy stemspr ogramst hataut
omaticall
y(orthroughcomput er
-oper
ator
i
ntervention)copydi skfil
est otapeatregularinter
val
s( onceperdayorweek
ormont h)to mai ntai
n acopyshoulda fil
esy stem beaccident
all
ydestroy
ed.

 Fi
lesystemscanbedamagedbyhar dwareproblems(suchaserror
sinreadi
ng
orwrit
ing),powersur
gesorfai
l
ures,headcrashes,di
rt
,temper
atureextr
emes,
andvandalism.Fil
esmaybedeletedacci
dentall
y.Bugsinthef
il
e-syst
em
soft
war ecanalsocausef
il
econtentstobelost.

 Prot
ecti
oncanbepr ov
idedinmanyway s.Forasmal l
singl
e-usersyst
em, we
mightprovi
depr
otecti
onbyphysi
cal
lyremov ingthediskandlockingt
hem ina
deskdrawerorf
il
ecabinet
.Inamult
i-
usersy stem,however,othermechanisms
areneeded.

Pr
ovi
dingAccess

Accesst
ofi
l
esi
spr
ovi
dedi
nthr
eeway
s;f
reeaccess,
cont
rol
l
edaccessandnoaccess.

 Compl
etepr
otect
ioni
spr
ovi
dedbypr
ohi
bit
ingaccess.

 Fr
eeaccessi
spr
ovi
dedwi
thnopr
otect
ion.

25
Whati
sneededi
scont
rol
l
edaccess.

 Protect
ionmechani
smsprov
idecont
rol
l
edaccessbyl
i
mit
ingt
het
ypesoff
il
e
accessthatcanbemade.

 Accessi
spermi
ttedordeni
eddependi
ngonsev
eral
fact
ors,
oneofwhi
chi
sthe
ty
peofaccessr
equested.

Sev
eral
dif
fer
entt
ypesofoper
ati
onsmaybecont
rol
l
ed:

1 Read:
Readf
rom t
hef
il
e.

2 Wr
it
e:Wr
it
eorr
ewr
it
ethef
il
e.

3 Execut
e:Loadt
hef
il
eint
omemor
yandex
ecut
eit
.

4 Append:
Wri
tenewi
nfor
mat
ionatt
heendoft
hef
il
e.

5 Del
ete:
Del
etet
hef
il
eandf
reei
tsspacef
orpossi
bler
euse.

6 Li
st:
Listt
henameandat
tri
but
esoft
hef
il
e.

Associat
ewi
theachfi
leanddi
rect
oryareaccess-
cont
rol
li
st(
ACL)whi
chspeci
fi
est
he
usernameandthety
pesofaccessall
owedforeachuser
.

Whenauserrequestsaccesstoapar t
icul
arfi
le,theoper
ati
ngsyst
em checksthe
accessl
i
stassoci
atedwiththatf
il
e.Ifthatuseri
sl i
stedf
orther
equest
edaccess,the
accessi
sall
owed.Otherwise,
aprotecti
onv i
olat
ionoccursandt
heuserjobisdeni
ed
accesst
othefi
le.

Thr
eecat
egor
iesofuser
scanbegr
ant
edaccesst
oaf
il
e.

Owner
:Theuserwhocr
eat
edt
hef
il
eist
heowner
.

Group:
Asetofuser
swhoar
eshar
ingt
hef
il
eandneedsi
mil
araccess\
isagr
oup,
orworkgr
oup.

Uni
ver
se:
All
otheruser
sint
hesy
stem const
it
utet
heuni
ver
se.

Consi
der
ati
onf
oref
fi
cientmet
hodsoff
il
eor
gani
sat
ion

26
Therear
esev er
alwaysandmethodsoff i
lesor
gani
sati
on.Eachoneissuit
edforsome
taskmorethantheother
s.Ther
efor
et her
eisneedsconsi
derthebenef
itanddrawback
ofeachsystem whi
l
echosenaf i
lesystem f
oruse.

1.Fr
equencyofupdate.Af
il
ethatneedst
obeupdat
edfrequent
lyr
equir
esaf
il
e
sy
stem t
hatwil
lall
oweasyretri
eval
ofi
nfor
mat
ionandeasyupdates.
Tr
ansacti
onalf
il
esareexamples.

2.Fi
leact
ivi
ty.Di
ff
erentf
ileshavedi
ff
erentf
il
eacti
vi
ties.Afi
l
ethatrequi
resa
sort
eddatawil
lbebetterserv
edbyasequenti
alfi
leorgani
sat
ion.

3.Fi
leaccess.Thetypeofaccessrequi
rei
safactorthatmusttheconsi
deredin
choosi
ngaf i
lesystem.Archi
val
datacanbestoredontapesusingsequenti
alfi
l
e
syst
em, whil
eonli
nedatathatar
eaccessoft
enar ebett
erstoredusi
ngrandom
accessfi
lesyst
emsondi sk.

4.Nat
ureoft
hesyst
em.Thenatureandtypeofsy
stem al
sodet
ermi
newhatt
ypeof
f
il
esyst
em i
sbestfort
hatenv
ironment
.

5.Storageef
fici
ency.Howeff
ici
enti
sthest
oragemedi
ainr
etai
ningt
hei
ntegr
it
yof
dataforalengthoft
ime.

6.Scal
abi
l
ity
.Howeasi
l
ycant
hesy
stem beexpandedwhenneeded?

7.Si
zeandscopeofthedat
afi
l
e.Thesi
zeandt
her
ateatwhi
chadat
afi
l
egr
owi
s
amajorconsi
der
ati
on.

8.Cost
.Budgetli
mitmustbeconsi
deredwhenchoosi
ngaf i
l
esy stem asnotal
l
or
ganisat
ioncanaf
for
dv er
yexpensi
vebutmoreeff
ici
entfi
lesystems

Consi
der
ati
onf
orabat
chandmul
ti
-usersy
stems

Theconceptofbat chf i
leorigi
natedfrom theear l
yday sofcomput ersystem when
punchedcardswer eusedf orstorageandi nputs.Thepunchedcar dswoul dbepil
edup
andt hecomputerwi l
lprocesst hetasksonecar daf t
ertheother.Inmoder ndays
comput er
sabat chfil
ei sregardedasaf i
l
ewhi chcont ai
nsotherfil
esandi nst
ructi
ont
o
processthesefi
lesinqueuewi thoutexternalintervent
ion.Howev erpresentbatch
system al
lowforinteracti
ont oavoidtoomanyer rorandeaseofdebuggi ng.

Bat
chf
il
esy
stemsar
eusual
l
yusei
n;

1.Lar
geor
gani
sat
ionf
orpr
oduct
ionl
i
nessy
stems.

2.Transacti
onalf
il
eindat
abasesystem.Thesearefi
leswhichhavetobeupdat
es
orprocessedall
atoncewit
houtinter
fer
ence.Tr
ansact
ionalpr
ocessi
ngprovi
des

27
i
sol
ati
onf
ort
hepr
ocessf
rom ot
herf
il
est
il
lthet
ransact
ioncommi
t.

3.Inwindowsoper ati
onsyst
em batchfil
eshave.BATfi
l
eextensi
on.Thesefi
leare
usedinOSt obootupcomput ersystemsandforshort
ingdown,andmanyother
operat
ionsthatneedssequenti
alexecuti
on.I
nUnixOperat
ingSystem,t
heyare
cal
ledshell
scripts.

4.Reporti
ng.Inal
argecompanywithapr oduct
ionli
ne,r
epor
tsar
egenerat
edusi
ng
batchfi
leformanagementandaudit
ing.Banksalsousebat
chfi
lesy
stemsto
generat
eandprintmonthl
yaccountdetail
sforcust
omers.

5.Bil
l
ingsyst
emsusesbatchf
il
etopr
oducer
ecor
dsf
orcal
cul
ati
ngbi
l
lsand
gener
ateuserr
epor
ts.

6.Updat
ing,bat
chappl
i
cat
ionsar
eusual
l
yrunatt
heendoft
hedayt
oupdat
edat
e
i
nastoragesyst
em.

Mult
i-
accesssy stemsisasystem thatisaccessbymul ti
pleusers.Mostbatch
sy
stem ar eal
somul t
i-
accesssystem.Inamul t
iaccessfi
le,mechanism areputin
pl
acethataf il
eisnotaccesssimultaneouslybytwoormor euser.Alocki
ng
mechanism deniesaccesstootheruserswhenoneuseri saccessingthefi
le.Thi
s
i
stoprev entoverwri
ti
ngthewor kofanot heruseri
nadvertent
ly.

Fi
l
eSy
stemsi
nOper
ati
ngSy
stems.

Sel
fst
udy

28

You might also like