473,378 Members | 1,386 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,378 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 4937
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.