Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

algorith for first fit

Status
Not open for further replies.

0

MIS
Apr 13, 2000
7
0
0
IE
Hi, <br>Ive got a project to do(below) and i really dont have a clue, any help would be greatly appriciated<br>Ken<br><br>Assume that a segmented memory management system maintains a circular free holelist. Develop an algorith for first fit. Ensure that it does not go in to an infinite loop if requested for space larger than it has.?????<br><br>
 
Ken, I'm not sure if this would be the right forum to get an answer to that question.&nbsp;&nbsp;Have you tried posting in some of the programming specific forums elsewhere on Tek-Tips?<br><br>From what your saying, it sounds like you've been given this as a Unix/Linux based programming assignment?&nbsp;&nbsp;From the question it sounds like it's also going to be written in C.<br><br>If you select the browse forums link at the top of the screen there is a &quot;Programmers&quot; link which in turn opens up a &quot;Languages&quot; link.&nbsp;&nbsp;There's a few different C/C++ forums that may be able to help you.<br><br>Saying that, though, my take on your project is that you've got a chunk of memory.&nbsp;&nbsp;Random parts of it will be used and your algorithm needs to be able to allocate an arbitrary amount of memory into the free blocks.&nbsp;&nbsp;And while doing it it's got to avoid getting stuck in a loop. :)<br><br>Hope this helps.
 
You might have a look at The Red Book - &quot;The Design of the Unix Operating System&quot;<br><br>Mike <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
This is not a question for this forum but...<br><br>You want to create a linked list. Each object on the list describes a single block of<br>free memory. You will need to track the starting address of the memory block & its<br>size. You may need to store other information depending on your exact needs.<br><br>Read through the list, checking the size you need against the size of the current <br>block.&nbsp;&nbsp;If you find a block whose size is equal to or greater than the size you need,<br>save the data you need about the block so you can use it. Then remove the block<br>from the linked list.<br><br>Newly freed blocks can be inserted in order of starting address. Contiguous <br>memory blocks should be consolidated into single large blocks as soon as possible.<br><br>This is discussed in a number of texts on memory management. You can also&nbsp;&nbsp;take a <br>look at the C code that ships with Linux.<br><br>Howard Shidlowsky<br><A HREF="mailto:hows@home.com">hows@home.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top