Solved

Shared memory

Posted on 1998-06-03
6
197 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
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…
The goal of this video is to provide viewers with basic examples to understand recursion 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.

803 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