• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Thread scheduler

 
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

# most operating systems use one of two scheduling methods

1. Preemptive scheduling
2. Time slicing

# In preemptive scheduling the highest priority thread continues to run until it dies, waits, or is preempted by a thread of higher priority
# In time slicing a thread runs for a specific time and then enters the runnable state; at which point the scheduler decides wether to return to the thread or schedule a different thread (method used by Win95/NT)



Preemptive Scheduling.
Ways for a thread to leave running state -
· It can cease to be ready to execute (by calling a blocking i/o method)
· It can get pre-empted by a high-priority thread, which becomes ready to execute.
· It can explicitly call a thread-scheduling method such as wait or suspend.

· Solaris JVM’s are pre-emptive.
· Windows JVM’s were pre-emptive until Java 1.0.2

Time-sliced or Round Robin Scheduling

· A thread is only allowed to execute for a certain amount of time. After that, it has to contend for the CPU (virtual CPU, JVM) time with other threads.
· This prevents a high-priority thread mono-policing the CPU.
· The drawback with this scheduling is - it creates a non-deterministic system - at any point in time, you cannot tell which thread is running and how long it may continue to run.

· Mactinosh JVM’s
· Windows JVM’s after Java 1.0.2



Thread scheduler is part of JVM or OS?
 
author
Posts: 23868
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

abalfazl hossein wrote:
Thread scheduler is part of JVM or OS?



With all modern JVMs, the scheduler is part of the underlying thread system; which means that it is part of one of the system libraries, and / or part of the OS.

Henry
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excuse me ,But your answer make me more confuse,

Please explain more.
 
Marshal
Posts: 25207
64
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

abalfazl hossein wrote:Please explain more.



I think you rather want "explain less". The answer is: the thread scheduler is not part of the JVM.
 
Henry Wong
author
Posts: 23868
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:
I think you rather want "explain less". The answer is: the thread scheduler is not part of the JVM.



Agreed. Straightforward question... that can get overly complicated with concepts like "user space" and "kernel space", and "shared objects" and "DLLs", etc.

Henry
 
Their achilles heel is the noogie! Give them noogies tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!