473,508 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory sharing between 2 C# applications

Dear All,

Is there a way in which 2 application can share a common memory location to
access static data?

Say for example I have a product master data that is available in a single
place, and I have an application that uses this data to do its own
operation. I also have a similar kind of another application that uses the
same data for its another operation. Can we implement this in C#?

Regards,

Peri
Dec 18 '07 #1
9 2882
Peri,

Have you considered a database? One of the major features of a database
is to be a persistent store of data for use by multiple applications. You
can easily store state there that your other apps can use (assuming you are
accessing the same database) and update as well.

Sharing memory isn't a practical solution in .NET if you are going to
share complex data structures (as you would have to manage the serialization
to/from shared memory, and you would have to have some sort of locking
mechanism on that memory). You are better off having a third app domain
somewhere which will store the values/items you need, and then remote to
that app domain to get/update those values/items.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peri" <pe**@CSPL.comwrote in message
news:es**************@TK2MSFTNGP03.phx.gbl...
Dear All,

Is there a way in which 2 application can share a common memory location
to access static data?

Say for example I have a product master data that is available in a single
place, and I have an application that uses this data to do its own
operation. I also have a similar kind of another application that uses the
same data for its another operation. Can we implement this in C#?

Regards,

Peri
Dec 18 '07 #2
DB access will be very slow compared to accessing the memory. Only because
of this I am planning to have arrays similar to IMD(In-memory-database).
Since there will not be any write operation I need not get worried about
locking mechanism. It would be only read operation. If this is the case can
I do it in a single machine (All applications running in one machine)?

Regards,

Peri

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:00**********************************@microsof t.com...
Peri,

Have you considered a database? One of the major features of a
database is to be a persistent store of data for use by multiple
applications. You can easily store state there that your other apps can
use (assuming you are accessing the same database) and update as well.

Sharing memory isn't a practical solution in .NET if you are going to
share complex data structures (as you would have to manage the
serialization to/from shared memory, and you would have to have some sort
of locking mechanism on that memory). You are better off having a third
app domain somewhere which will store the values/items you need, and then
remote to that app domain to get/update those values/items.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peri" <pe**@CSPL.comwrote in message
news:es**************@TK2MSFTNGP03.phx.gbl...
>Dear All,

Is there a way in which 2 application can share a common memory location
to access static data?

Say for example I have a product master data that is available in a
single place, and I have an application that uses this data to do its own
operation. I also have a similar kind of another application that uses
the same data for its another operation. Can we implement this in C#?

Regards,

Peri

Dec 18 '07 #3
Is my understanding that you can have in memory data tables using a database
such as sql server (I am assuming that you would be able to do this with the
free express version too).

If you use this technique you won't be reading and writing to disk, you will
be reading and writing directly in and from memory.

"Peri" <pe**@CSPL.comwrote in message
news:OV**************@TK2MSFTNGP04.phx.gbl...
DB access will be very slow compared to accessing the memory. Only because
of this I am planning to have arrays similar to IMD(In-memory-database).
Since there will not be any write operation I need not get worried about
locking mechanism. It would be only read operation. If this is the case
can I do it in a single machine (All applications running in one machine)?

Regards,

Peri

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:00**********************************@microsof t.com...
>Peri,

Have you considered a database? One of the major features of a
database is to be a persistent store of data for use by multiple
applications. You can easily store state there that your other apps can
use (assuming you are accessing the same database) and update as well.

Sharing memory isn't a practical solution in .NET if you are going to
share complex data structures (as you would have to manage the
serialization to/from shared memory, and you would have to have some sort
of locking mechanism on that memory). You are better off having a third
app domain somewhere which will store the values/items you need, and then
remote to that app domain to get/update those values/items.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peri" <pe**@CSPL.comwrote in message
news:es**************@TK2MSFTNGP03.phx.gbl...
>>Dear All,

Is there a way in which 2 application can share a common memory location
to access static data?

Say for example I have a product master data that is available in a
single place, and I have an application that uses this data to do its
own operation. I also have a similar kind of another application that
uses the same data for its another operation. Can we implement this in
C#?

Regards,

Peri


Dec 18 '07 #4
I agree. For something like this, store the contents in a database,
query for the information once, and then access the values from the DataSet
(or whatever you stored the values to) from that point on.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rene" <a@b.comwrote in message
news:Ot**************@TK2MSFTNGP03.phx.gbl...
Is my understanding that you can have in memory data tables using a
database such as sql server (I am assuming that you would be able to do
this with the free express version too).

If you use this technique you won't be reading and writing to disk, you
will be reading and writing directly in and from memory.

"Peri" <pe**@CSPL.comwrote in message
news:OV**************@TK2MSFTNGP04.phx.gbl...
>DB access will be very slow compared to accessing the memory. Only
because of this I am planning to have arrays similar to
IMD(In-memory-database). Since there will not be any write operation I
need not get worried about locking mechanism. It would be only read
operation. If this is the case can I do it in a single machine (All
applications running in one machine)?

Regards,

Peri

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:00**********************************@microsof t.com...
>>Peri,

Have you considered a database? One of the major features of a
database is to be a persistent store of data for use by multiple
applications. You can easily store state there that your other apps can
use (assuming you are accessing the same database) and update as well.

