Messages in this thread |  | | Date | Thu, 1 Aug 1996 16:50:20 -0400 (EDT) | From | DUPRE Christophe <> | Subject | Re: Kernel profile |
| |
On Wed, 31 Jul 1996, Gonzalo Tornaria wrote:
> DUPRE Christophe <duprec@jsp.umontreal.ca> wrote: > > > Excuse for talking before checking the code, but I think two > > lists would be simpler and probably faster... > > > With one list, your "scavenger" need to walk the list, and when > > it finds a non-zeroed structure, it needs to zero it then move it > > to the front of the list. If you have two lists, scavenger only > > takes the first of the non-zeroed list, zero it then puts it at > > the front of the second list, no walking necessary. > > > Secondly, with only one list, you need a way to check if the > > structure has been zeroed or not - either add a flag to the > > structure, or re-use an already there flag... Either way, it's a > > flag that needs to be checked then cleared when a process needs > > to allocate a structure. > > > So the one-list solution might use a bit more memory (though not > > much), add a flag clear, and slow down the "scavenger" in it's > > job because it needs to walk the list. > > You can do with one list. Take zeroed structures from the head, and put used > non-zeroed structures at the end. You just need a pointer to the first > non-zeroed structure in the list, so the "scavenger" knows where to start > zeroing, and you can check whether you are out of zeroed structures. Or you can > add non-zeroed after the first non-zeroed (so you don't need a pointer to the > end).
Excuse me, but what you are describing is a two-lists solution, with the last element of the first list pointing to the first element of the second list, a link that will never be followed anyway because we never walk the list...
Christophe Dupre Universite de Montreal Internet: duprec@jsp.umontreal.ca Qc, Canada Montreal, Qc, Canada "Nous ne sommes pas libres de ne pas etre libres, nous sommes obliges de l'etre" - Fernando Savater
-- Geek Code 2.1 -- GCS d-- H+ s:++ g+ !p au-* a19 w+ v+ C++(+++) UIL++>+++ P+>++ L++ 3- E---- N++ K W- M- V-- Y+ t++ 5++ !j R+ G- tv b++ D+ e+ u** h->++ f+ r++ n---(----) y+
#include <disclaimer.h>
|  |