Re: Buffers

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 08/19/97

On Wed, 20 Aug 1997, Jeremy Elson wrote:

>Small buffers should probably remain as they are (static buffers
>associated with the descriptor) because it'd just be a waste of
>resources to constantly be allocating them and deallocating them --
>the only memory savings would be for idle players.

I agree with that point.

>Large buffers, on the other hand, should probably be part of the new
>buffer system.  No persistent buffers are needed (assuming I'm
>understanding your concept of "persistent" from reading the buffer

Persistant means it will never time out, basically.  Although an explicit
free_buffer() call will get rid of it with a little complaining.

>patch.)  Large buffers are used frequently enough that some of them
>will never time out, so the system will automatically settle on some
>number that are essentially "persistent".

And with tweakable timeout for those who want more control.

>This brings us to an interesting point: When a buffer is requested,
>the request should be fulfilled by the (large enough) buffer most
>recently used.  Otherwise, successive buffer requests will cycle

In a nutshell, if we just freed an 8192 byte buffer and someone requests
less than that, we give that to them?  We might run into more of a problem
with running out of appropriate sized buffers that way.  do_users and
do_who absolutely _eat_ buffers for lunch and they are frequently used.

>through all available buffers and none will ever time out.  Letting
>unused buffers age can be easily assured by prepending freed buffers
>to the free list and then taking the first one that appears in the
>list when one is requested.

Currently I keep them sorted ascending to find the first free one that
fits.  If no one uses a 512 byte buffer in awhile, it'll be freed and 1024
byte buffers will be used (assuming it's not persistant).

I do think I could get by with less persistant buffers though...

-- | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/08/00 PST