回复:Re: How can I wake up one process from the wait queue?

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

 



Hi, Raghavendra, pranjas:


Thanks for your reply, add_wait_queue_exclusive() is perfect.


----- 原始邮件 -----
发件人:Raghavendra <arrao@xxxxxxx>
收件人:kernelnewbies@xxxxxxxxxxxxxxxxx
主题:Re: How can I wake up one process from the wait queue?
日期:2014年10月30日 16点52分

On Thursday 30 October 2014 02:02 PM, Rock Lee wrote:

Hi, everyone

I am implementing a simple driver to experiment with wait queue.Two or more read processes block until a write process changes a flag and call wake_up_interruptible().I expect that a write process will only wake up one read process.However, once a write process calls  wake_up_interruptible() , all the read processes are awaken. How can I wake up one process from the wait queue?

You can use exclusive wait queues, which wakes up only one process from the queue.

Although the general idea that is followed is: all the process are woken up once the resource is made available. And then the access to that resource is guarded by a lock, which in turn allows only one process to access the resource. Rest of the processes are pushed backed to sleep(or busy wait).

-------------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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