SlideShare a Scribd company logo
1 of 21
3.2 Variable Partitioning
• There are three algorithms for searching the list of free blocks
for a specific amount of memory.
– First Fit
– Best Fit
– Worst Fit
1
first fit
First Fit : Allocate the first free block that is
large enough for the new process.
This is a fast algorithm.
2
first fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
Initial memory
mapping
3
first fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
P4 of 3KB
arrives
4
first fit
OS
P1 12 KB
P4 3 KB
<FREE> 7 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
P4 of 3KB
loaded here by
FIRST FIT
5
first fit
OS
P1 12 KB
P4 3 KB
<FREE> 7 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
P5 of 15KB
arrives
6
first fit
OS
P1 12 KB
P4 3 KB
<FREE> 7 KB
P2 20 KB
P5 15 KB
<FREE> 1 KB
P3 6 KB
<FREE> 4 KB
P5 of 15 KB
loaded here by
FIRST FIT
7
Best fit
Best Fit : Allocate the smallest block among those that are
large enough for the new process.
In this method, the OS has to search the entire list, or it can
keep it sorted and stop when it hits an entry which has a size
larger than the size of new process.
 This algorithm produces the smallest left over block.
However, it requires more time for searching all the list or
sorting it
If sorting is used, merging the area released when a process
terminates to neighboring free blocks, becomes complicated.
8
best fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
Initial memory
mapping
9
best fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
P4 of 3KB
arrives
10
best fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
P4 3 KB
<FREE> 1 KB
P4 of 3KB
loaded here by
BEST FIT
11
best fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
P4 3 KB
<FREE> 1 KB
P5 of 15KB
arrives
12
best fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
P5 15 KB
<FREE> 1 KB
P3 6 KB
P4 3 KB
<FREE> 1 KB
P5 of 15 KB
loaded here by
BEST FIT
13
worst fit
Worst Fit : Allocate the largest block among those that are
large enough for the new process.
Again a search of the entire list or sorting it is needed.
This algorithm produces the largest over block.
14
worst fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
Initial memory
mapping
15
worst fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
<FREE> 16 KB
P3 6 KB
<FREE> 4 KB
P4 of 3KB
arrives
16
worst fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
P4 3 KB
<FREE> 13 KB
P3 6 KB
<FREE> 4 KB
P4 of 3KB
Loaded here by
WORST FIT
17
worst fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
P4 3 KB
<FREE> 13 KB
P3 6 KB
<FREE> 4 KB
No place to load
P5 of 15K
18
worst fit
OS
P1 12 KB
<FREE> 10 KB
P2 20 KB
P4 3 KB
<FREE> 13 KB
P3 6 KB
<FREE> 4 KB
No place to load
P5 of 15K
19
• 1. Given five memory partitions of 100Kb, 500Kb, 200Kb, 300Kb, 600Kb (in order), how would the
first-fit, best-fit, and worst-fit algorithms place processes of 212 Kb, 417 Kb, 112 Kb, and 426 Kb (in
order)? Which algorithm makes the most efficient use of memory?
• First-fit:
212K is put in 500K partition
417K is put in 600K partition
112K is put in 288K partition (new partition 288K = 500K - 212K)
426K must wait
• Best-fit:
212K is put in 300K partition
417K is put in 500K partition
112K is put in 200K partition
426K is put in 600K partition
• Worst-fit:
212K is put in 600K partition
417K is put in 500K partition
112K is put in 388K partition
426K must wait
• In this example, best-fit turns out to be the best.
212,417,112,426
100 500 200 300 600

More Related Content

Similar to First Best and Worst Fit.pptx

Some analysis of BlueStore and RocksDB
Some analysis of BlueStore and RocksDBSome analysis of BlueStore and RocksDB
Some analysis of BlueStore and RocksDBXiao Yan Li
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceMind The Firebird
 
3.INTEL.Optane_on_ceph_v2.pdf
3.INTEL.Optane_on_ceph_v2.pdf3.INTEL.Optane_on_ceph_v2.pdf
3.INTEL.Optane_on_ceph_v2.pdfhellobank1
 
Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...Danielle Womboldt
 
Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...Ceph Community
 
Maximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceMaximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceAmazon Web Services
 
Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...
Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...
Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...Amazon Web Services
 
Raidz on-disk format vs. small blocks
Raidz on-disk format vs. small blocksRaidz on-disk format vs. small blocks
Raidz on-disk format vs. small blocksJoyent
 
Understanding the impact of Linux scheduler on your application
Understanding the impact of Linux scheduler on your applicationUnderstanding the impact of Linux scheduler on your application
Understanding the impact of Linux scheduler on your applicationAtish Patra
 
Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberYing Zheng
 
Testing Persistent Storage Performance in Kubernetes with Sherlock
Testing Persistent Storage Performance in Kubernetes with SherlockTesting Persistent Storage Performance in Kubernetes with Sherlock
Testing Persistent Storage Performance in Kubernetes with SherlockScyllaDB
 
AWS Blackbelt NINJA Dojo – Dean Samuels
AWS Blackbelt NINJA Dojo – Dean SamuelsAWS Blackbelt NINJA Dojo – Dean Samuels
AWS Blackbelt NINJA Dojo – Dean SamuelsAmazon Web Services
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersBrendan Gregg
 
Accelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket CacheAccelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket CacheNicolas Poggi
 
Shipping python project by docker
Shipping python project by dockerShipping python project by docker
Shipping python project by dockerWei-Ting Kuo
 
SDC20 ScaleFlux.pptx
SDC20 ScaleFlux.pptxSDC20 ScaleFlux.pptx
SDC20 ScaleFlux.pptxssuserabc741
 
Accelerating hbase with nvme and bucket cache
Accelerating hbase with nvme and bucket cacheAccelerating hbase with nvme and bucket cache
Accelerating hbase with nvme and bucket cacheDavid Grier
 

Similar to First Best and Worst Fit.pptx (20)

Some analysis of BlueStore and RocksDB
Some analysis of BlueStore and RocksDBSome analysis of BlueStore and RocksDB
Some analysis of BlueStore and RocksDB
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performance
 
3.INTEL.Optane_on_ceph_v2.pdf
3.INTEL.Optane_on_ceph_v2.pdf3.INTEL.Optane_on_ceph_v2.pdf
3.INTEL.Optane_on_ceph_v2.pdf
 
Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph Performance by Leveraging Intel Optane and...
 
Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...
Ceph Day Beijing - Optimizing Ceph performance by leveraging Intel Optane and...
 
Maximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceMaximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performance
 
Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...
Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...
Maximizing EC2 and Elastic Block Store Disk Performance (STG302) | AWS re:Inv...
 
Raidz on-disk format vs. small blocks
Raidz on-disk format vs. small blocksRaidz on-disk format vs. small blocks
Raidz on-disk format vs. small blocks
 
RAIDZ on-disk format vs. small blocks
RAIDZ on-disk format vs. small blocksRAIDZ on-disk format vs. small blocks
RAIDZ on-disk format vs. small blocks
 
MyRocks Deep Dive
MyRocks Deep DiveMyRocks Deep Dive
MyRocks Deep Dive
 
Understanding the impact of Linux scheduler on your application
Understanding the impact of Linux scheduler on your applicationUnderstanding the impact of Linux scheduler on your application
Understanding the impact of Linux scheduler on your application
 
Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at Uber
 
Testing Persistent Storage Performance in Kubernetes with Sherlock
Testing Persistent Storage Performance in Kubernetes with SherlockTesting Persistent Storage Performance in Kubernetes with Sherlock
Testing Persistent Storage Performance in Kubernetes with Sherlock
 
AWS Blackbelt NINJA Dojo – Dean Samuels
AWS Blackbelt NINJA Dojo – Dean SamuelsAWS Blackbelt NINJA Dojo – Dean Samuels
AWS Blackbelt NINJA Dojo – Dean Samuels
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF Superpowers
 
Accelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket CacheAccelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket Cache
 
Shipping python project by docker
Shipping python project by dockerShipping python project by docker
Shipping python project by docker
 
SDC20 ScaleFlux.pptx
SDC20 ScaleFlux.pptxSDC20 ScaleFlux.pptx
SDC20 ScaleFlux.pptx
 
Accelerating hbase with nvme and bucket cache
Accelerating hbase with nvme and bucket cacheAccelerating hbase with nvme and bucket cache
Accelerating hbase with nvme and bucket cache
 
AWS Blackbelt NINJA Dojo
AWS Blackbelt NINJA DojoAWS Blackbelt NINJA Dojo
AWS Blackbelt NINJA Dojo
 

More from Senthil Vit

Switching Problems.pdf
Switching Problems.pdfSwitching Problems.pdf
Switching Problems.pdfSenthil Vit
 
AsymptoticNotations.ppt
AsymptoticNotations.pptAsymptoticNotations.ppt
AsymptoticNotations.pptSenthil Vit
 
File Implementation Problem.pptx
File Implementation Problem.pptxFile Implementation Problem.pptx
File Implementation Problem.pptxSenthil Vit
 
Design Issues of an OS.ppt
Design Issues of an OS.pptDesign Issues of an OS.ppt
Design Issues of an OS.pptSenthil Vit
 
Operating Systems – Structuring Methods.pptx
Operating Systems – Structuring Methods.pptxOperating Systems – Structuring Methods.pptx
Operating Systems – Structuring Methods.pptxSenthil Vit
 
Virtualization.pptx
Virtualization.pptxVirtualization.pptx
Virtualization.pptxSenthil Vit
 
Traffic-Monitoring.ppt
Traffic-Monitoring.pptTraffic-Monitoring.ppt
Traffic-Monitoring.pptSenthil Vit
 
ALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROBALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROBSenthil Vit
 

More from Senthil Vit (14)

Switching Problems.pdf
Switching Problems.pdfSwitching Problems.pdf
Switching Problems.pdf
 
Big Oh.ppt
Big Oh.pptBig Oh.ppt
Big Oh.ppt
 
AsymptoticNotations.ppt
AsymptoticNotations.pptAsymptoticNotations.ppt
AsymptoticNotations.ppt
 
snort.ppt
snort.pptsnort.ppt
snort.ppt
 
File Implementation Problem.pptx
File Implementation Problem.pptxFile Implementation Problem.pptx
File Implementation Problem.pptx
 
Design Issues of an OS.ppt
Design Issues of an OS.pptDesign Issues of an OS.ppt
Design Issues of an OS.ppt
 
Operating Systems – Structuring Methods.pptx
Operating Systems – Structuring Methods.pptxOperating Systems – Structuring Methods.pptx
Operating Systems – Structuring Methods.pptx
 
deadlock.ppt
deadlock.pptdeadlock.ppt
deadlock.ppt
 
Virtualization.pptx
Virtualization.pptxVirtualization.pptx
Virtualization.pptx
 
Traffic-Monitoring.ppt
Traffic-Monitoring.pptTraffic-Monitoring.ppt
Traffic-Monitoring.ppt
 
Lect_2.pptx
Lect_2.pptxLect_2.pptx
Lect_2.pptx
 
6. Deadlock.ppt
6. Deadlock.ppt6. Deadlock.ppt
6. Deadlock.ppt
 
os4-2_cop.ppt
os4-2_cop.pptos4-2_cop.ppt
os4-2_cop.ppt
 
ALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROBALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROB
 

Recently uploaded

Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxhublikarsn
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Compressing and Sparsifying LLM in GenAI Applications
Compressing and Sparsifying LLM in GenAI ApplicationsCompressing and Sparsifying LLM in GenAI Applications
Compressing and Sparsifying LLM in GenAI ApplicationsMFatihSIRA
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information SystemsAnge Felix NSANZIYERA
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptjigup7320
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessorAshwiniTodkar4
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...ssuserdfc773
 
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...Payal Garg #K09
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 

