473,320 Members | 1,870 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,320 software developers and data experts.

Shared memory in .NET and WCF

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 operations made by the other processes with
WCF based on named pipes.

Would you think it is a good idea ?

Best regards

Oriane

Jun 5 '07 #1
10 3912
Hello Oriane,

so, as I understand it's like the caching, right?

I see no evil in this. The similiar approach is used widely in win32 world
and names MMF.
You only need to worry about thread safing when accessing your object.

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

OHello,
O>
OI have to share a object in RAM between several processes. I intend
Oto design a special process to load this objet (an Autocad plan) in
Omemory, and to take care of the read/write operations made by the
Oother processes with WCF based on named pipes.
O>
OWould you think it is a good idea ?
O>
OBest regards
O>
OOriane
O>
Jun 5 '07 #2
"Oriane" <or****@guermantes.frwrote in message
news:10**********************************@microsof t.com...
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 operations made by the other processes
with WCF based on named pipes.

Would you think it is a good idea ?

Best regards

Oriane

Not sure what you mean here, "Named pipes" and "shared memory" are different
beasts! Named pipes are not wrapped by the Framework, so you will have to
use PInvoke to call the native shared memory API's. WCF offers remoting
features over named pipes, , these 'Pipe' channels are actually mapped over
shared memory files, this is by far the fastest way to share data across
processes.

Willy.
Jun 5 '07 #3
Using common data between processes via shared memory is a fairly common
thing to do. It can be very difficult to get right if this is your first
attempt. Things like concurrency are hard to get right. Also be advised
that accessing data via pointers can also be difficult. If you are
dealing with a large shared pool it might get hard to find memory in
every process that maps to the exact same address. In our case the
entire pool can be mapped where ever the OS puts it within the process
and all pointer types within the pool are actually offsets. The
applications computer the pointers on the fly by adding the offset to
start of the pool. If you are dealing with small pools this probably
won't be a problem. Memory compaction can be another problem. If you
allocate and deallocate objects in your pool it can get fragmented.
Dealing with this fragmentation can get tricky for a novice. It took
me a couple of years to get our shared memory real time database right.

Hope this helps.
Leon Lambert
Oriane wrote:
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 operations made by the other
processes with WCF based on named pipes.

Would you think it is a good idea ?

Best regards

Oriane
Jun 5 '07 #4

"Leon Lambert" <la******@inil.coma écrit dans le message de
news:OM**************@TK2MSFTNGP02.phx.gbl...
Using common data between processes via shared memory is a fairly common
thing to do. It can be very difficult to get right if this is your first
attempt. Things like concurrency are hard to get right. Also be advised
[...].
Dealing with this fragmentation can get tricky for a novice. It took
me a couple of years to get our shared memory real time database right.
Yes that's exactly why I prefer to use WCF !!!!

Regards

Jun 5 '07 #5
Hello Willy,

"Willy Denoyette [MVP]" <wi*************@telenet.bea écrit dans le message
de news:95**********************************@microsof t.com...
>
Not sure what you mean here, "Named pipes" and "shared memory" are
different beasts! Named pipes are not wrapped by the Framework, so you
will have to use PInvoke to call the native shared memory API's. WCF
offers remoting features over named pipes, , these 'Pipe' channels are
actually mapped over shared memory files, this is by far the fastest way
to share data across processes.
Yes I don't want to get involved into shared memory problems, since I have
no experience about that on Windows. I really prefer to use WCF over named
pipes. If this is the fastest way to shared data across processes, it is
just perfect...

Thanks

Jun 5 '07 #6
Hello Michael,

"Michael Nemtsev" <ne*****@msn.coma écrit dans le message de
news:a2***************************@msnews.microsof t.com...
Hello Oriane,

so, as I understand it's like the caching, right?

I see no evil in this. The similiar approach is used widely in win32 world
and names MMF.
You only need to worry about thread safing when accessing your object.
Ok fine !

Thanks

Jun 5 '07 #7
On Jun 5, 3:02 am, "Oriane" <ori...@guermantes.frwrote:
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 operations made by the other processes with
WCF based on named pipes.

Would you think it is a good idea ?

Best regards

Oriane

Just to clarify, are you thinking of exposing this object via pointers
and shared memory and allow some one to have direct access to its data
from another process, or provide high-level read/write methods that
provides a data access layer to the data (e.g. GetXXX(), GetYYY()) ?

If pointers and shared memory, then this is a more complex area and
WCF doesn't do much for you in this area (in my opinion).

It sounds like you are going to be running this on the same computer
as the other processes, correct? If providing high-level methods,
you may look at .NET Remoting (http://www.developer.com/net/cplus/
article.php/1479761) this may provide a better method of sharing data
and objects across processes on the same computer than WCF.

