Re: List of Processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.
>
> #define for_each_task(p) \
>         for (p = &init_task ; (p = p->next_task) != &init_task ; )
>
> regards manish
>

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

_________________________________________________________________
The new MSN 8: smart spam protection and 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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux