aspose file tools*
The moose likes Mock Exam Errata and the fly likes Threads in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Reply locked New topic
Author

Threads in Java

Kontham Satish
Greenhorn

Joined: Jun 19, 2006
Posts: 1
How many thread types are in java?(i know only one daemon thread)
Nishant Verma
Ranch Hand

Joined: Jun 14, 2006
Posts: 41
Hi
These are some of the JVM thread types, I know :

1. Daemon threads - used in the background to implement a service. To create daemon thread thread.setDaemon(true). JVM exits when the only running threads are daemon.

2. Green threads - are pseudo threads. These are user level threads. Sun wrote green threds to enable thread support where native threds cannot be used. But I am not sure, if that means that green threads **CANNOT** be time sliced or round robin'ed. However this should depend strictly on the scheduler.

3. Native threads - To create native thread you need to run native VM use "-native" option. These threads can definitely be scheduled by OS scheduler.

I am not sure if Sun's Hot Spot VM still uses green threads on Solaris. But if they do then I think it shouldnt run faster than native implementation.

Cheers
Nishant


"Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover." - Mark Twain
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads in Java