Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JVM Dependent Threads  RSS feed

 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threading in Java is JVM dependent. Threading implementation details are left to the JVM to implement. What scheduling also does WIndows JVM and Solaris JVM implement?
 
Henry Wong
author
Sheriff
Posts: 23289
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both Windows and Solaris supports very complex threading models -- certainly much more than needed by Java. In fact, later versions of Solaris uses a simpler threading model as the default model, as some tests showed that it was not more efficient -- just more complex...

However, for the most part, it should have litte affect on Java threads.

As long as you don't depend on the schedulling of threads -- including that based on priority -- you should be fine. But here are some details that may affect you...

- Both Solaris and Windows supports timeslicing. Two threads of the same priority will share the processor(s).

- Both Solaris and Windows supports priority inheritance. Basically, if multiple threads are waiting on a lock, and the thread that owns the lock has a priority that is lower than a waiting thread, it will get temporary bumped to the higher priority. This is done to prevent priority inversion.

- Windows actually has less priority levels than Java -- within the threading type that Java is using -- so some levels of priority actually maps to the same level in Windows. Basically, don't depend on priority to schedule, as they may actually be the same priority.

- Windows supports a complex calculation for priorities -- the priority that you set is just one variable. Depending on the execution slices given to threads, it may actually have an effective priority higher or lower than the requested priority. This is done to prevent thread starvation.

Henry
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Reema Patel:
Threading in Java is JVM dependent. Threading implementation details are left to the JVM to implement. What scheduling also does WIndows JVM and Solaris JVM implement?


This is not true. This has not been true since about Java 1.2. Many years now. You are thinking about Green Threads which Java does not do currently.

I think its true that its still legal to create a JVM that uses green threads. But I don't know of any JVMs that do it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!