Recently uploaded (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Compressing and Sparsifying LLM in GenAI Applications
Compressing and Sparsifying LLM in GenAI ApplicationsCompressing and Sparsifying LLM in GenAI Applications
Compressing and Sparsifying LLM in GenAI Applications
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information Systems
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 

First Best and Worst Fit.pptx

  • 1. 3.2 Variable Partitioning • There are three algorithms for searching the list of free blocks for a specific amount of memory. – First Fit – Best Fit – Worst Fit 1
  • 2. first fit First Fit : Allocate the first free block that is large enough for the new process. This is a fast algorithm. 2
  • 3. first fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB Initial memory mapping 3
  • 4. first fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB P4 of 3KB arrives 4
  • 5. first fit OS P1 12 KB P4 3 KB <FREE> 7 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB P4 of 3KB loaded here by FIRST FIT 5
  • 6. first fit OS P1 12 KB P4 3 KB <FREE> 7 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB P5 of 15KB arrives 6
  • 7. first fit OS P1 12 KB P4 3 KB <FREE> 7 KB P2 20 KB P5 15 KB <FREE> 1 KB P3 6 KB <FREE> 4 KB P5 of 15 KB loaded here by FIRST FIT 7
  • 8. Best fit Best Fit : Allocate the smallest block among those that are large enough for the new process. In this method, the OS has to search the entire list, or it can keep it sorted and stop when it hits an entry which has a size larger than the size of new process.  This algorithm produces the smallest left over block. However, it requires more time for searching all the list or sorting it If sorting is used, merging the area released when a process terminates to neighboring free blocks, becomes complicated. 8
  • 9. best fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB Initial memory mapping 9
  • 10. best fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB P4 of 3KB arrives 10
  • 11. best fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB P4 3 KB <FREE> 1 KB P4 of 3KB loaded here by BEST FIT 11
  • 12. best fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB P4 3 KB <FREE> 1 KB P5 of 15KB arrives 12
  • 13. best fit OS P1 12 KB <FREE> 10 KB P2 20 KB P5 15 KB <FREE> 1 KB P3 6 KB P4 3 KB <FREE> 1 KB P5 of 15 KB loaded here by BEST FIT 13
  • 14. worst fit Worst Fit : Allocate the largest block among those that are large enough for the new process. Again a search of the entire list or sorting it is needed. This algorithm produces the largest over block. 14
  • 15. worst fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB Initial memory mapping 15
  • 16. worst fit OS P1 12 KB <FREE> 10 KB P2 20 KB <FREE> 16 KB P3 6 KB <FREE> 4 KB P4 of 3KB arrives 16
  • 17. worst fit OS P1 12 KB <FREE> 10 KB P2 20 KB P4 3 KB <FREE> 13 KB P3 6 KB <FREE> 4 KB P4 of 3KB Loaded here by WORST FIT 17
  • 18. worst fit OS P1 12 KB <FREE> 10 KB P2 20 KB P4 3 KB <FREE> 13 KB P3 6 KB <FREE> 4 KB No place to load P5 of 15K 18
  • 19. worst fit OS P1 12 KB <FREE> 10 KB P2 20 KB P4 3 KB <FREE> 13 KB P3 6 KB <FREE> 4 KB No place to load P5 of 15K 19
  • 20. • 1. Given five memory partitions of 100Kb, 500Kb, 200Kb, 300Kb, 600Kb (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of 212 Kb, 417 Kb, 112 Kb, and 426 Kb (in order)? Which algorithm makes the most efficient use of memory? • First-fit: 212K is put in 500K partition 417K is put in 600K partition 112K is put in 288K partition (new partition 288K = 500K - 212K) 426K must wait • Best-fit: 212K is put in 300K partition 417K is put in 500K partition 112K is put in 200K partition 426K is put in 600K partition • Worst-fit: 212K is put in 600K partition 417K is put in 500K partition 112K is put in 388K partition 426K must wait • In this example, best-fit turns out to be the best.