472,340 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,340 software developers and data experts.

Avoid memory corruption in shared memory used by several processes?

Hi all,

I want to make data stored in-memory (not disk) available to several
processes. My concern is that poorly written C applications with
dangling pointers may(will) damage the data in this memory segment if
it is open to all, i.e. shared memory mapped into all processes memory
area.

I don't want to use TCP/IP client/server between the apps and a data
store process due to the overhead.

I don't want to start calculating checksums for all updates in a
shared memory area, since that means a lot of overhead.

Now my question:
Is it possible to expose just the interface of a data store component
and have that i/f shared between all processes who want to access the
data, and then have this shared interface make callbacks into a data
store process' private memory?

If yes, how do I achieve this? If not, why not?

Thanks for helping out
/Sune

Jul 6 '07 #1
12 4680
On Jul 5, 7:50 pm, Sune <sune_ahlg...@hotmail.comwrote:
Hi all,

I want to make data stored in-memory (not disk) available to several
processes. My concern is that poorly written C applications with
dangling pointers may(will) damage the data in this memory segment if
it is open to all, i.e. shared memory mapped into all processes memory
area.

I don't want to use TCP/IP client/server between the apps and a data
store process due to the overhead.

I don't want to start calculating checksums for all updates in a
shared memory area, since that means a lot of overhead.

Now my question:
Is it possible to expose just the interface of a data store component
and have that i/f shared between all processes who want to access the
data, and then have this shared interface make callbacks into a data
store process' private memory?

If yes, how do I achieve this? If not, why not?
Try news:comp.programming.threads

Jul 6 '07 #2
Sune wrote:
I want to make data stored in-memory (not disk) available to several
processes. My concern is that poorly written C applications with
dangling pointers may(will) damage the data in this memory segment if
it is open to all, i.e. shared memory mapped into all processes memory
area.
...
Is it possible to expose just the interface of a data store component
and have that i/f shared between all processes who want to access the
data, and then have this shared interface make callbacks into a data
store process' private memory?
Something like that is possible, although callbacks are used for
something different than what your describe. Standard C doesn't support
multiple processes, so this is off-topic in this newsgroup.

You need to check systems that support multiple processes. It may also
be possible, in some systems, to allow a single process to write an area
of memory and others to only read.
--
Thad
Jul 6 '07 #3
user923005 <dc*****@connx.comwrites:
On Jul 5, 7:50 pm, Sune <sune_ahlg...@hotmail.comwrote:
>I want to make data stored in-memory (not disk) available to several
processes.
[...]
Try news:comp.programming.threads
I suspect that's not the right place to ask. The OP asked about
processes, not threads; in many system, those are quite different
things.

It's probably better to ask in a newsgroup that deals with whatever
operating system the OP is using. At a guess, comp.unix.programmer
seems likely.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 6 '07 #4
Keith Thompson wrote:
user923005 <dc*****@connx.comwrites:
>Sune <sune_ahlg...@hotmail.comwrote:
>>I want to make data stored in-memory (not disk) available to
several processes.

[...]
>Try news:comp.programming.threads

I suspect that's not the right place to ask. The OP asked about
processes, not threads; in many system, those are quite different
things.
To share memory you either need threads or some other arrangement
to specifically share a memory block. Threads are probably the
easiest initial mechanism.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 6 '07 #5
CBFalconer <cb********@yahoo.comwrites:
Keith Thompson wrote:
>user923005 <dc*****@connx.comwrites:
>>Sune <sune_ahlg...@hotmail.comwrote:

I want to make data stored in-memory (not disk) available to
several processes.

[...]
>>Try news:comp.programming.threads

I suspect that's not the right place to ask. The OP asked about
processes, not threads; in many system, those are quite different
things.

To share memory you either need threads or some other arrangement
to specifically share a memory block. Threads are probably the
easiest initial mechanism.
<OT>
How exactly do threads help you share memory between proceses?

Unix-like systems typically have mechanisms to share memory between
processes; these mechanisms are independent of threads, which exist
within a single process.
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 6 '07 #6
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
.... snip ...
>
>To share memory you either need threads or some other arrangement
to specifically share a memory block. Threads are probably the
easiest initial mechanism.

<OT>
How exactly do threads help you share memory between proceses?

