一张图理解O(1)算法

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


 

 

posted on 2013-10-16 13:20  云编程的梦  阅读(308)  评论(0编辑  收藏  举报

导航