Multithreading in java watch online session on youtube in Hindi)
How to create thread in javawatch online session on youtube in Hindi)
What is runtime stack in Java?watch online session on youtube in English)
Sleep Method in Java ?watch online session on youtube in English)
What is Java Lock? Or Synchronizationwatch online session on youtube in English)
What is Thread Group in Java?watch online session on youtube in English)
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 :-