Sharing memory isn't a practical solution in .NET if you are going to
share complex data structures (as you would have to manage the
serialization to/from shared memory, and you would have to have some
sort of locking mechanism on that memory). You are better off having a
third app domain somewhere which will store the values/items you need,
and then remote to that app domain to get/update those values/items.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peri" <pe**@CSPL.comwrote in message
news:es**************@TK2MSFTNGP03.phx.gbl...
Dear All,

Is there a way in which 2 application can share a common memory
location to access static data?

Say for example I have a product master data that is available in a
single place, and I have an application that uses this data to do its
own operation. I also have a similar kind of another application that
uses the same data for its another operation. Can we implement this in
C#?

Regards,

Peri



Dec 18 '07 #5
On Dec 18, 6:33 am, "Peri" <p...@CSPL.comwrote:
Dear All,

Is there a way in which 2 application can share a common memory location to
access static data?

Say for example I have a product master data that is available in a single
place, and I have an application that uses this data to do its own
operation. I also have a similar kind of another application that uses the
same data for its another operation. Can we implement this in C#?

Regards,

Peri

Assuming you are doing this in Windows you can use the Win32 API calls
CreateFileMapping, MapViewOfFile and OpenFileMapping. Look them up on
pinvoke.net and msdn to find out how to setup a shared memory segment.
It's pretty simple but for static data the database maybe a better way
to go.
Dec 18 '07 #6
On 18 Dec, 12:33, "Peri" <p...@CSPL.comwrote:
Dear All,

Is there a way in which 2 application can share a common memory location to
access static data?

Say for example I have a product master data that is available in a single
place, and I have an application that uses this data to do its own
operation. I also have a similar kind of another application that uses the
same data for its another operation. Can we implement this in C#?

Regards,

Peri
Static data (thats not changing right?), read when app starts....from
the registry or .ini file comes to mind.
/CY
Dec 19 '07 #7

"Peri" <pe**@CSPL.comwrote in message
news:OV**************@TK2MSFTNGP04.phx.gbl...
DB access will be very slow compared to accessing the memory. Only because
of this I am planning to have arrays similar to IMD(In-memory-database).
Since there will not be any write operation I need not get worried about
locking mechanism. It would be only read operation. If this is the case
can I do it in a single machine (All applications running in one machine)?
How much memory does the data take up? If it doesn't change, you can just
read it into each app, no need for sharing. If its too big for that, you
might use file APIs anyway, as Windows will use the file cache to avoid disk
access, and the file cache is shared between all processes.
>
Regards,

Peri

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:00**********************************@microsof t.com...
>Peri,

Have you considered a database? One of the major features of a
database is to be a persistent store of data for use by multiple
applications. You can easily store state there that your other apps can
use (assuming you are accessing the same database) and update as well.

Sharing memory isn't a practical solution in .NET if you are going to
share complex data structures (as you would have to manage the
serialization to/from shared memory, and you would have to have some sort
of locking mechanism on that memory). You are better off having a third
app domain somewhere which will store the values/items you need, and then
remote to that app domain to get/update those values/items.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peri" <pe**@CSPL.comwrote in message
news:es**************@TK2MSFTNGP03.phx.gbl...
>>Dear All,

Is there a way in which 2 application can share a common memory location
to access static data?

Say for example I have a product master data that is available in a
single place, and I have an application that uses this data to do its
own operation. I also have a similar kind of another application that
uses the same data for its another operation. Can we implement this in
C#?

Regards,

Peri


Dec 19 '07 #8
GG
If you are looking for IPC then check named pipes. You will need dot net
3.5 version. hope it helps.

*** Sent via Developersdex http://www.developersdex.com ***
Dec 20 '07 #9
Peri wrote:
DB access will be very slow compared to accessing the memory. Only because
of this I am planning to have arrays similar to IMD(In-memory-database).
Since there will not be any write operation I need not get worried about
locking mechanism. It would be only read operation. If this is the case can
I do it in a single machine (All applications running in one machine)?
What about using a database with in memory tables like Oracle TimesTen ?

Arne
Dec 22 '07 #10

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

Similar topics

6
3232
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,...
16
2851
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,...
6
5873
by: varlagas | last post by:
We disabled the antivirus software but the problem persists. Any clues? Many thanks in advance! Panagiotis Varlagas ======================================================================= ...
5
10497
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
4
2326
by: qube3 | last post by:
We have applications written by JSP/Servlet and ASP.NET. All our future development would be based on ASP.NET. We wants to develop a single user interface so that users would not be aware that...
4
1250
by: mkillian | last post by:
I am having an issue to where I need to share memory between an ASP.Net solution and a VB.Net solution. I have several large arrays and collections that are updated every half second. The data is...
4
3100
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...
3
2525
by: tlyczko | last post by:
Hello, I've been reading about this topic, and I've gotten myself more confused, not less. We have a single-processor license SQL Server Standard 2005 (xeon 2.8 ghz) with 4 GB RAM in Windows...
3
3187
by: =?Utf-8?B?VG9kZA==?= | last post by:
What is the memory footprint of static methods of a windows app running on a server when the server spins up multiple instances of the application? In my envirionment, we have a Citrix server...
0
7226
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
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
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
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7049
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
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.