quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gardner <jgard...@jonathangardner.net>
Subject Re: Using shared memory to do global persistence
Date Fri, 18 Jul 2003 20:24:52 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 18 July 2003 10:38, Gregory (Grisha) Trubetskoy wrote:
>
> Another complication with both shared memory and locks is that it is much
> more difficult to create them from within a child process because base
> addresses for same shm segment will differ. Therefore both locks and
> shared memory have to be specified in the Apache config (and not
> .htaccess).
>

I really don't like this constraint. It is causing too many problems. ;-)

I don't understand why having the shared memory in different places in each 
child's memory is bad.

Isn't shmid enough to get a specific segment of shared memory? Although the 
shmid will give you the same segment of memory, it will be mapped to 
different addresses in each process unless the process forked from a parent 
that already had shared it, or unless you are really, really lucky.

But specific places in the block of shared memory can be referenced uniquely 
and uniformly across all processes. For instance, we can use (shmid, address 
offset) to uniquely identify every shared object. To get the real address of 
the shared object, add the address offset to the shared memory's base 
address. The shared memory's base address may be different for each process, 
but the resulting address from this operation will always yield the same 
shared object.

The only part that I can see as a problem is the shared object -> shared 
object referencing. If we use an absolute address to describe this, then yes, 
this reference will fail unless we place the shared memory in the exact same 
address it was allocated in the original process. But can't we also modify 
the shared object so that it uses the same (shmid, address offset) that we 
use to find a shared object in the first place?

I have a limited understanding of all the issues here. Let me know if I am 
wrong.

- -- 
Jonathan Gardner <jgardner@jonathangardner.net>
(was jgardn@alumni.washington.edu)
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/GFeUWgwF3QvpWNwRAgC6AJwPm9x/yi8T8xrRk4b4LBD+68yTKwCfU1Xl
mcLDMOZ8iCgyVVceqyXiMgc=
=HS5E
-----END PGP SIGNATURE-----

Mime
View raw message