>>>>> "CO" == Chas Owens <chas.ow...@gmail.com> writes:

  >> mmap is old (i used it over 20 years ago on sunos, way before linux even
  >> existed). you could use it for shared ram backed by disk as it used the
  >> vm for this.
  CO> snip

  CO> I never said it was new, just modern.  Lexical filehandles are modern,
  CO> but they are over ten years old at this point.  mmap has mostly
  CO> replaced shared memory and therefore is the modern alternative.

modern? for what definition of modern do you mean? again, i am talking c
and not perl. mmap is very old. i can't say which version of unix first
had it but i would bet BSD 4.0 or earlier. sunos was based on that.

  CO> snip
  >>  CO> You must serialize your data before you store it in shared memory as
  >>  CO> Perl won't just use it.  At that point it is just a matter of making
  >>  CO> the shared memory segment the right size.  And, as you can see for my
  >>  CO> example in an earlier email, there are modules that take care of that
  >>  CO> work for you.  I would have used IPC::SharedCache, but it failed its
  >>  CO> tests on my machine, so I dropped back a layer.  IPC::SharedCache
  >>  CO> takes care of the serialization step for you and provides a nice tied
  >>  CO> hash.
  >> 
  >> perl is another issue and i already mentioned you can't directly deal
  >> with memory since perl could realloc under you and screw up the
  >> mapping. serializing is another story but you could use pack/unpack if
  >> you wanted direct binary data. the format of the data is independent of
  >> the sharing.
  CO> snip

  CO> pack and unpack are just another form of serialization, so I am not
  CO> sure I understand your point (unless we are just saying the same
  CO> thing).

pack/unpack are not a form of serialization IMO. you can pack actual
addresses with the p/P formats. you can also directly access data via
offsets leaving gaps. both sides have to be extra careful with padding,
offsets, integer sizes, byte ordering (use network order), float formats
etc. it is very non-portable and should be best only used for access to
c level data structures. in any case this thread is way off topic for
the beginner's list and i think it is (and we) are exhausted.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to