You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Graham Leggett <mi...@sharp.fm> on 2001/08/12 13:32:07 UTC

Handholding: shared memory

Hi all,

I need a bit of handholding with the allocation of shared memory
segments in APR. A couple of questions:

- Is the reqsize parameter in apr_shm_init() optional? In other words
does this follow the behavior of the MM library where if the value is
set to zero it defaults to the maximum possible size with a soft maximum
of 64MB?

- Is the setting of the shared memory segment name using
apr_shm_name_get() and apr_shm_name_set() optional or mandatory?

I would like to use apr_shm_name_set() to give a particular segement a
name, but it's not clear in the APR header docs as to whether this is
possible on all platforms, or whether on some platforms only anonymous
shared memory is possible.

Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."

Re: Handholding: shared memory

Posted by Ryan Bloom <rb...@covalent.net>.
On Monday 13 August 2001 14:10, Ian Holsman wrote:
> On 13 Aug 2001 13:59:40 -0700, Justin Erenkrantz wrote:
> > On Mon, Aug 13, 2001 at 10:56:55AM -0700, Ryan Bloom wrote:
> > > ++1!  Please commit ASAP.
> >
> > Should I?  It is ready for commit.  It may make the build a bit unstable
> > until the kinks are worked out.  It'll just ignore the MM directory
> > until we figure out how to deal with the old directory.
> >
> > But, it serves pages under Solaris and Linux though.  =-)  Restarts look
> > okay as well.  -- justin
>
> shouldn't this wait until we roll out a beta/GA?
> MM works now, and is stable.
> unless this new code is significantly faster or more functional it
> should not replace MM. (it could be enabled like --enable-sms of course)

No, this shouldn't wait.  MM is very large, and is much more complex than we
need.  We also have hacks on top of MM to make it work inside of APR.

The sooner we get the MM library out of our hair, and get the new cleaner
code in, then better off we are.

Add to that, the fact that we haven't updated MM because of our own hacks that
we added, means that we are missing potential security and performance
improvements.

Ryan

______________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Re: Handholding: shared memory

Posted by "Roy T. Fielding" <fi...@ebuilt.com>.
> shouldn't this wait until we roll out a beta/GA?

No.  MM must be removed before GA or it cannot ever be removed.
2.0.23 can go out as beta right now.  This should be committed right now
so that I can remove MM and cut our configure processing time in half.

....Roy


Re: Handholding: shared memory

Posted by Ian Holsman <ia...@cnet.com>.
On 13 Aug 2001 13:59:40 -0700, Justin Erenkrantz wrote:
> On Mon, Aug 13, 2001 at 10:56:55AM -0700, Ryan Bloom wrote:
> > 
> > ++1!  Please commit ASAP.
> 
> Should I?  It is ready for commit.  It may make the build a bit unstable
> until the kinks are worked out.  It'll just ignore the MM directory
> until we figure out how to deal with the old directory.
> 
> But, it serves pages under Solaris and Linux though.  =-)  Restarts look
> okay as well.  -- justin

shouldn't this wait until we roll out a beta/GA?
MM works now, and is stable.
unless this new code is significantly faster or more functional it 
should not replace MM. (it could be enabled like --enable-sms of course)


-- 
Ian Holsman          IanH@cnet.com
Performance Measurement & Analysis
CNET Networks   -   (415) 364-8608


Re: Handholding: shared memory

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Mon, Aug 13, 2001 at 10:56:55AM -0700, Ryan Bloom wrote:
> 
> ++1!  Please commit ASAP.

Should I?  It is ready for commit.  It may make the build a bit unstable
until the kinks are worked out.  It'll just ignore the MM directory
until we figure out how to deal with the old directory.

But, it serves pages under Solaris and Linux though.  =-)  Restarts look
okay as well.  -- justin


Re: Handholding: shared memory

Posted by Ryan Bloom <rb...@covalent.net>.
++1!  Please commit ASAP.

Ryan

