C Shared Memory and 2D Arrays

This topic contains 1 reply, has 1 voice, and was last updated by  Abhey 2 years, 5 months ago.

  • Author
    Posts
  • #11005

    BrittneTabor
    Member

    C Shared Memory and 2D Arrays
    So here is my code for the client:

    I hope this *should* write my array to the shared memory location.

    How do I go about reading it from the Server? This is my current code;

  • #11006

    Abhey
    Member

    I am assuming that your question is how to read from the shared memory concurrently, without worrying about the data being corrupt by a writing process. First of all, you need some sort of locking mechanism. In the case of multiple processes trying to access a piece of data simultaneously, I do so through a monitor.

    http://en.wikipedia.org/wiki/Monitor_(synchronization)

    The monitor will basically ensure that you can have many simultaneous readers, but writers have exclusive access to a specific datum. I hope this answers the question.

You must be logged in to reply to this topic.