Thread safe circular buffer.

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

 



Hi,
I am reading ldd3 and i am trying to understand how a circular buffer without 
locking works. 
If there is one writer and multiple readers. The writer has a pointer to head. 
the readers each have a pointer of their own to tail. Assumming the head 
can't circle on the tail in time, everything is peachy.
However, in ldd3 the readers are sharing the tail pointer, how can this be 
alright? (See the code in ldd3->interrupt handling->Implementing a handler)
At the very least you should somehow atomically grab the tail into a local var 
and also atomically increase the tail position all in one go so you won't get 
a race condition.
Either that, or i did not understand the code.
10x.

-- 
Regards,
        Tzahi.
--
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS:  see at 
http://members.lycos.co.uk/my2nis/spamwarning.html

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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