1. Home >
  2. Apps >
  3. Groups >

Thread scheduling in java

Question asked by radha gogia in #Java on Jan 2, 2015
radha gogia
radha gogia · Jan 2, 2015
Rank C3 - EXPERT
I just want to ask that if the scheduling algorithm by JRE is priority scheduling since the threads are executed on the basis of their priority ,then is time slicing also made for the execution of threads because because of execution on the basis of priority may lead to starvation ,so I have confusion that is round robin scheduling algorithm implemented but as far as I know round robin scheduling has nothing to do with priority of threads since each thread is excecuted depending on the time slot.

So ,a lot of confusion in this case. Posted in: #Java
rahul69
rahul69 · Jan 5, 2015
Rank B2 - LEADER
radha gogia
I just want to ask that if the scheduling algorithm by JRE is priority scheduling since the threads are executed on the basis of their priority ,then is time slicing also made for the execution of threads because because of execution on the basis of priority may lead to starvation ,so I have confusion that is round robin scheduling algorithm implemented but as far as I know round robin scheduling has nothing to do with priority of threads since each thread is excecuted depending on the time slot.

So ,a lot of confusion in this case.
Don't get confused 😀
It's simple:
*JRE uses preemptive priority scheduling.
*Also round robin scheduling is a type of preemptive scheduling.
Scheduling is of two types: non preemptive (jobs run until completion) and preemptive (jobs can be force quit to give chance to others).
Since both starred algo's given above are preemptive, both can rotate jobs, without jobs being fully completed, one considers priority also while preempting, while other(ie round robin) gives same priority to all jobs while preempting.
Hope it clears a bit, 😀

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up