java tutorial - Java scheduler - java programming - learn java - java basics - java for beginners



Thread Scheduler in Java

  • Thread scheduler in java is the part of the JVM that decides which thread must run.
  • There is no guarantee that which runnable thread will be chosen to run by the thread scheduler.
  • Only one thread at a time can run in a single process.
  • The thread scheduler mostly uses preemptive or else time slicing scheduling to schedule the threads.
 Thread Scheduler in Java

Learn Java - Java tutorial - Thread Scheduler in Java - Java examples - Java programs

Difference between preemptive scheduling and time slicing

  • Preemptive scheduling: The highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence.
  • Time slicing: The task executes for a predefined slice of time then reenters the pool of ready tasks. A scheduler then determines which task must execute next, based on priority as well as other factors.

Features

  • The JVM schedules using a preemptive, priority based scheduling algorithm.
  • All Java threads have a priority and the thread with the highest priority is scheduled to run by the JVM.
  • In case two threads have the same priority a FIFO ordering is followed.

Related Searches to Java scheduler