473,395 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 4942
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 expression. I have done a GC.Collect to make sure that,...
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 system. The bulk of the system is written in C/C++....
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 "in-at-the-deep-end" experience, to say the least. At...
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 a dataset, and then pushing the dataset to a grid,...
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 commonly in IPC (inter process communication)...
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 memory, and to take care of the read/write...
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 dangling pointers may(will) damage the data in this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.