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

How to implement a remote Monitor ?

I would like to implement an MarshalByRef object similar to
System.Threading.Monitor. The interface would look like

class RemoteMonitor : MarshalByRef
{
public void Enter(object obj, Guid threadID) { ... }
public void Exit(object obj, Guid threadID) { ... }
}

Let assume that each remote Threads has its unique identifier, I would like
to be able to implement RemoteMonitor in order to have a semantic identical
to the System.Threading.Monitor. It's tricky and the only solutions I can
think of are complicated and computionally inefficient.

Does anyone has an idea?
Joannès
Nov 16 '05 #1
4 1983
Joannes,

I would ask first why you want to do this? To allow this kind of
granular control into a system from the outside doesn't seem like very good
design.

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

"Joannes Vermorel" <fi*******@lastname.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl...
I would like to implement an MarshalByRef object similar to
System.Threading.Monitor. The interface would look like

class RemoteMonitor : MarshalByRef
{
public void Enter(object obj, Guid threadID) { ... }
public void Exit(object obj, Guid threadID) { ... }
}

Let assume that each remote Threads has its unique identifier, I would
like to be able to implement RemoteMonitor in order to have a semantic
identical to the System.Threading.Monitor. It's tricky and the only
solutions I can think of are complicated and computionally inefficient.

Does anyone has an idea?
Joannès

Nov 16 '05 #2
> I would ask first why you want to do this? To allow this kind of
granular control into a system from the outside doesn't seem like very
good design.

Can you elaborate?


The reason lies in a transparent grid computing framework that I am working.
Look at the NGrid project on http://ngrid.sf.net (not really up to date, I
will release soon). Basically I want to implement a distributed Monitor.

Joannès
Nov 16 '05 #3
One question I have is does it need to be reentrant? Does an owner of the
lock need to be able to reenter the lock multiple times? If you just need
mutal exclusion, I might do a binary Semaphore with count of 1. See my
implementation at code project:
http://www.codeproject.com/csharp/Di...gSemaphore.asp

That way, you don't care what thread owns it, just that someone does. The
owner must release it when done. Other threads will block until lock free.
You need to handle situation where an owner dies and never frees the lock.
You have that issue regardess of the primitive used. You can use some
monitor thread or some timeout on lock that handles release after some X
seconds. You could also use a Mutex. That is reentrant and needs to be
released same number of times.

--
William Stacey

"Joannes Vermorel" <fi*******@lastname.com> wrote in message
news:uD***************@TK2MSFTNGP10.phx.gbl...
I would ask first why you want to do this? To allow this kind of
granular control into a system from the outside doesn't seem like very
good design.

Can you elaborate?


The reason lies in a transparent grid computing framework that I am
working. Look at the NGrid project on http://ngrid.sf.net (not really up
to date, I will release soon). Basically I want to implement a distributed
Monitor.

Joannès

Nov 16 '05 #4
I finally manage to get a working solution based on Wait/Pulse and Hashtable
containing the entering counts (the lock re-entry feature was required). The
code could be found(*) at
http://cvs.sourceforge.net/viewcvs.p...cs?view=markup

Joannès
(*) the SF may have some delay before displaying the code.
Nov 16 '05 #5

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

Similar topics

3
by: sushi | last post by:
Hello, I have to monitor a remote server for functions such as CPU Utilization etc. I am using System.Management namespace for the same. But when I try to execute the following code, it gives...
0
by: E. | last post by:
Hi, i have a problem with remote debug. my local dev computer is a win xp sp 2 (with firewall disabled). my remote server is a win 2k. Both has been configured with my account as administrator....
1
by: Ken Allen | last post by:
I have encountered a problem with remote debugging under VS 2005 and ..Net 2.0 -- it seems that the framework installation does not include the "Microsoft .Net Framework 2.0 Configuration" tool! ...
0
by: Jason Huang | last post by:
Hi, In my Windows Server 2003 I have installed VS2005, and I have the Visual Studio Remote Debugging Monitor runnig. The Debugging Monitor recorded this line: 3/22/2007 05:37:58PM...
0
by: DR | last post by:
How to debug sql 2005 on remote machine. I am administrator on both my dev machine and remote sql server machine. I get this error when i try to connect to remote machien with visual studio: ...
6
by: Bob Altman | last post by:
Hi all, This is a long shot, but I figure it doesn't hurt to ask... I have some applications that work fine when I run them on my PC at work, but "fail to initialize (0x000005)" when I'm...
12
by: sakthikumarb | last post by:
Hi , I need to monitor for Remote desktop connection is made for a particular host. There is any WMI event ?.if not how can monitor for remote desktop connection.. (Basically i need to generate...
3
by: Yves Gagnon | last post by:
Hi, I try to debug a WCF hosted in a windows services on a serveur that is on an other domaine then my developpement machine. I tried many things without succes. Here is what I tried: First I...
7
by: luker | last post by:
Hello Experts, I am writing an application for a device running windows xp embedded. I want to code on my developer pc and deploy the running executable to the embedded device. - The two boxes...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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:
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
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...
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.