CrazyEngineers
  • Thread scheduling in java

    radha gogia

    Member

    Updated: Oct 24, 2024
    Views: 1.2K
    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.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • rahul69

    MemberJan 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, 😀
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register