You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 1996/02/15 22:47:32 UTC

SYSV Shared Memory (Was: Re: vote status)

David Robinson wrote:
> 
> I have found a correspondant who knows enough about SysV-based shared memory
> to help me implement it.
> This won't happen until we get a 1.1 build. (Hint Hint)
> 

I've placed on ftp.apache.org in /httpd/patches/for_Apache_misc my
first rough-cut at using SYSV shared mem. It's called: shared_mem.patch

It's got some limitations due to the way it's implemented, but it's
working. It might be a good starting point.

This is what I wrote at the top of the patch:
-------
This patch file is a first cut attempt to implement SYSV shared-memory
for Apache. This patch assumes that the MMAP patch is installed and is,
in fact, against the apache_1.0.2_patched tree.

This patch works, but I have some reservations about it. Mainly, the
fact that we call shmat() and allow the kernel to select the address to
place the segment and we keep the segment attached/mapped at all times.
This means that all subsequant(?) brk/sbrk calls will fail, as they
will refuse to move past an attached segment :(

A coupla ideas to get around that:

   1) Just shmat() when needed and then detach. We can treat the
      shared segment as an external "file" in other words... This is
      ugly and not as clean as the mmap() method where we can simply
      write to scoreboard_image (this idea would be implemented as
      the scoreboard_image array and a pointer, scoreboard_shared,
      to a segment. When we change scoreboard_image, we attach
      scoreboard_shared, copy to the segment and then detach...

   2) Figure out a way to use the "give shmat() an actual address to
      use as the 2nd parameter in the system call"... I haven't
      been able to figure this out yet... I allocated a chunk of
      space and use a pointer to it as the value, but shmat() fails
      with an Invalid Parameter error... Maybe because the allocated
      space is < a segment size ????

    3) Before we call shmat(), call sbrk() and move 'end' "way up there"...
       Ugg.

-- 
Jim Jagielski  << jim@jaguNET.com >>   |      "That's a Smith & Wesson,
  **  jaguNET Access Services  **      |       and you've had your six" 
      Email: info@jaguNET.com          |             - James Bond
++    http://www.jaguNET.com/         +++      Voice/Fax: 410-931-7060       ++