SlideShare a Scribd company logo
File Allocation Methods
Dr.G.Jasmine Beulah
Kristu Jayanti College, Bengaluru
File Allocation Method
• The allocation methods define how the files are stored in the
disk blocks. There are three main disk space or file allocation
methods.
Contiguous Allocation
Linked Allocation
Indexed Allocation
Contiguous Allocation
• The directory entry for a file with contiguous allocation contains
Address of starting block
Length of the allocated portion.
Advantages:
•Both the Sequential and Direct
Accesses are supported by this.
For direct access, the address of
the kth block of the file which
starts at block b can easily be
obtained as (b+k).
•This is extremely fast since the
number of seeks are minimal
because of contiguous allocation
of file blocks
Disadvantages:
•This method suffers from both
internal and external fragmentation.
This makes it inefficient in terms of
memory utilization.
•Increasing file size is difficult
because it depends on the
availability of contiguous memory at
a particular instance.
Linked List Allocation
• Each file is a linked list of disk blocks which need not
be contiguous. The disk blocks can be scattered anywhere on
the disk.
• The directory entry contains a pointer to the starting and the
ending file block. Each block contains a pointer to the next block
occupied by the file.
Advantages:
•This is very flexible in terms of file
size. File size can be increased
easily since the system does not
have to look for a contiguous chunk
of memory.
•This method does not suffer from
external fragmentation. This makes it
relatively better in terms of memory
utilization.
Disadvantages:
•Because the file blocks are distributed
randomly on the disk, a large number
of seeks are needed to access every
block individually. This makes linked
allocation slower.
•It does not support random or direct
access. We can not directly access the
blocks of a file. A block k of a file can
be accessed by traversing k blocks
sequentially (sequential access ) from
the starting block of the file via block
pointers.
•Pointers required in the linked
Indexed Allocation
• A special block known as the Index block contains the pointers
to all the blocks occupied by a file.
• Each file has its own index block. The ith entry in the index
block contains the disk address of the ith file block.
• The directory entry contains the address of the index block as
shown in the image:
Advantages:
•This supports direct access to the blocks
occupied by the file and therefore provides
fast access to the file blocks.
•It overcomes the problem of external
fragmentation.
Disadvantages:
•The pointer overhead for indexed allocation
is greater than 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. However, in linked allocation we
lose the space of only 1 pointer per block.
Disk Scheduling Algorithms
• Disk scheduling is done by operating systems to schedule I/O
requests arriving for the disk. Disk scheduling is also known as
I/O scheduling.
• Multiple I/O requests may arrive by different processes and only
one I/O request can be served at a time by the disk controller.
Thus other I/O requests need to wait in the waiting queue and
need to be scheduled.
• Two or more request may be far from each other so can result
in greater disk arm movement.
• Hard drives are one of the slowest parts of the computer system
and thus need to be accessed in an efficient manner.
• Seek Time:Seek time is the time taken to locate the disk arm to
a specified track where the data is to be read or write. So the
disk scheduling algorithm that gives minimum average seek
time is better.
• Rotational Latency: Rotational Latency is the time taken by
the desired sector of disk to rotate into a position so that it can
access the read/write heads. So the disk scheduling algorithm
that gives minimum rotational latency is better.
• Transfer Time: Transfer time is the time to transfer the data. It
depends on the rotating speed of the disk and number of bytes
to be transferred.
• Disk Response Time
•Disk Access Time
Disk Scheduling Algorithms - FCFS
In FCFS, the requests are addressed in the order they arrive in
the disk queue.
• Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is : 50
SSTF: Shortest Seek Time First
• In SSTF (Shortest Seek Time First), requests having shortest
seek time are executed first.
• So, the seek time of every request is calculated in advance in
the queue and then they are scheduled according to their
calculated seek time.
• As a result, the request near the disk arm will get executed first.
SSTF is certainly an improvement over FCFS as it decreases
the average response time and increases the throughput of
system.
Suppose the order of request is-
(82,170,43,140,24,16,190)
And current position of Read/Write head is :
50
So, total seek time:
=(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-
40)+(190-170)
=208
SCAN:
• In SCAN algorithm the disk arm moves into a particular
direction and services the requests coming in its path and after
reaching the end of disk, it reverses its direction and again
services the request arriving in its path. So, this algorithm works
as an elevator and hence also known as elevator algorithm.
• As a result, the requests at the midrange are serviced more and
those arriving behind the disk arm will have to wait.
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 value”.
Therefore, the seek time is calculated as:
=(199-50)+(199-16)
=332
Advantages:
•High throughput
•Low variance of response time
•Average response time
Disadvantages:
•Long waiting time for requests for
locations just visited by disk arm
CSCAN
• The disk arm instead of reversing its direction goes to the other
end of the disk and starts servicing the requests from there.
• So, the disk arm moves in a circular fashion and this algorithm
is also similar to SCAN algorithm and hence it is known as C-
SCAN (Circular SCAN).
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 value”.
Seek time is calculated as:
=(199-50)+(199-0)+(43-0)
=391
Advantages:
•Provides more uniform wait time
compared to SCAN
LOOK:
• It is similar to the SCAN disk scheduling algorithm except for
the difference that the disk arm in spite of 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.
• Thus it prevents the extra delay which occurred due to
unnecessary traversal to the 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, and it is also given that the disk arm should
move “towards the larger value”.
So, the seek time is calculated as:
=(190-50)+(190-16)
=314

