471,321 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

AppDomains and Threads Trying to create a robust, concurrentapplication.

I would like to create an application where I have many concurrent
processes being managed by a monitoring process. Each process that is
"managed" will be invoked from an assembly dll (think reflection). I
want a way to invoke these processes in parallel utilizing multi-core
processors but I'd like to have the protection that AppDomains
provide.

I was doing some research where I found that there is no true
isolation between threads and AppDomains, Threads can cross over
AppDomains at the CLRs discretion.
(Reference:
http://en.csharp-online.net/Building...d_Relationship)
'Under the .NET platform, there is not a direct one-to-one
correspondence between application domains and threads. In fact, a
given AppDomain can have numerous threads executing within it at any
given time. Furthermore, a particular thread is not confined to a
single application domain during its lifetime. Threads are free to
cross application domain boundaries as the Win32 thread scheduler and
CLR see fit."

This quote concerns me since if I have processes that can crash within
a thread it's completely unpredictable which AppDomain goes down.
My major concern is do AppDomains allow for concurrent processes or
are they blocking? I ran a test application where I had 2 AppDomains
created in a console app and each wrote to the console. It ended up
that the first one blocked the other domain. I was wondering if that
was because the console can only handle one domain at a time or if
AppDomains themselves do not provide concurrency.

If it's the case where AppDomains by themselves do not provide
concurrency how is it possible to execute multiple process with
AppDomain protection and remoting capabilities?

Simple ASCII diagram of how the code should behave.

Monitor Process (Main AppDomain also a Windows Service)
|-Dispatches Lightweight processes that are isolated. (Monitor
Process can control these processes via remoting calls, remoting calls
back to the monitor process are not allowed)
|-Dispatched process of system monitoring and control. (The actual
brains of the monitor process but ran as a separate AppDomain to keep
the Monitor process lightweight and more resilent to crashes.) (2 way
remoting can occur here.
Aug 23 '08 #1
0 1707

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Daylor | last post: by
1 post views Thread by Shaun McDonnell | last post: by
10 posts views Thread by cj | last post: by
8 posts views Thread by Michael Bray | last post: by
35 posts views Thread by Carl J. Van Arsdall | last post: by
1 post views Thread by billr | last post: by
6 posts views Thread by Stephen Walch | last post: by
8 posts views Thread by Fred Mertz | last post: by
3 posts views Thread by | last post: by

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.