RE: down_read and uninterruptible sleep

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

 




> -----Original Message-----
> From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-
> bounce@xxxxxxxxxxxx] On Behalf Of Deepak Joshi
> Sent: Thursday, July 21, 2005 6:54 PM
> To: kernel mail
> Subject: down_read and uninterruptible sleep
> 
> hi all,
> 
> I have one doubt related to down_read semaphore
> function. what i read from linux device drivers-3 book
> is
> 
> "A newly initialized rwsem is available for the next
> task(reader or writer) that comes
> along. The interface for code needing read-only access
> is:
>         -- void down_read(struct rw_semaphore *sem);
>         -- int down_read_trylock(struct rw_semaphore
> *sem);
>         -- void up_read(struct rw_semaphore *sem);
> A call to down_read provides read-only access to the
> protected resources, possibly concurrently with other
> readers. Note that down_read may put the calling
> process into an uninterruptible sleep."
> 
> The last statement says that down_read may put the
> calling pocess into an uninterruptible sleep. how and
> in which conditions it might happen as we are just
> reading the shared resource only.

An simple e.g. condition is the situation where rwsem is already
acquired by some writer using down_write.
In that case any down_read call will put the caller in sleep state.

HTH
Sanjay


> 
> plz help me in clearing this doubt.
> 
> Thanks in advance.
> 
> Deepak Joshi
> 
> 
> 
> 
> 
> 
> 
> 
> ___________________________________________________________
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with
> voicemail http://uk.messenger.yahoo.com
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/

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