On Sun, 2003-12-07 at 13:01, Shinpei Kato wrote: > I see! Can I ask one more thing. Look at following codes. > > ++++ > #define BITMAP_SIZE ((((MAX_PRIO+1+7)/8)+sizeof(long)-1)/sizeof(long)) > > struct prio_array { > int nr_active; > unsigned long bitmap[BITMAP_SIZE]; > struct list_head queue[MAX_PRIO]; > }; > ++++ > > The default MAX_PRIO is defined 140 and if we assume the size of long is > 32 bits, BITMAP_SIZE comes to be ((((140+1+7)/8)+4-1)/4)) = 5. So a > range of b[0] to b[4] is related to MAX_PRIO, isn't it? Yup. What BITMAP_SIZE does is find the smallest array of longs that would fit MAX_PRIO bits. That size is 5 on 32-bit machines, since (5*32=160) > (MAX_PRIO=140) > (4*32=128). And that b[0]..b[4] is exactly what sched_find_first_bit() checks. So b[0] is the first 32-bits, corresponding to priority 0..31, etc. > > Looking at the source helps a lot. > > Certainly. > > Thank you for your sharing your time to explain details. No problem. Good luck. Rob Love -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/