Regarding acquiring a lock: I realize this may be a stupid question, but how does one go about doing this? Can you provide a short code example?
Thanks
one small doubt, shouldn't we be acquiring a lock while iterating over all the tasks ?
anupam
> for_each_task(p)
> {
> ...
> }
>
> You will each task's descriptor on p on each loop. The first one will be
> that of init. You will automatically break from loop when you finish
> traverse through all tasks.
> Actually a circular list.No, Lock is unnecessary here, we are not manipulating the list, just following the link. Lock is necessary if you add or remove from the list.
regards manish
Sorry, It was incorrect. You need a lock. But only a read lock.
For that purpose we have a tasklist_lock defined in sched.h
The implementationm will be,
read_lock(&tasklist_lock); for_each_task(p) { ..... } read_unlock(&tasklist_lock);
regards manish
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/