Ron

Jun 5 '07 #8

<ro*************@yahoo.coma écrit dans le message de
news:11**********************@h2g2000hsg.googlegro ups.com...
>
Just to clarify, are you thinking of exposing this object via pointers
and shared memory and allow some one to have direct access to its data
from another process, or provide high-level read/write methods that
provides a data access layer to the data (e.g. GetXXX(), GetYYY()) ?
I do not intend to use shared memory. An ad hoc process will load the "data"
into its heap, and implement high-level read/write methods, with of course
some locks...
>
If pointers and shared memory, then this is a more complex area and
WCF doesn't do much for you in this area (in my opinion).
Absolutely.
It sounds like you are going to be running this on the same computer
as the other processes, correct?
yes
If providing high-level methods, you may look at .NET Remoting
(http://www.developer.com/net/cplus/
article.php/1479761) this may provide a better method of sharing data
and objects across processes on the same computer than WCF.
I thought that WCF was a superset of remoting, an that what remoting can do,
so can WCF ?
Ron
Oriane

Jun 5 '07 #9
On Jun 5, 9:11 am, "Oriane" <ori...@guermantes.frwrote:
<ronscottlang...@yahoo.coma écrit dans le message denews:11**********************@h2g2000hsg.googleg roups.com...
Just to clarify, are you thinking of exposing this object via pointers
and shared memory and allow some one to have direct access to its data
from another process, or provide high-level read/write methods that
provides a data access layer to the data (e.g. GetXXX(), GetYYY()) ?

I do not intend to use shared memory. An ad hoc process will load the "data"
into its heap, and implement high-level read/write methods, with of course
some locks...
If pointers and shared memory, then this is a more complex area and
WCF doesn't do much for you in this area (in my opinion).

Absolutely.
It sounds like you are going to be running this on the same computer
as the other processes, correct?

yes
If providing high-level methods, you may look at .NET Remoting
(http://www.developer.com/net/cplus/
article.php/1479761) this may provide a better method of sharing data
and objects across processes on the same computer than WCF.

I thought that WCF was a superset of remoting, an that what remoting can do,
so can WCF ?
Ron

Oriane
You may be right, just wanted to bring it up as an option. I was
thinking that .NET Remoting may be more friendly regarding CLR types,
state management, and callbacks, but WCF is certainly an improvement
in these areas over ASMX web services. Just may require a little more
configuration to get this all working if needed. I was thinking
that .NET Remoting may be little faster since it uses binary encoding,
but from the link below it looks like I am wrong. If you are using
the TCP, Named Pipes, etc. (anything other than HTTP), then I think
you will get binary encoding by default

http://msdn2.microsoft.com/en-us/library/bb310550.aspx

Ron

Jun 5 '07 #10
On Jun 5, 10:02 am, "Oriane" <ori...@guermantes.frwrote:
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 operations made by the other processes with
WCF based on named pipes.

Would you think it is a good idea ?

Best regards

Oriane
I don't know if this helps but: you might want to befriend
GC.KeepAlive.

/Per

--

Per Erik Strandberg
home: www.pererikstrandberg.se
work: www.incf.org
also: www.spongswedencare.se

Jun 7 '07 #11

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

Similar topics

0
by: Srijit Kumar Bhadra | last post by:
Hello, Here is some sample code with pywin32 build 203 and ctypes 0.9.6. Best regards, /Srijit File: SharedMemCreate_Mutex_win32all.py # This application should be used with...
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++....
11
by: Michael Schuler | last post by:
The use of STL in shared memory poses a real problem since (non-smart) pointers are not allowed there. Is there any solution for containers in shared memory using smart pointers? Where can I...
1
by: myren, lord | last post by:
When I first discovered shared memory (between multiple processes) I immediately started thinking of how to build my own VM subsystem + locking mechanisms for a large single block of memory. This...
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...
12
by: Jeremy | last post by:
Hi all, I'm getting very confused about how DB2 uses shared memory and I wonder if someone could clarify matters for me, please ? We are running 32bit DB2 V7.2 FP9 under AIX 4.3.3 on a machine...
5
by: Jim | last post by:
Hello, I have a broken server that we are going to be moving off to a new server with a new version of DB2 but here is what I have right now: RedHat 7.0 (2.2.24smp) DB2 v6.1.0.40 I am...
4
by: herbert | last post by:
I am coding a dozen "background" realtime apps for factory automation in .NET 2.0. The apps need to share a common memory as there are lots of variables to be shared (and synchronized of...
21
by: llothar | last post by:
Hello, i need to manage a heap in shared memory. Does anybody know about a portable (win32+mac+posix) c implementation for this.
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...

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.