Hi All,
How do I write into shared memory blocks using multiple threads? For example, I have created 50 threads to write into shared memory and 50 threads to read from shared memory.
I have already created a shared memory and I want to write into shared memory as follows:
SharedMemoryID(1..N) BlockID(1..N) ThreadID(1..N) Data (String Format)
SharedMemoryID: I may have multiple shared memories in my process, which can be shared among multiple threads and processes.
BlockID: Each shared memory will have multiple blocks, and by referring this BlockID, any thread or process should be able to access it.
ThreadID: I am having multiple threads (read and write).
At this point of time, I am trying to write using WriterThread1, into single shared memory and once it's written some data into one shared memory. I want to access and modify that data using ReaderThread1.
Again I want to write some data into same shared memory using WriterThread2 and want to modify or read the written data using ReaderThread2.
While doing this I also need to make sure that either of (reader or writer) thread should access any particular blocks of shared memory.
I don't know how to proceed, only thing I have done so far is I am able to create number of reader and writer threads and a shared memory but have no idea about how to proceed further. I have attached code for your reference, could you please help me in moving ahead.....