A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

What is thread Scheduler?

Java thread Scheduler

What is a Thread Scheduler?

  • It is a part of JVM.

  • JVM decides which thread should run and in which order it will be execute.

  • It is responsible for scheduling threads i.e. if multiple threads are waiting to get the chance of execution then in which order threads will be executed is decided by Thread scheduler.

  • We can’t expect thread execution error and exact output since thread scheduler varies from JVM TO JVM.

  • Thread Scheduler depends upon two type of scheduling i.e preemptive scheduling and time slicing scheduling

Preemptive Scheduling:-

It is based on highest priority task. In this scheduling highest priority task executes first until it enters the waiting or dead states.

Time Slicing Scheduling:-

It executes a task for a predefined slice of time. If there is any other task in queue with the higest priority comes than scheduler executes that task first. This ime Slicing Scheduling based on priority and other factors.

Thread Priority:-

  • MIN_PRIORITY

  • MAX_PRIORITY

  • NORM_PRIORITY





OutPut like be this type :-

output


 

LEARN TUTORIALS

.

.