Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Process vs thread

 
Tim Johnsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between the two? (Note this is not for class just curious as to what the difference is).

Thanks
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threads are more lightweight. You can have many threads in a process.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To overgeneralize ...

Processes are started by the operating system. There is quite a bit of startup and teardown overhead. They offer good safety and isolation from each other, the downside of which is it's harder to make them communicate with each other.

Threads are managed by a program running in a process. They are lighter weight to startup and teardown, but is still non-zero overhead so you can do too many and drag things down. There are many neat language-specific ways for threads to communicate; Java has things like wait, notify, join built in and the whole new concurrent package to play with.

Those definitions of process and thread are not necessarily true on every platform and language. If you talk about them in a conversation and don't seem to be saying the same thing as the other person, back up and get agreement on what you really mean.
[ October 18, 2005: Message edited by: Stan James ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic