• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is worker thread and green thread.  RSS feed

 
Praveen Kumar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide examples and uses of both types of Threads.

Thanks
Praveen
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally a thread would be provided by the OS right? The OS would assign different threads to different processors, or make one processor divide it's attention over several threads.

A green thread is a thread that is provided by the VM. The VM simulates a multithreaded environment by dividing its own thread's attention over different 'green threads' which your application can use.
In this case the VM basically does the job that the OS normally does.

For your programming, it should make no difference. I don't think there's a way in which you can influence on what type of threads your program is run. When you request a new thread runs, it will, and I don't think you should care whether the thread is provided by the OS or the VM.

Worker threads and green threads aren't mutually exclusive. A worker thread in your program can also be a green thread.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exactly!

here for more source about it, you may read it
http://www.codestyle.org/java/faq-Threads.shtml
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!