Link to home
Start Free TrialLog in
Avatar of pchaloux
pchaloux

asked on

Shared memory

I want to have a region that can be read by many applications at the same time, but only one application at the time can write.  There can be no read during a write.  There can be many read at once.
Maybe with mutex or semaphore components...

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of jhurst
jhurst

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you'd like a more helpful answer, consider this:

The OS [Assuming a Win32 platform] has support for everything you mention.

Shared memory between applications can be implemented via memory-mapped files.  The APIs you need are CreateFileMapping() and MapViewOfFile().

You will also need two locks - a read lock and a write lock (so you can have multiple readers but only one writer).  You can use semaphores for that.  The APIs you need are CreateSemaphore(), OpenSemaphore(), WaitForSingleObject() and WaitForMultipleObjects().

Note that in order to be used between processes, all your objects will need to be "named".
Hey, pchaloux, you there???
Avatar of pchaloux
pchaloux

ASKER

I'm not using Win32.  I'm on MQX, witch is similar to QNX, but on a Motorola platform.

I'm not using Win32.  I'm on MQX, witch is similar to QNX, but on a Motorola platform.

Ask in the Unix area.