Hi Fabio, My understanding: Semaphore are the tools to protect a region of code by bloking access to other threads access while the first thead is accessing it. Let it be any semaphore this is what it does.
global x; up /* critical section - any thing*/ *fpos+=count; mystruct->size = *fpos; mystruct->xxx = *fpos+ count; down What u say is: What you are missing is that, in reading, there is NO manipulation of the data you read. These are what are protected. But, there is something like which from location u read and till which location which are part of kernel file attributes. Is there no need to protect them? or some location updates to my own structure which I have to make for future use. - Bhanu On 4/1/08, Fabio De Francesco <[EMAIL PROTECTED]> wrote: > On Tuesday 01 April 2008 23:57:47 bhanu nani wrote: > >Hi guys, > > > >I was studying on reader-writer semaphores in LLD3. Refered to some > >samaphore books. but some clarity is missing. > > > >Reader/Writer Semaphores: > >The critical section between down_read, up_read semaphores provides > >read-only access to the protected resources. > > > >I assume that any data in between thi calls is considered protected > >resources. > >As there is no data manipulation what it means is reader1/ reader2 can > >execute the same instrction simultaniously. but how is that possible. > >How can a perform a read a read aeithout data manipulation i.e. > >updating user buffers, updatinf the fpos, count. Will these not need > >protection between the readers themselves i.e. reader1, reader2, > >...readerN > > > >How does this happen? > > > >Regards, > > > >Bhanu > > Dear Bhanu, > > What you are missing is that, in reading, there is NO manipulation of the > data you read. These are what are protected. Buffers, fpos, counters and > anything needed to comply are not part of the kernel structure the semaphore > is protecting. > > You talked about "USER buffers...". May be you meant "PROCESS" ones. You > forget that any process, in kernel mode, has his working memory: read 'Kernel > Stack'. > > Regards, > > fabio de francesco > > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to [EMAIL PROTECTED] > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