mirror of
https://github.com/drasko/codezero.git
synced 2026-02-04 06:03:12 +01:00
Updated test0 with a forktest. Fixed timeslices. Updated kmem usage calculations.
- test0 now forks 16 tasks that each modify a global variable. - scheduler now gives 1/10th of a second per task. It also does not increase timeslice of a task that has scheduled. - When a memory is granted to the kernel, the distribution of this memory to memcaches was calculated in a complicated way. This is now simplified.
This commit is contained in:
@@ -300,8 +300,6 @@ void scheduler()
|
||||
|
||||
sched_lock();
|
||||
need_resched = 0;
|
||||
BUG_ON(current->tid < MIN_PREDEFINED_TID ||
|
||||
current->tid > MAX_PREDEFINED_TID);
|
||||
BUG_ON(current->rq != rq_runnable);
|
||||
|
||||
/* Current task */
|
||||
@@ -309,8 +307,9 @@ void scheduler()
|
||||
sched_next_state(current);
|
||||
|
||||
if (current->state == TASK_RUNNABLE) {
|
||||
current->ticks_left += TASK_TIMESLICE_DEFAULT;
|
||||
BUG_ON(current->ticks_left <= 0);
|
||||
BUG_ON(current->ticks_left < 0);
|
||||
if (current->ticks_left == 0)
|
||||
current->ticks_left = TASK_TIMESLICE_DEFAULT;
|
||||
sched_rq_add_task_behind(current, rq_expired);
|
||||
}
|
||||
sched_rq_swap_expired_runnable();
|
||||
|
||||
Reference in New Issue
Block a user