Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Shared memory

Posted on 1998-06-03
6
Medium Priority
?
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

610 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