More Related Content

Similar to fileallocationmethods1-220104151603.pdf

Unit6pdf__2024_03_ 27_08_31_05.pdf
Unit6pdf__2024_03_          27_08_31_05.pdfUnit6pdf__2024_03_          27_08_31_05.pdf
Unit6pdf__2024_03_ 27_08_31_05.pdf
tejpatel0010
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
Geetha Kannan
 
Disk Management through the Computer Management
Disk Management through the Computer ManagementDisk Management through the Computer Management
Disk Management through the Computer Management
AnshGoyal32
 
OS@PPT.pdf
OS@PPT.pdfOS@PPT.pdf
OS@PPT.pdf
Niru82
 
Disk Scheduling
Disk SchedulingDisk Scheduling
Disk Scheduling
A29ShirleyDhawadkar
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
rajshreemuthiah
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and Deadlocks
Rohit Jain
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Dr. Loganathan R
 
Ch10
Ch10Ch10
Ch10
ushaindhu
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
NEERAJ BAGHEL
 
Kavi
KaviKavi
Kavi
KaviKavi
operating system
operating systemoperating system
operating system
subashini mari
 
Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02
Seshu Chakravarthy
 
Class notesfeb27
Class notesfeb27Class notesfeb27
Class notesfeb27
Indian Oil Corporation
 
Os7
Os7Os7
Disk scheduling
Disk schedulingDisk scheduling
Disk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemDisk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating System
Meghaj Mallick
 
CH10.pdf
CH10.pdfCH10.pdf
CH10.pdf
ImranKhan880955
 
Measures of query cost
Measures of query costMeasures of query cost
Measures of query cost
Hitesh Mohapatra
 

Similar to fileallocationmethods1-220104151603.pdf (20)

Unit6pdf__2024_03_ 27_08_31_05.pdf
Unit6pdf__2024_03_          27_08_31_05.pdfUnit6pdf__2024_03_          27_08_31_05.pdf
Unit6pdf__2024_03_ 27_08_31_05.pdf
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Disk Management through the Computer Management
Disk Management through the Computer ManagementDisk Management through the Computer Management
Disk Management through the Computer Management
 
OS@PPT.pdf
OS@PPT.pdfOS@PPT.pdf
OS@PPT.pdf
 
Disk Scheduling
Disk SchedulingDisk Scheduling
Disk Scheduling
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and Deadlocks
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Ch10
Ch10Ch10
Ch10
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Kavi
KaviKavi
Kavi
 
Kavi
KaviKavi
Kavi
 
operating system
operating systemoperating system
operating system
 
Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02
 
Class notesfeb27
Class notesfeb27Class notesfeb27
Class notesfeb27
 
Os7
Os7Os7
Os7
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Disk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemDisk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating System
 
CH10.pdf
CH10.pdfCH10.pdf
CH10.pdf
 
Measures of query cost
Measures of query costMeasures of query cost
Measures of query cost
 

Recently uploaded

Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
TechSoup
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
IsmaelVazquez38
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 

