Re: [PHP4BETA] sapi_xxx_module()

From: Date: Sat, 28 Aug 1999 11:34:43 +0000
Subject: Re: [PHP4BETA] sapi_xxx_module()
References: 1 2 3 4 5 6 7 8  Groups: php.version4 
Request: Send a blank email to php-version4+get-3806@lists.php.net to get a copy of this message
On Sat, Aug 28, 1999 at 02:20:04PM +0200, Zeev Suraski wrote: > At 12:58 28/08/99 , Sascha Schumann wrote: > > > A shared memory pool in a multiprocess environment is almost completely > > > useless. It's useless since you would want to use it for shared > > resources, > > > but since you don't control these resources, you can't do anything with > > > this shared pool. The most you'd be able to share through this pool is > > > zval's or the likes, and I doubt it's worth messing with shared memory for > > > those. > > > > Please define "control." > > Well, 'use' would be more accurate. For example, if you allocate an SQL > link, which is typically some pointer to a connection structure, that > pointer is meaningless in any process except for the process that created > it. You can't create it in shared memory (it's in the library code), and > thus, you cannot share that link in between processes. Yes. We never intended to do that. Let me clarify what I have in mind and what the mm module currently does. The mm module for session support stores the following structure in shared memory: typedef struct ps_sd { struct ps_sd *next, *prev; time_t ctime; char *key; void *data; size_t datalen; } ps_sd; All memory referenced in this structure is allocated through mm and thus only shared memory is referenced throughout the whole module. Therefore we don't run into the problems you described above. What we need is an elegant way to initialize the following structure on program startup, before the server forks/creates threads. typedef struct { MM *mm; ps_sd **hash; } ps_mm; mm is the MM pool from which hash is allocated (the module uses a fast hash algorithm + external chaining to handle the session data). On every access to the shared memory pool, the module performs proper locking. Therefore we also don't have problems with multiple threads/processes accessing the shared memory concurrently. mm is supposed to only provide shared memory to related process, so we cannot use any form of IPC to reference the shared memory. -- Regards, Sascha Schumann Consultant

« previous php.version4 (#3806) next »