oiskuu,

Thanks for the response! Some points:

Hopefully, that was my point in the first place. I wanted to have an alternative that didn't require SysV ( or mmap ) operating system support. My 1st attempt didn't work since I used both buffered and unbuffered I/O.

That is how I'm hoping to use this technique. I have a pure-Perl database engine that is basically single user for writing and multi-user for reading within the same environment. It's very fast, but when any single DB within an environment goes past 10MM records the writes drop sharply. Up to about 10MM records the writes are about 3,000/second. Above 10MM records that drops to 1,000 writes/second or worse. But that's not the problem either. The problem is that when the 'writer' is taken longer, the multiple 'readers' performance degradates significantly. Reading sequentially ( 'ReadNext' or 'ReadPrev" ) within the same DB the 'readers' usually perform about 100K reads / second. Above 10MM the reads drop to 20-25K reads / second. This technique would be to allow the writer to indicate which tree leaf the writer is working within. If the reader needs a record from that leaf, they have to wait, but if not then they can proceed with any other leaf.

Agreed, but I was testing that the writers didn't clobber the shared memory. In production, I can 'flock' with 'LOCK_SH' for readers. Each tree leaf is independent of any other tree leaf, so maybe I'll be able to have multi-writers

I'm going to add the code in the main thread, but I'd appreciate any comments on what it is doing.

Regards...Ed

"Well done is better than well said." - Benjamin Franklin


In reply to Re^2: SysV shared memory (Look-Alike) -- pure perl by flexvault
in thread SysV shared memory (Look-Alike) -- pure perl by flexvault

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.