Solved

Shared memory

Posted on 1998-06-03
6
204 Views
Last Modified: 2010-04-15
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.
0
Comment
Question by:pchaloux
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
jhurst earned 200 total points
ID: 1251103
I am assuiming that you are using a REAL operating system.  Therefore, use a file, the OS will buffer it well enough that it will not seem like memory.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1251104
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".
0
 
LVL 11

Expert Comment

by:alexo
ID: 1251105
Hey, pchaloux, you there???
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 

Author Comment

by:pchaloux
ID: 1251106
I'm not using Win32.  I'm on MQX, witch is similar to QNX, but on a Motorola platform.

0
 

Author Comment

by:pchaloux
ID: 1251107
I'm not using Win32.  I'm on MQX, witch is similar to QNX, but on a Motorola platform.

0
 
LVL 11

Expert Comment

by:alexo
ID: 1251108
Ask in the Unix area.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question