Treads Vs Process

E

Erick

I've create a windows service which will start any windows application
whose name it finds in an xml file i have pointed it to.

However, I also want it to create .net objects from assemblies (dll's)
I want these objects run in the background. I have used reflection to
find the assembly and the object type.

I want these objects to run separately to the windows service. Do i
start these objects in a new thread or do they need to start in a new
process?

What is the difference between a process and a thread and is all .net
code executed in the same process.

Any help appreciated
 
B

Barry Kelly

Erick said:
I've create a windows service which will start any windows application
whose name it finds in an xml file i have pointed it to.

However, I also want it to create .net objects from assemblies (dll's)
I want these objects run in the background. I have used reflection to
find the assembly and the object type.

I want these objects to run separately to the windows service. Do i
start these objects in a new thread or do they need to start in a new
process?

Objects are code and data. They don't represent a running thread of
execution unless you explicitly create a thread of execution call into
them. So, you either need to create a thread and call a method on the
object from that thread, or you need to create a wrapper process which
calls into the object.
What is the difference between a process and a thread

Briefly, a process is a notional owner of a set of resources that are
all collectively used and shared in the execution of a program. One of
the kinds of resources is a thread; another is a file handle. Processes
are a useful abstraction in operating systems so that resources can be
reclaimed when the process exits (terminates).

A thread represents a single logical thread of execution, that is, a
logical CPU consecutively executing instructions from memory. Both
memory and threads are resources owned by processes.

Every process has at least one thread, and if all threads in a process
exit, the process exits.
and is all .net
code executed in the same process.

No.

-- Barry
 
M

Mehdi

I've create a windows service which will start any windows application
whose name it finds in an xml file i have pointed it to.

Beware that Windows Services run under their own user accounts (LocalSystem
by default IIRC) and have their own window station and desktop. This means
that if the Windows applications that you are starting from your windows
service have a UI, it won't appear to the user by default. On top of that,
depending on which application you start, you might be opening security
holes in your system by doing that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top