0 ratings0% found this document useful (0 votes) 64 views11 pagesModule 4 Os
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
\y
File Management
+ Afile system 's 2 method an operating system uses to store, organize, and manage files and directories on a
storage device.
+ Some common types of fle systems include:
+ FAT (File Allocation Table}:
‘An older file system is used by older versions of Windows and other operating systems.
+ _NTES (New Technology File System):
‘Amodern file system used by Windows.
It supports features such as file and folder permissions, compression, and encryption.
+ EXT (Extended File System):
: file system commonly used on Lnux and Unix-based operating systems.
+ HFS (Hierarchical File System):
Mile system used by macos,
+ APES (Apple File Systern):
‘Anew file system was introduced by Apple for thelr Macs and IOS devices.
‘Advaiitages of using a file system
+” Organization
Afile system allows files to be organized into directories and subdirectories, making it easier to manage and
locate files.
+ Data protection:
File systems often include features such as file and folder permissions, backup and restore, and error detection
and correction, to protect data from loss or corruption.
+ Improved performance:
‘Awell-designed file system can improve the performance of reading and writing data by organizing it
efficiently on disk.
Disadvantages of using a file system
‘+ Compatibility issues:
Different filesystems may not be compatible with each other, making It dificult to transfer data between
different operating systems.
+ Disk space overhead:
File systems may use some disk space to store metadata and other overhead Information, reducing the
‘amount of space avallable for user data.
+ Vulnerability:
File systems can be vulnerable to data corruption, malware, and other security threats, which can compromise
the stability and security of the system.
File
+ Afile can be defined as a data structure that stores the sequence of records,
‘+ Files are stored ina file system, which may exist on a disk of In the main memory.
+ Files can be simple (plain text) or complex (spectally formatted).
‘+ The collection of files Is known as Directory.
+ The collection of directories at the ferent levels Is known as File System.
Attributes of the File
1. Name
Every file carries a name by which the file Is recognized In the file system,
2. Identitier
‘Along with the name, Each File has its extension which Identifies the type of the fle
3. Type
Ina ile System, the Files are classified Into different types such as video files, audio files, text files, executable
files, ete.
4. Location
{nthe File System, there are several locations in which, the flles can be stored.
Each file carries its location as its attribute,
BALKEES K, JDTIPTC CALICUT-12
@ scanned with OKEN Scannera
5. Size
‘By sze of the file, means the number of bytes acquired by the file In the memory.
6. Protection
‘Therefore each file carries its own set of permissions to the different groups of Users,
Time and Date
Every file carries atime stamp which contains the time and date on which the file was last mo
L
® scanned with OKEN Scanner
fied,
File Types:
+ File type refers to the
source files binary files ete
ofthe operating system to distinguish different types of files such as text les
+ Thename ofthe fileis divided into two parts as shown below:
+ Name
+ Extension
‘Some common types of files include:
Filetype Usual extension | Function
Executable ‘exe, com, bin ‘Read to run machine language program
[object obj, 0 Compiled, machine language not linked
Source Code | ¢,java, pas asm, 3_| Source code in various languages
J Batch bat, sh ‘Commands to the command interpreter
Text tat, doe Textual data, documents
‘Word Processor _[ wp, tex, pdf; doc | Vatious word processor formats
‘Archive are zip, tar Related files grouped into one compressed ile
Multimedia MPEG, MOV, rm | For containing audio/video information
‘Markup XML, HTML, tex [itis the textual data and documents
Libra bya, £0, contains ines for programmers
Print or View tts. format for printing or viewing an ASCII or binan
File Organization Methods/
File Access Methods
Ut refersto the methods and technig
There are three main types of file
4 Sequential
2 Direct
3. Indexed.
ues employed to read and write data from files,
access methods:
Dexinlng
2. Direct File Access
ct fle access, also known as random access,
+ Wallows us to access data directly feom amy
records that come before It.
hod accesses records wit
base
vy location within th
without the need to read or write all the
cal addres
we may need to quickly reteleve cust
e& or positions.
tomer data based on a specific
BALKEES K, sOTIPTC CALICUT-Azw
zr-angnwva datsar 9 S23x1V8
“poveydor 03 31 9 OPI P
oun
apeds sp vey oF pasn o
ayy uy a9ejd 24j20ds & 0} wonysod wasuno a4 wo!
0 201 Aap
jaquoa ayn speas uojes9do SIL
nesodo peoy 'Y
wyaip 01 on
peas uaaq sey xep axa pIyn 1 da wojysod a4 oF Junio’
ep jo wo] 1p pu oy 49 Jo abu aun syo9d Yeu pense san Ne weTS Y
'sopnoud uy e vado 0 sIUEM.
ruopd o10jaq poundo aq smu ‘99829 1 24 29U0
poy ave a9 250p pus “ud ‘own peas se os ye wo powousysuy ag ue teu swonerade SPEHEA OA,
‘ita aun uo suonex2do
“uoyshs 243 Jo Ayproyduso>
seapuy ayy 20) sped ofesosuonyppe svynbou ips] aBeywenpesipwjew 5
ppue yso0 oy) aseas2uy wea yo.yn
“suonesodo
ip eo denedeuopu agen ca ae
cro ss9204 94 poxopule
‘jy epuanbos wey a5n pue iuoura}duy 03 a3ayip pue x2ycwe> au0W 9q ues ssa208
seine aee wopue! oj fauna poe poser ay sore uy neer eee ea
Wp Jo aBewienpe jeu ou
MS
is
® scanned with OKEN ScannerZE-Anonva Iuduar ‘4 saaNIvE
TLTP PPP?
ta | sa
‘Avoroouia
«oaRSR#lOW 51 2}n1 eu anbjun ays oun 80 ose
‘Stésut onbjun e ancy asnus foun Asox2921p owes aun et coe
ye>s1asn omy +
aun .
samanns jeaypzes014 fasmanng avs “¢
‘Aoi011p janaj-omy -e
Aroaup onop-2yus “1
lenonas ose asoyy
among A1032021q
40 Buydnov8 je>/20 :Juydnoig +
wes 942 405 SowLeU yUBLO,yp
]uaAUOD SotoDIq WI :TUEN +
"AMPInb 10 payeD9] aq ued ayy y :ADUa!IN3
+948 s9}0}29up 3uurenureus jo sadeiueape ays
woxshs ayy ayn assoned, +
ye oueuay
Kovenpersn +
aye arjag
aye rea
Pye soyysieos —«
ie Atoyoup ayy uo pauopsad suoneiedo ay
opewioyu) uonrao1g
eq
possanse yee] 91eq
nua} wnwaxeyy
dua} yazan,
ssoippy
dk
owen
231N9P eu! PaujeyuoD uoeWOY)
‘souno1 quoweBeuew ayy snoyien hq 2193559220 9) € ary 5} LOWaup aut
‘ ‘say 244 anoge HaNNeUHHO}U sUIE\UOD ArorDauIp 941
“duysiaumo pue ‘uo;re20} ‘saynqunye Suipnyouy ‘s9|y ay snoqe taneuoyuy sujen
wie “ArowauIp ay € 5] 59} Jo UoNDaHIO> ay =
oraaia ayy
“ay Buns o4p aueuos oy posn uonesodo sap
jonesado oweuny “oy
2) U8 a 01 Hep spPe uonesado sl
pone suojesedo puaddy “6
~ pase: 1 9g pine atone soinosey ae put
"3 ayo Susszoid ai won
yeYR Os paso|> aq Pinoys 41 ‘aralduso> 5} 24 949 4 T aloptito sine 7
Wourwiod apew soduey aya
® scanned with OKEN Scanner+sojso,aaups04to 01u ay 04 9AEY YT ADU) ‘9UO UY} YOU OP >I
“ewep A10}29up Y0O4 94) Ajypou! YOUNED $1950)
2 -payeoyidwoo owo2oq Aew Bujyaieas ay) s0se0s2U) sojo3204Ipqns Jo JOquINY ay jt
suosn Suowse Sujseys ay stuonosd si S0}.0.99up 5198n 494Y0 $59920 OF POmoy U5] 150 ON SY
-paujejdxa soamanays Asoy201)p om 4940 94) WEAN 3]qeI8>5 92015] A1OY29A1P IHL
9 sgwionoq Hus08 as
-ypjsea 5} Suypueas
“Auoysaujp € apisuy soyoRdsIpans Smojje auNIONAAS A10I2.IP
*says0 204p 5 198n s94j}0 04 $5998
‘ney jou soop 49sn aya ‘A10}994Ip 5]ys Uy OND ‘PUY
‘yy Apo youues pUE
‘ewwp A1o}901)p 1001 ayy 07 559328 OAEY YOU SBOP 495M V
*Aso994)p s194% Ul S31)
si95n UL
ujeauo>
ovoup 1035 uona pue soyo}20u}pqns 93C029 WN
aa “4agn 409 10} SoWO129s1P O17
pue yoou ayy sojquiaso4 aanyanans A109041P SIL
hove ‘s1aandwoo jeuossad sno wy pasn Ajuouiwio? ysous
dal you sy wroysks Supjesado ayp jo 94mannns Ao}2O4Ip 9949 UL
“ssoopoupqns aye939 3,ue> 519571
“s1asn soyjo ayy yim ayy a4 aseys YouUED 19S DHL
ssabowuonposya
ssoboquoapy
aanyonuns [e2qypaesayH /osmanAs 941 (E
ssa6p1uDaposia
-aamanays Aso39911p 51) uy Asea Aton s9u029q Soy) 94) 103 TUIYPACOS
‘sayy 595n zatjo Bujss9296 wos}
suosn quanoad pinom yaqyss 2404) 9q pjnoar AYNDIS V
I@0C0C0O+ Beane
Se reon can eadioqnes nl
ssobouoapy
‘y901409 5] pl 4asn mau e s9ADUDyM
Aow op
wa] [sa] [20 a an paypzeas sj (asi) Asorsoup ayy oases AUDYSAS OL
‘aan aySuys v Jo soqyp
eorenp 240 AO ss PED ING ‘sdAMaMANF JENS OnE SOM ONL
1a i (aan) sowaaip s9}y 1089 UM
you sey 49sn ype ‘sanyanins A10}294Ip J9A9]-O%81 O11 UI
*odaey 5] Aox294)p 94a | DuwiNst
-oweu awies ayy ancy UeD s9jlj om} asnv2aq Uo|s}0> OWIeU Jo d2uEH} ALLL A9KLL
‘haowpaayp auies 94) Ut So}L) pore]O4
sAsanooay pue dny2ed 59%
sua pue eyep anjistas 03 ssa99e pazLoUyneun yuonoad Oy Sd}O4 SL
:Ayunoas panoudi
‘pou Aoyp 91 ay) aye20} Apyainb 0} s1asn Bujmoye ’55992e ayy Y5e) 40) pox}UuNdo axe soaMansIs A10}29210
:Aoua)})3 paswasou
“paou Aayp evep ayy ssaaze 03 s4asn 40) 49/589 3] TupfeU 's9}y adeuew pue ned}aeu oy Avma Ase
‘9g 03 poou yey sajy ays fe dny2eq PUE 99e20} 04 19I5e9 511}
sporpayoud aze sayy queyoduy eM $9403
‘4ayse) 9010909 1/4 Suyyo.Es “ar}s Wy JoyJeWUs aXe Soy
“Ase Auan 5} uopeUOUD|
FATOWONP TOROPOME (Z
® scanned with OKEN Scanner\e disk blocks.
Fle Att Mt ethods define how the les ae stored in te disk
+ Theallocation methods define how dart
+The main idea behind these methods Isto NK
+ Etent ik space tao
+ Fastaccess to the file blocks. nods.
+ There ate three malin disk space or file allocation methos
1. Contiguous Allocation
2. Unked Allocation
3. Indexed Allocation
iphone nh expla cotues ef ost on the
{ Forenample fle reqtes blocks ans given a lock bas the
Thnmeane that gen the ante loc dares andthe length ofthe fle fn terms of blocks requiced), we
can determine the locks ocuped bythe file
+The decor entry for fe wth
contiguous aston contain
Adres of song lock
«Length ofthe alloeted portion.
+ Thefie‘maiinthe flowing gure sas
trom ich 19 wth iengtne lel
Therefore, kocupes 1,20 24, 28:23,
blocs
ig location, then the blocks
Directory
‘te start engi
count °
Advantages:
* Both the Sequential and Direct Accesses are
supported by this. For direct access, the
address of the kth block ofthe file which
starts at block b can easily be obtained as
(oe),
+ Thisis extremely fas since the number of
seeks is minimal because of the contiguous
allocation of file blocks.
Disadvantages:
because it depends on the availabilit
ress depends on the ability of contiguous memory at a particular
2. Linked List Allocation
+ In this scheme, each file is linked lst of
disk blocks that need not
+ The disk blocks can be se
on the disk
+ The directory entry contains a
starting and ending tte blocks,
+ Gach block contatns a pointer tothe next
block occupied by the file,
+ The ite jeep in the following image shows
how the blocks are randomly distrlbuted,
He lst block (25) containg +1 indieating 9
full pointer and does not point to any ether
block
be contiguous,
attered anywhere
Directory
Pointer to the
@ scanned with OKEN Scanner\ SR
Advantages: Hal
This is very flexible In terms of file size Filesize can be Increased easily since the system does not have to
fokforaontquus chunk menor
1 or aE fon enteral fagmentatlon, TA makes relatively beterin terms of memory
46
titeaton.
Disadvantages
OCS a blocks are distributed randomly onthe di lage number of seeks are needed to access
tvery lock indvdually
«goes not support random or ditt acess.
inthe inked allocation incr some entra overhead
+ Pointers requi
3. Indexed Allocation
+ Inthis scheme, a special block known as
the Index block contains the polnters to all
the blocks occupled by a file.
+ Each file has its own index block.
+ Theith entry in the Index block contains the
disk addeess of the ith file lock.
+ The directory entry contains the address of
the index block as shown in the Image:
Directory
file index block
Jeep 39)
‘Advantages: a
+ This supports direct access to the blocks
occupied by the file and therefore provides
fast access to the file blocks.
‘+ Itovercomes the problem of external
fragmentation.
Disadvantages:
‘+The pointer overhead for indexed allocation is greater than the linked allocation.
+ For very small files, say files that expand only 2-3 blocks, the indexed allocation would keep one entire
block {Index block) for the pointers which Is Inefficient in terms of memory utilization.
+ Forvery large files, a single index block may not be able to hold all the pointers.
Disk Scheduling
+ Disk scheduling is done by operating systems to schedule 0 requests arriving for the disk.
scheduling is also known as 1/0 Scheduling.
+ Multiple /0 requests may arrive by different processes andl only one 1/0 request can be served at a time by
the disk controller.
+ Thus other 1/0 requests need to wait In the walting queue and need to be scheduled,
+ Two or more requests may be far from each other so this can result in greater disk arm movement,
Nard érives are one ofthe slowest parts ofthe computer system and thus need to be accessed efficiently,
Key Terms Associated with Disk Scheduling
+ Seek Time
Seek time Is the time taken to locate the disk arm to
+ Rotational Lateney:
Rotational Latency fs the time taken by the desired sector of the disk t
access the read/write heads,
+ Transfer Time:
Transfer time Is the time to transfer the dato,
depends on the rotating speed ofthe disk a
pacman on the rotating speed of the dsk and the numberof bytes to be transferred.
‘8 specified track where the data is to be read or written.
}© rotate Into a position so that It can
‘eek Time + Rotational Latency + Transfer Time
* Total head Movement * Seek Time
DALKEES K, JOTIPTC CALICUT-42
cy te alee |
@ scanned with OKEN Scannerase Tim ime spent by a request waiting to perform its 1/0 operation,
+. Deki is the average time sp 3 .
- Response Tine th te regan tie fal equests.
The average Response
iced for average response
how individual requests are service
ie Time is the measure of
Variance Respons
time.
Rotational ter Time
Bish Guero | Sack Tine aloncy Ten
iy
+ Distress tine. —
Disk Response Time, ———___,
Disk Scheduling Algorithms
+ There are several Disk Several Algorithms.
1. FCFS (First Come First Serve)
2. SSTF Shortest Seek Time First]
3. SCAN (Elevator Algorithm)
4. SCAN (Circular SCAN)
5. LOOK
6 C-LOoK
1. FCFS (First Come First Serve)
{_IBFCFS, the requests are addressed in the order they a
Suppose the order of request is-(62,170,43,140,24,16 190)
50
Tots! overhead movement (Total distance covered by the disk arm)
= (82-50) +{170-82}4(170-43)+(140.43)+
(140-24}+(24-26}+(190-16)
= 642
in the disk queue.
and the current position of the Read/Write head is
Advantages of FCFS
+ Every request gets a fair chance
‘No indefinite postponement
isadvantages of Fors
+ Bonot try to optimize seek time
May not provide the best possible service
2. SSTE (Shortest Seck Time First)
+ WSSIE[Shorest Seek Time Firs
eek time are
runnin of very sues eluted iran sd genet frst,
to thelr calculated seek time inthe queue and
‘2 tera the request near the ask anm wl got executed frst
Sunvose the order of request i (82,2700 40,24,16,199)
0
ithe shortest s,
‘en they are scheduteg According
‘nd current position of tead/ Wate heogn
te
DAKEES K, OTP TC CaLtCOnay
—!
@ scanned with OKEN ScannerAdvantages
‘The average Response Time
Disadvantages
48.
otal overhead movement (Total distance covered by the disk arm) = (S0-43}+(43-24)+(24-16)+(62-16)+ |
(140-82) {170-140}+(180-170)
decreases
‘Throughput increases
‘Overhead to caleulate seek time in advance
Can cause Starvation fora request If t has a higher seek time as compared to Incoming requests
©The high variance of response time as SSTF favors only some requests
| 3. SCAN scheduling
© Inthe SCAW algorithm the disk arm moves in a particular direction and services the requests comin
tnd after reaching the end of the disk, It reverses Its direction and again services the request arri
path.
+ Asa result, the requests atthe midrange are serviced more and those arriving behind the disk arm will have to
walt,
‘+ Suppose the requests to be addressed are-82,170,43,140,24,16,190.
+ And the Read/Write arm is at 50, and It Is also given that the disk arm should move “towards the larger valu
+ Therefore, the total overhead movernent (total distance covered by the disk arm) is calculated as
199-50) + (199-36)
32
own a 2 0 12150 170 190 399
Heb bt}
‘Advantages of SCAN Algorithm
+ High throughput
+ Low variance of response time
+ Average response time
Disadvantages of SCAN Algorithm
+ Long waiting time for requests for locations just visited by dk arm
4. SCAN Scheduling
+ Inthis, the Head moves from one e
tothe other of the disk while serving
all the requests in between,
BALKEES k, soriPTC CALICUT-az
@ scanned with OKEN Scanner3 to the SCAN algorithm hence It § known
© So, the dk arm moves elrelarly and ths algorithm I also sia
‘C-SCAN (circular SCAN)
‘+ Suppose the requests to be addressed are-82,
+ And the Read/Write armis at $0, and its also given’
+ So, the total overhead movement (total distance covered by thé
70,43,140,24,16,190. a
aoa atte disk arm should move “towards the larger value",
disk arm) is calculated as:
199-50] + (199-0) + (43-0)
#301
owe 29 aso 0 350 199
Advantages
+ The Head moves from one end to the other of the disk while serving all the requests in between.
‘+ The waiting time for the cylinders that were just visited by the head is reduced in C-SCAN compared to the
SCAN Algorithm.
+ Uniform waiting time
+ Better response tim
Disadvantages
‘+ More seek movements are caused in C-SCAN compared to SCAN Algorithm.
‘+ In CSCAN even if there are no requests left to be serviced the Head will still travel to the end of the disk
unlike the SCAN algorithm
5. LOOK Scheduling
the disk arm despite going to the end of the disk goes only to the last request to be serviced in front
of the head and then reverses its direction from there only.
‘+ Suppose the requests to be addressed are-82,170,43,140,24,16,190.
* And the Read/Write arm sat 50, and Iti also Even thatthe dik arm should move towards the larger
+ $0, the total overhead movement (total distance covered by the disk arm) Is calculated as:
190-50) + (199-16)
14
00 442180 170 90 99
be 1
Advantages:
‘+ Starvation does not occur
‘Since the head does not go to the end of the disk, the time Is not wasted here.
Disadvantage:
+The arm has to be consclous to find the last request.
‘BALKEES K, JDTIPTC CALICUT-12
@ scanned with OKEN Scanner700K Scheduling
+ In CLOCK, the «fst arm despite going to the end goes only to the last request to be servic
hhead and then from there goes to the other end’s last request.
+ Thus, it also prevents the extra delay that occurs due to unnecessary traversal tothe end of the disk,
+ Suppose the requests to be addressed are-82,170,43,140,24,16,190.
+ And the Read/Write arm is at 50, anc ‘Iso given that the disk arm should move “towards the larger
value”
+ So, the total overhead movement (total distance covered by the disk arm) Is caleulated as
= (190-50) + (190-16) + (43-16)
2341
Advantages:
‘+ The waiting time is decreased.
2 ifthere are no requests tll the end, It reverses the head di
Starvation does not occur.
1e taken by the disk arm to find the desired spot i less.
fon immediately.
‘+ The arm has to be conscious about finding the last request
Golden Questions
Short type Medium Type
1. Whats fle
1. What Is directory
Uist disk formatting methods
Write various file operations
‘Name any four fle
What Is 1/0 bound process
2
3
4
5, What is CPU bound process
6.
2
8, Compare text fle and executable file
Essay Type
® scanned with OKEN Scanner