Difference between program, process and thread?

  • Thread starter Thread starter John
  • Start date Start date
from the wonderful person said:
Hi-
What's the difference between a program, process and thread?

Hope this isn't a homework assignment ) (if it is, go google for it
yourself).

My definition would be that a program is something you explicitly run
(which causes a process to get started). Processes are also started by
the system .. ctrl-alt-delete (task manager) will show you a lot of
processes, most of which you didn't run yourself. 'Program' is actually
a 'not very well' defined term - task manager doesn't use it, it has
'applications'. Process is a bit better defined - a process typically
has resources (code, memory space, file handles, and suchlike) which are
not visible to other processes, and so it is 'somewhat self contained'.

Any process can have multiple threads .. a thread is just a bit of code
that can be off doing something with only minimal reference to other
threads .. in Explorer, for instance, each window may be a separate
thread. On a multi-CPU machine, several threads in one process can be
executing at once (on a single CPU, this isn't physically possible ..
ignoring Hyper Threading, which sort of fakes it).
 
John said:
What's the difference between a program, process and thread?

Maybe none, but a Program may have more than one process. In practice
the system runs several, applications rarely do, but an example would be
Internet Explorer launching a new process to display a secondary window.
And it is possible for the code then to be constructed with several
threads of code that can run in parallel with each other, independently
..
 
Maybe none, but a Program may have more than one process.

I end up tending to think of a program as a "container" - it may only need
one process or thread, or one program might start several threads (printing,
saving, opening a new window, processing something in the background.)
Simple programs may only have one process or thread.
 

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

Back
Top