On Monday 13 August 2001 10:35, Justin Erenkrantz wrote:
> On Sun, Aug 12, 2001 at 09:00:37AM -0700, Ryan Bloom wrote:
> > Unix shared memory is all anonymous, it must be created by the parent,
> > and inherited by the child.  Again, when somebody has the time/energy to
> > fix Unix shared memory, this will change.
>
> FWIW, I have an implementation in my tree that doesn't use MM.  The
> only problem is that you can't "free" the individual memory segments
> you retrieve from the alloc call.  You can only free the entire
> segment (the free call is essentially a no-op).  If this is worth
> having, I can post/commit the patch.  It should be equivalent in all
> other aspects to MM.  (Based off the MM code, but I ripped out
> everything we didn't need and I cleaned up the code...)
>
> I don't believe we need to be able to free each block returned from the
> shmem segment, so I don't think this is a big deal though.  Thoughts?
>
> I don't think we need to have memory management in shmem...  -- justin

-- 

______________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Re: Handholding: shared memory

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Sun, Aug 12, 2001 at 09:00:37AM -0700, Ryan Bloom wrote:
> Unix shared memory is all anonymous, it must be created by the parent, and
> inherited by the child.  Again, when somebody has the time/energy to fix
> Unix shared memory, this will change.

FWIW, I have an implementation in my tree that doesn't use MM.  The 
only problem is that you can't "free" the individual memory segments 
you retrieve from the alloc call.  You can only free the entire 
segment (the free call is essentially a no-op).  If this is worth 
having, I can post/commit the patch.  It should be equivalent in all
other aspects to MM.  (Based off the MM code, but I ripped out 
everything we didn't need and I cleaned up the code...)

I don't believe we need to be able to free each block returned from the
shmem segment, so I don't think this is a big deal though.  Thoughts?

I don't think we need to have memory management in shmem...  -- justin


Re: Handholding: shared memory

Posted by Ryan Bloom <rb...@covalent.net>.
On Sunday 12 August 2001 04:32, Graham Leggett wrote:
> Hi all,
>
> I need a bit of handholding with the allocation of shared memory
> segments in APR. A couple of questions:
>
> - Is the reqsize parameter in apr_shm_init() optional? In other words
> does this follow the behavior of the MM library where if the value is
> set to zero it defaults to the maximum possible size with a soft maximum
> of 64MB?

That's how it works on Unix, but it won't work that way anyplace else.  It is
also unlikely to continue to work that way on Unix.  A lot of people are
talking about re-writing the shared memory code on Unix.

> - Is the setting of the shared memory segment name using
> apr_shm_name_get() and apr_shm_name_set() optional or mandatory?

Unix shared memory is all anonymous, it must be created by the parent, and
inherited by the child.  Again, when somebody has the time/energy to fix
Unix shared memory, this will change.

> I would like to use apr_shm_name_set() to give a particular segement a
> name, but it's not clear in the APR header docs as to whether this is
> possible on all platforms, or whether on some platforms only anonymous
> shared memory is possible.

It's not possible on all platforms, yet.

Ryan
______________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Re: Handholding: shared memory

Posted by Ian Holsman <ia...@cnet.com>.
Graham Leggett wrote:

>Hi all,
>
>I need a bit of handholding with the allocation of shared memory
>segments in APR. A couple of questions:
>
>- Is the reqsize parameter in apr_shm_init() optional? In other words
>does this follow the behavior of the MM library where if the value is
>set to zero it defaults to the maximum possible size with a soft maximum
>of 64MB?
>
>- Is the setting of the shared memory segment name using
>apr_shm_name_get() and apr_shm_name_set() optional or mandatory?
>
I don't these 2 do anything on unix.
infact I think shmem on unix is all anonymous (at the moment)

>
>I would like to use apr_shm_name_set() to give a particular segement a
>name, but it's not clear in the APR header docs as to whether this is
>possible on all platforms, or whether on some platforms only anonymous
>shared memory is possible.
>
only anon.
the parent needs to create it, and the handle gets passed down to it's 
children.

>
>Regards,
>Graham
>--
>-----------------------------------------
>minfrin@sharp.fm		"There's a moon
>					over Bourbon Street
>						tonight..."
>