Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of size 115 KB, 500 KB, 358 KB, 200 KB, and 375 KB (in order)? Rank the algorithms in terms of how efficiently they use memory.

Respuesta :

Answer:

In terms of efficient use of memory: Best-fit is the best (it still have a free memory space of 777KB and all process is completely assigned) followed by First-fit (which have free space of 777KB but available in smaller partition) and then worst-fit (which have free space of 1152KB but a process cannot be assigned). See the detail in the explanation section.

Explanation:

We have six free memory partition: 300KB (F1), 600KB (F2), 350KB (F3), 200KB (F4), 750KB (F5) and 125KB (F6) (in order).

Using First-fit

First-fit means you assign the first available memory that can fit a process to it.

  • 115KB will fit into the first partition. So, F1 will have a remaining free space of 185KB (300 - 115).
  • 500KB will fit into the second partition. So, F2 will have a remaining free space of  100KB (600 - 500)
  • 358KB will fit into the fifth partition. So, F5 will have a remaining free space of 392KB (750 - 358)
  • 200KB will fit into the third partition. So, F3 will have a remaining free space of 150KB (350 -200)
  • 375KB will fit into the remaining partition of F5. So, F5 will a remaining free space of 17KB (392 - 375)

Using Best-fit

Best-fit means you assign the best memory available that can fit a process to the process.

  • 115KB will best fit into the last partition (F6). So, F6 will now have a free remaining space of 10KB (125 - 115)
  • 500KB will best fit into second partition. So, F2 will now have a free remaining space of 100KB (600 - 500)
  • 358KB will best fit into the fifth partition. So, F5 will now have a free remaining space of 392KB (750 - 358)
  • 200KB will best fit into the fourth partition and it will occupy the entire space with no remaining space (200 - 200 = 0)
  • 375KB will best fit into the remaining space of the fifth partition. So, F5 will now have a free space of 17KB (392 - 375)

Using Worst-fit

Worst-fit means that you assign the largest available memory space to a process.

  • 115KB will be fitted into the fifth partition. So, F5 will now have a free remaining space of 635KB (750 - 115)
  • 500KB will be fitted also into the remaining space of the fifth partition. So, F5 will now have a free remaining space of 135KB (635 - 500)
  • 358KB will be fitted into the second partition. So, F2 will now have a free remaining space of 242KB (600 - 358)
  • 200KB will be fitted into the third partition. So, F3 will now have a free remaining space of 150KB (350 - 200)
  • 375KB will not be assigned to any available memory space because none of the available space can contain the 375KB process.
Lanuel

Based on the efficient use of memory, the algorithm are ranked as:

  1. Best fit.
  2. First fit.
  3. Worst fit.

Given the following data:

  • M1 = 300 KB.
  • M2 = 600 KB.
  • M3 = 350 KB.
  • M4 = 200 KB.
  • M5 = 750 KB.
  • M6 125 KB.
  • P1 = 115 KB.
  • P2 = 500 KB.
  • P3 = 358 KB.
  • P4 = 200 KB.
  • P5 = 375 KB.

What is a first-fit algorithm?

A first-fit algorithm can be defined as the simplest technique of allocating memory block to processes by assigning the first available memory.

For P1 with a memory size of 115 KB, it would fit into the first memory partition.

[tex]M_1=300-115\\\\M_1=185\;KB[/tex]

For P2 with a memory size of 600 KB, it would fit into the second memory partition.

[tex]M_2=600-500\\\\M_2=100\;KB[/tex]

For P3 with a memory size of 358 KB, it would fit into the fifth memory partition.

[tex]M_5=750-358\\\\M_5=392\;KB[/tex]

For P4 with a memory size of 200 KB, it would fit into the third memory partition.

[tex]M_3=350-200\\\\M_3=150\;KB[/tex]

For P5 with a memory size of 375 KB, it would fit into the remaining fifth memory partition.

[tex]M_5=392 - 375\\\\M_5=17\;KB[/tex]

What is a best-fit algorithm?

A best-fit algorithm can be defined as the technique of allocating memory block to processes by assigning the smallest partition size that can store the process.

For P1 with a memory size of 115 KB, it would best fit into the sixth memory partition.

[tex]M_6=125-115\\\\M_6=10\;KB[/tex]

For P2 with a memory size of 600 KB, it would best fit into the second memory partition.

[tex]M_2=600-500\\\\M_2=100\;KB[/tex]

For P3 with a memory size of 358 KB, it would best fit into the fifth memory partition.

[tex]M_5=750-358\\\\M_5=392\;KB[/tex]

For P4 with a memory size of 200 KB, it would best fit into the fourth memory partition.

[tex]M_3=200-200\\\\M_3=0\;KB[/tex]

For P5 with a memory size of 375 KB, it would best fit into the remaining fifth memory partition.

[tex]M_5=392 - 375\\\\M_5=17\;KB[/tex]

What is a worst-fit algorithm?

A worst-fit algorithm can be defined as the technique of allocating memory block to processes by assigning the largest partition size that can store the process.

For P1 with a memory size of 115 KB, it would fit into the fifth memory partition.

[tex]M_6=750-125\\\\M_6=635\;KB[/tex]

For P2 with a memory size of 500 KB, it would fit into the remaining fifth memory partition.

[tex]M_5=635 - 500\\\\M_5=135\;KB[/tex]

For P3 with a memory size of 358 KB, it would fit into the second memory partition.

[tex]M_5=600 - 358\\\\M_5=242\;KB[/tex]

For P4 with a memory size of 200 KB, it would fit into the third memory partition.

[tex]M_3=350 - 200\\\\M_3=150\;KB[/tex]

For P5 with a memory size of 375 KB, it would best fit into any of the memory partition that is available.

Read more on memory partition here: https://brainly.com/question/24593920

Q&A Education