what's the difference

G

Guest

hey all,

what's the difference between starting a new thread and starting a new
Process?

thanks,
rodchar
 
C

Cor Ligthert [MVP]

Rodchar,
what's the difference between starting a new thread and starting a new
Process?
Amost the same difference as a apple and a pear and the same equality.

However a thread cannot exist withouth a parent process while a thread is a
still a process.

Cor
 
C

CMM

You might want to research this further on the net... but basically:

Programs (EXE's) run in one "process space." Windows gives them their own
"virtual memory" and resources and they can't cross the border into other
processes (programs) running. This is actually a function of the x86 chip
and not Windows per se. You can see what processes you have running by going
into Task Manager and clicking on the Processes tab. Each process can have a
multitude of windows open (for instance each IE window you have open runs
(normally) as one process). If one process crashes, it can't take down
another process with it.

Each process has one "thread of execution" given to it... meaning it can do
one thing at a time (execute a particular line of code on one CPU clock
cycle). But processes can and usually do spawn other threads. These threads
simply mean that a single process can do several things at the same time
(multithreading). This is a feature of Windows and other OS which allow
multiple programs to do things at the same time by alloting them "CPU Time."

..NET introduces the notion of AppDomains. This is a pure software function
not hardware (like Processes). It means .NET can run several "sub processes"
(programs) in a single x86 process. These "sub processes" also cannot
interefere with each other.... the .NET runtime makes sure of that. This is
very memory efficient and it is was makes things like ASP.NET work so well.
 
C

cj

In Task Manager you might want to click View/Select Columns then click
thread count. It's interesting to see which processes are running how
many threads.
 
G

Guest

so then will both of these work fine if say like a window service starts one
of these and the service stops will the thread/process continue running?

thanks,
rodchar

ps. thanks for the great replies.
 
C

CMM

The service *is* the "process." If it stops so does the thread.

If the service (process) spawns another process (like, say, an instance of
Excel) the second process continues running even if the first one shuts
down. The first one has to do "something special" and explicitely kill the
second process if that's what it wants to do.

This is really basic stuff, man.
 

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

Similar Threads

what's the difference? 1
what's the difference 5
database records into an array 2
array in dataset 4
making async calls 1
which is better 6
adding to local 4
checkbox databind 5

Top