my dog learned polymorphism
The moose likes Performance and the fly likes Native Threading... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Native Threading..." Watch "Native Threading..." New topic

Native Threading...

Sivaram Ghorakavi
Ranch Hand

Joined: Nov 30, 2000
Posts: 56
Does Java use native threads of the OS?? If not, is there a possible way to tell JVM to use these??? Using native threads of the OS boosts the performance.
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
All Java threads share the same process space and an exception to this is Native threads. Only some compilers support native threads ( IBM's JDK for AIX is an example ). Using native threads certainly improves performance.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Glade Wishart
Ranch Hand

Joined: Nov 03, 2000
Posts: 30
Java has built-in multithreading which includes multithreading primitives as part of the language itself. C and C++ do not have built-in multithreading therefore they must make calls to the operating system multithreading primitives to accomplish the same tasks.
Hopefully, this helps.
David Wiser

Joined: Jan 16, 2001
Posts: 4
Also pay attention to the behavior of Thread.sleep(int) in your code. If you're running under Solaris, which uses 'native' threads, these threads are cooperative, not preemptive within the JRE. Under NT, you don't need to call sleep(), but under Solaris, you do in order for same-priority threads to get CPU time. If your threads aren't getting enough time, try putting a sleep(1) call in.
I agree. Here's the link:
subject: Native Threading...
jQuery in Action, 3rd edition