Slashdot Mirror


More Effective Use of Shared Memory on Linux

An anonymous reader writes "Making effective use of shared memory in high-level languages such as C++ is not straightforward, but it is possible to overcome the inherent difficulties. This article describes, and includes sample code for, two C++ design patterns that use shared memory on Linux in interesting ways and open the door for more efficient interprocess communication."

6 of 280 comments (clear)

  1. snnnoooorrree by hector_uk · · Score: -1, Troll

    now you see i'm sitting here with an opportunity to get a first post but i cant think what to write because this story is so damn not at all interesting.

  2. Microsoft code? by Anonymous Coward · · Score: -1, Troll

    This looks like Microsoft code. The classes are named lke ISomething or IAnother, like the hungarian stuff in MSDN.

    And then there's the backwards comparison, that teachers who come directly from Visual Basic advise to students because the teachers themselves aren't comfortable with C++ syntax.

    Please, let the guy finish his first semester, and then learn to write readable code.

  3. Re:C++ has bigger memory issues by Anonymous Coward · · Score: -1, Troll

    I think getting a garbage collector mandated as part of the language would be a much bigger step to making C++ a useful choice.

    In fact, forget it; just use an actual OO language instead.


    Fully agree, use an actual OO language instead of some crap that doesn't even fully implement inheritance. How can anyone even call a language that will only allow you to inherit from one class "object oriented"?

    Oh wait, C++ is not one of those languages.

    As for garbage collection, please grow up. Having your mother clean up after you worked fine when you were three years old, but after a certain age, it becomes clear that the only way to get it done right is to do it yourself. It's the same in programming, in the beginning some kind of BASIC is fine, but once you grow up, the garbage collector just can't keep up. And how the hell does one debug a memory leak in a program that doesn't allow cleaning up, but forces one to leave that to a garbage collector?

    We have a program like that. There is no delte keyword in .NET, so the only thing to do when the memory leak eats all the memory is to restart the program. Twice a day. The only way to get it done right is to do it yourself.

  4. News for Nerds. Stuff that matters. by WhoReallyCares · · Score: -1, Troll

    News for Nerds. Stuff that matters. ????

  5. Java has the answer, as usual... by barbazoo · · Score: 0, Troll
    public class Montior {

    public synchronized foo() { <access shared data> }

    }

    or

    synchronized (theMonitor) { <do stuff with shared data> }