Skip to main content
Tweeted twitter.com/#!/StackCompSci/status/392811338084651008

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

------------------------------------------------------------
|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |
------------------------------------------------------------
----0---------1---------2---------3---------4---------5-----

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:

------------------------------------------------------------
|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |
------------------------------------------------------------
----0---------1---------2---------3---------4---------5-----

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

added 76 characters in body
Source Link
Raphael
  • 72.9k
  • 30
  • 181
  • 393

So I have a problem understanding how the worst-fit protocol for memory allocationworst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

Left out important information regarding hypothetical scenario.
Source Link
BrotherJack
  • 1.1k
  • 1
  • 10
  • 23

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following allocationblocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one l leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following allocation (where 'O' stands for occupied block and 'E' stands for empty block):


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one l leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility.

For example, say you have the following blocks (where 'O' stands for occupied block and 'E' stands for empty block) and are to allocate 10 MB via the worst-fit algorithm:


|10 MB O | 40 MB E | 10 MB O | 20 MB E | 30 MB E | 10 MB O |

-------0---------------1----------------2----------------3----------------4--------------5

My question is does the worst-fit algorithm select block one leaving behind a 30 MB hole in block 1, or does it select block 3 leaving behind a cumulative 40 MB hole between blocks 3 and 4?

Source Link
BrotherJack
  • 1.1k
  • 1
  • 10
  • 23
Loading