Skip to main content

Threading model and Scheduling

3 replies [Last post]
overflow
Offline
Joined: 2009-02-18
Points: 0

Hello to everybody! :-)

Here I have 2 simple questions:
In a 1 to 1 thread model ever Java Thread is mapped to a native Thread of the OS, so here the questions.

1- In a 1 to 1 thread model the threads are scheduled ONLY BY THE Operation System? Or, Does the JVM have its own scheduler for the Java Threads?

2- Do the java threads "fight" to be run by the CPU with ALL the threads in the OS, or just with the Threads of the JVM?

I need it to evaluate the lack of performance due by the Context Switch effect in a Java application

Thanks in advance!

Message was edited by: overflow

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Java Threads behave exactly like "native" threads (because in fact they are), so no special scheduling and they are fighting for CPU resources with all other active threads.

- Clemnes

overflow
Offline
Joined: 2009-02-18
Points: 0

Thanks you for the information!!
Could I ask you if you may have some links or references to something official about it?
The only information I found about threading model it's here http://java.sun.com/docs/hotspot/threads/threads.html and it's only about Solaris operating environment. I think it's quite strange that there aren't official articles about threading model in other OS in the official site. I think this is really an important topic connected to performance.
Thank you very much for your help

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

> The only information I found about threading model
> it's here
> http://java.sun.com/docs/hotspot/threads/threads.html
> and it's only about Solaris operating environment.
Thats because Solaris is the only OS where you have some choice about it.

> I think this is really an important
> topic connected to performance.
No, it isn't - because there's nothing you can do about it to configure the behaviour.
Its a 1:1 mapping, and too much threads cause headache, as with any language using native threads.

- Clemens