View Feed
group-icon
Java Developers
Community of Java Developers: Get Java Programming Help from fellow Java Developers across the world.
654 Members
Join this group to post and comment.
radha gogia
radha gogia • Jan 2, 2015

Thread scheduling in java

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.
rahul69
rahul69 • Jan 5, 2015
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, 😀

Share this content on your social channels -