Re: List of Processes

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

 



On Thu, Jul 01, 2004 at 14:47:01 -0400, Benoit Lefebvre wrote:
> There are many type of lock and each of them have their own utility. If you 
> can sleep, semaphore is probably what you'll use. Example:
> 
> static DECLARE_MUTEX(m);
> 
> down(&m);
> /* accessing your global structure */
> up(&m);

It is correct, but not as a reply to the question below. The question
below is specificaly targeted at task_structs and you need to aquite the
existing lock. It follows from the nature of task_struct, that the lock
is a spin_lock, not a semaphore.

> On July 1, 2004 02:29 pm, Greg Nate wrote:
> > 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
> >
> > -----Original Message-----
> > From: kernelnewbies-bounce@nl.linux.org
> > [mailto:kernelnewbies-bounce@nl.linux.org]On Behalf Of Dhiman, Gaurav
> > Sent: Thursday, July 01, 2004 9:27 AM
> > To: Anupam Kapoor; manish regmi
> > Cc: so_usp@yahoo.com.br; kernelnewbies@nl.linux.org
> > Subject: RE: List of Processes
> >
> >
> >
> > We need to acquire lock before accessing any common data structure of
> > kernel. As the "task_struct" list is the common data structure of kernel
> > which is accessed from different places in kernel.
> > We need to acquire the lock for this task list before accessing it, so
> > that when we are accessing the list no other process context or kernel
> > thread should be able to access it.
-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Digital signature


[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