fileallocationmethods1-220104151603.pdf

  • 1. File Allocation Methods Dr.G.Jasmine Beulah Kristu Jayanti College, Bengaluru
  • 2. File Allocation Method • The allocation methods define how the files are stored in the disk blocks. There are three main disk space or file allocation methods. Contiguous Allocation Linked Allocation Indexed Allocation
  • 3. Contiguous Allocation • The directory entry for a file with contiguous allocation contains Address of starting block Length of the allocated portion.
  • 4. Advantages: •Both the Sequential and Direct Accesses are supported by this. For direct access, the address of the kth block of the file which starts at block b can easily be obtained as (b+k). •This is extremely fast since the number of seeks are minimal because of contiguous allocation of file blocks Disadvantages: •This method suffers from both internal and external fragmentation. This makes it inefficient in terms of memory utilization. •Increasing file size is difficult because it depends on the availability of contiguous memory at a particular instance.
  • 5. Linked List Allocation • Each file is a linked list of disk blocks which need not be contiguous. The disk blocks can be scattered anywhere on the disk. • The directory entry contains a pointer to the starting and the ending file block. Each block contains a pointer to the next block occupied by the file.
  • 6. Advantages: •This is very flexible in terms of file size. File size can be increased easily since the system does not have to look for a contiguous chunk of memory. •This method does not suffer from external fragmentation. This makes it relatively better in terms of memory utilization. Disadvantages: •Because the file blocks are distributed randomly on the disk, a large number of seeks are needed to access every block individually. This makes linked allocation slower. •It does not support random or direct access. We can not directly access the blocks of a file. A block k of a file can be accessed by traversing k blocks sequentially (sequential access ) from the starting block of the file via block pointers. •Pointers required in the linked
  • 7. Indexed Allocation • A special block known as the Index block contains the pointers to all the blocks occupied by a file. • Each file has its own index block. The ith entry in the index block contains the disk address of the ith file block. • The directory entry contains the address of the index block as shown in the image:
  • 8. Advantages: •This supports direct access to the blocks occupied by the file and therefore provides fast access to the file blocks. •It overcomes the problem of external fragmentation. Disadvantages: •The pointer overhead for indexed allocation is greater than 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. However, in linked allocation we lose the space of only 1 pointer per block.
  • 9. Disk Scheduling Algorithms • Disk scheduling is done by operating systems to schedule I/O requests arriving for the disk. Disk scheduling is also known as I/O scheduling. • Multiple I/O requests may arrive by different processes and only one I/O request can be served at a time by the disk controller. Thus other I/O requests need to wait in the waiting queue and need to be scheduled. • Two or more request may be far from each other so can result in greater disk arm movement. • Hard drives are one of the slowest parts of the computer system and thus need to be accessed in an efficient manner.
  • 10. • Seek Time:Seek time is the time taken to locate the disk arm to a specified track where the data is to be read or write. So the disk scheduling algorithm that gives minimum average seek time is better. • Rotational Latency: Rotational Latency is the time taken by the desired sector of disk to rotate into a position so that it can access the read/write heads. So the disk scheduling algorithm that gives minimum rotational latency is better. • Transfer Time: Transfer time is the time to transfer the data. It depends on the rotating speed of the disk and number of bytes to be transferred.
  • 11. • Disk Response Time •Disk Access Time
  • 12. Disk Scheduling Algorithms - FCFS In FCFS, the requests are addressed in the order they arrive in the disk queue. • Suppose the order of request is- (82,170,43,140,24,16,190) And current position of Read/Write head is : 50
  • 13. SSTF: Shortest Seek Time First • In SSTF (Shortest Seek Time First), requests having shortest seek time are executed first. • So, the seek time of every request is calculated in advance in the queue and then they are scheduled according to their calculated seek time. • As a result, the request near the disk arm will get executed first. SSTF is certainly an improvement over FCFS as it decreases the average response time and increases the throughput of system.
  • 14. Suppose the order of request is- (82,170,43,140,24,16,190) And current position of Read/Write head is : 50 So, total seek time: =(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170- 40)+(190-170) =208
  • 15. SCAN: • In SCAN algorithm the disk arm moves into a particular direction and services the requests coming in its path and after reaching the end of disk, it reverses its direction and again services the request arriving in its path. So, this algorithm works as an elevator and hence also known as elevator algorithm. • As a result, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait.
  • 16. 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 value”. Therefore, the seek time is calculated as: =(199-50)+(199-16) =332 Advantages: •High throughput •Low variance of response time •Average response time Disadvantages: •Long waiting time for requests for locations just visited by disk arm
  • 17. CSCAN • The disk arm instead of reversing its direction goes to the other end of the disk and starts servicing the requests from there. • So, the disk arm moves in a circular fashion and this algorithm is also similar to SCAN algorithm and hence it is known as C- SCAN (Circular SCAN).
  • 18. 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 value”. Seek time is calculated as: =(199-50)+(199-0)+(43-0) =391 Advantages: •Provides more uniform wait time compared to SCAN
  • 19. LOOK: • It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of 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. • Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of the disk.
  • 20. 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 value”. So, the seek time is calculated as: =(190-50)+(190-16) =314