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:
Youvedeep Singh 2017-07-18 16:13:16 +05:30 committed by Anas Nashif
commit f807d4db7e

View file

@ -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;