• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads  RSS feed

 
leela mohan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is difference between processer and thread??
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean "process" and "thread", I guess.

The main difference is that processes are isolated from one another's memory, whereas threads share memory.

For more information, try foldoc.
 
David Nemeskey
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main difference is that processes are isolated from one another's memory, whereas threads share memory.


Specifically, in case of Java, a JVM, and what it runs is 1 process. So having two java processes mean having two JVMs (and two "java" entries in the process list / task manager).

A process can have several threads, which (as mentioned before) share memory. Also, in modern operating systems, the unit of scheduling is a thread, and not a process. That means, if there are two programs, one is running one thread, and the other running two, it is likely that the latter will get twice the CPU time as the former.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!