Scheduler: Same priority Preemptive threads should get equal time slice
If there are multiple preemptive threads with same priority, and any one thread preempts before its time slice expires (due to yields/ semaphore take/queue etc), then next schedules thread is getting lower time slide than expected. This patch fixes this issue by accounting time expired when a thread releases CPU before its time slide expires. Jira: ZEP-2217/ZEP-2218 Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
This commit is contained in:
parent
5efaca470c
commit
f807d4db7e
1 changed files with 6 additions and 0 deletions
|
@ -432,7 +432,13 @@ void _update_time_slice_before_swap(void)
|
|||
|
||||
if (!remaining || (_time_slice_duration < remaining)) {
|
||||
_set_time(_time_slice_duration);
|
||||
} else {
|
||||
/* Account previous elapsed time and reprogram
|
||||
* timer with remaining time
|
||||
*/
|
||||
_set_time(remaining);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Restart time slice count at new thread switch */
|
||||
_time_slice_elapsed = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue