Linux O(1) scheduler algorithm
struct prio_array array = rq->active; if (!array->nr_active) { rq->active = rq->expired; rq->expired = array; }
struct task_struct *prev, *next; struct list_head *queue; struct prio_array array; int idx; prev = current; array = rq->active; idx = sched_find_first_bit(array->bitmap); queue = array->queue + idx; next = list_entry(queue->next, struct task_struct, run_list);