read-write spinlocks ??

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

 



Hi,

I read the document related to spinlocks in Documentation directory of
kernel sources. Actually that doc is the reply from Linus to someone's
query on mailing list.
After reading that, I have a question related to read-write spinlocks:

- As said in that document (Lesson 2 in that document), if we use
read-write spinlocks, many readers can be in critical section at same
time, but only one writer can be there in critical section. Does this
mean, a situation like where one writer and many readers can be in
critical section at same time, if yes, wont this lead to a problamatic
situation as follows. Lets say we have a read-write spinlock on linked
list and there are many reader traversing it and one writer updating
it. If one reader is on a particular node and at the same time that
node is deleted by the writer running on another CPU and it frees the
node memory, wont the reader reading that node on other CPU put the
system to crash ?
I think if we allows the writer to be in critical section, no one else
(not even readers) should be allowed there in critical section,
because writer may effect what the reader are reading and a situation
like above (if I am correct) can lead to crashes.

Please correct me whereever I am wrong.

-gd

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