Unix-like systems typically have mechanisms to share memory between
processes; these mechanisms are independent of threads, which exist
within a single process.
</OT>
Because, at least in my mind, threads of a process all operate in
the same memory space, and all we have to do is control access.
Processes go to some trouble to keep the memory isolated.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 6 '07 #7
CBFalconer <cb********@yahoo.comwrites:
Keith Thompson wrote:
>CBFalconer <cb********@yahoo.comwrites:
... snip ...
>>
>>To share memory you either need threads or some other arrangement
to specifically share a memory block. Threads are probably the
easiest initial mechanism.

<OT>
How exactly do threads help you share memory between proceses?

Unix-like systems typically have mechanisms to share memory between
processes; these mechanisms are independent of threads, which exist
within a single process.
</OT>

Because, at least in my mind, threads of a process all operate in
the same memory space, and all we have to do is control access.
Processes go to some trouble to keep the memory isolated.
Yes, and the OP specifically asked about sharing memory among
*processes*. Maybe threads are a better solution to his underlying
problem, but you should at least mention that you're suggesting an
alternative rather than answering his actual question.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 6 '07 #8
"Keith Thompson" <ks***@mib.orgwrote in message
news:ln************@nuthaus.mib.org...
<OT>
How exactly do threads help you share memory between
proceses?

Unix-like systems typically have mechanisms to share memory
between processes; these mechanisms are independent of
threads, which exist within a single process.
Threads are sometimes referred to as lightweight processes.
</OT>
S

--
Stephen Sprunk "Those people who think they know everything
CCIE #3723 are a great annoyance to those of us who do."
K5SSS --Isaac Asimov
--
Posted via a free Usenet account from http://www.teranews.com

Jul 6 '07 #9
Stephen Sprunk wrote:
"Keith Thompson" <ks***@mib.orgwrote in message
><OT>
How exactly do threads help you share memory between
proceses?

Unix-like systems typically have mechanisms to share memory
between processes; these mechanisms are independent of
threads, which exist within a single process.

Threads are sometimes referred to as lightweight processes.
I believe Linux specifically creates processes and defeats the
memory isolation provisions in creating threads.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 7 '07 #10
"CBFalconer" <cb********@yahoo.comwrote in message
news:46***************@yahoo.com...
Stephen Sprunk wrote:
>Threads are sometimes referred to as lightweight processes.

I believe Linux specifically creates processes and defeats the
memory isolation provisions in creating threads.
Linux now has a single spawn() syscall, which takes various options; some of
them result in a separation of memory space (i.e. processes), and some don't
(i.e. threads). All the kernel cares about is scheduling threads; which
ones occupy the same memory space as others is a minor detail.

S

--
Stephen Sprunk "Those people who think they know everything
CCIE #3723 are a great annoyance to those of us who do."
K5SSS --Isaac Asimov
--
Posted via a free Usenet account from http://www.teranews.com

Jul 7 '07 #11
Stephen Sprunk wrote, On 07/07/07 09:10:
"CBFalconer" <cb********@yahoo.comwrote in message
news:46***************@yahoo.com...
>Stephen Sprunk wrote:
>>Threads are sometimes referred to as lightweight processes.
<snip>

All of which is off topic. Both of you, if you want to discus it
further, take it to email or a group where it is topical please.
--
Flash Gordon
Jul 7 '07 #12
"Sune" <su**********@hotmail.comwrote in message
news:11*********************@e9g2000prf.googlegrou ps.com...
Hi all,

I want to make data stored in-memory (not disk) available to several
processes. My concern is that poorly written C applications with
dangling pointers may(will) damage the data in this memory segment if
it is open to all, i.e. shared memory mapped into all processes memory
area.
[...]

http://groups.google.com/group/comp....86197f1882dc56

http://groups.google.com/group/comp....45e6fe981788e7

Read both of those and follow all links...

Aug 26 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular...
3
by: alanrn | last post by:
I would like to start a dialog on how to implement the equivalent functionality of UNIX shared memory in .NET. I work with a factory automation...
14
by: phil_gg04 | last post by:
Dear C++ Experts, Over the last couple of months I have been writing my first program using shared memory. It has been something of an...
16
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from...
2
by: a_agaga | last post by:
Do you know are there some reasons why many do not make processes to communicate through memory? Why network connections (sockets) are used so...
10
by: Oriane | last post by:
Hello, I have to share a object in RAM between several processes. I intend to design a special process to load this objet (an Autocad plan) in...
5
by: Sune | last post by:
Hi all, I want to make data stored in-memory (not disk) available to several processes. My concern is that poorly written C applications with...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.