[comp.unix.questions] Cost of shmat, shmdt

koerber.sin@sni.de (Mathias Koerber) (06/11/91)

I'd like to know how costly (in terms of performance) the shmat and shmdt
operations are. (This is Unix SysV.3).

My problem is that I'm using the shm a lot, but I have problems using
malloc because my attched shared memory segment is in the way. I already
pushed the shm far back, but I can see cases where that is not enough.

Even worse, functions like printf are doing their own malloc, so I can't
really control how much memory is used when I attch my shm.

So my solution is to keep the shm detached, and only attach it to
access it, and then detach it again. 

But will this really hit my performance badly?

I'm going to do some tests myself, but I'd like to know some more from
better informed parties.

Thx alot


Mathias Koerber  | S iemens             | EUnet: koerber.sin@sni.de
2 Kallang Sector | N ixdorf             | USA:   koerber.sin@sni-usa.com 
S'pore 1344      | I nformation Systems | Tel: +65/7402852 | Fax: +65/7402834
Thank ME it's Friday, GOD said and created the weekend|#include <disclaimer.h>