IPC/Shared memory automatic freeing ?

Eric Estievenart (eric@via.ecp.fr)
Wed, 17 Mar 1999 01:29:54 +0100 (CET)


Hi there !

Working and debugging a small proggy using IPC shared memory
with some friends, we had some memory segments not freed
when it didn't finish normally.
Anyway, it is easy to free them using ipcrm, but we thought
that the management of these precious resources could be eased
and improved a bit for the Linux Community.

Of course, I do not propose to free the pages as soon as the
number of attachements reaches zero (damned developpers that
detach and exit before a child has attached hisself to the
segment... ;), but we could reuse the resources if they are
not attached and unused for some amount of time (using
the shm_ctime info).

Do you think that it is worth doing it (it would take me
at most one hour doing it...) ?

If you think so, which of these algorithms do you prefer :

On a request, if no blocks are free,

I. take the first one that is older than a defined
amount of time and not attached (or return an error)

II. take the one that is the older and not attached, if
it is older than the delay (or return an error)

I also have some others questions that would help
me doing the most accurate work (and patch) :

- What do you suggest for the amount of time ?
I can't say if it would be better to use a delay of
1 second, 10 minutes, less or more
(but waiting for hours is probably bad...)
-> My guess is around 10-30 seconds

- Should this delay be accessible through a syscall or the
proc filesystem ?

- Do you consider this code as critical ?
(I guess not, because no process would make
billions of calls)
So tell me if you want the better optimizations in
the loops...

Thank you for any piece of advice

Eric Estievenart

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/