RE: Mutual Exclusion in Kernel

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

 



   
 
 
On Wed, 06 Oct 2004 peyush wrote : 
 
Actually, for Non-SMP you don't need spinlock as they are for SMP mutual 
exclusion thing, because 
 
For UP machine with non-preemptible Kernel you don't need anything but disable 
interrupts before entering into the critical section. 
For UP machine with preemptible kernel you need can use semaphore 
 
Thanks. 
Sumit Sharma 
IBM, Bangalore. 
 
>Don't we have to worry about SMP and Non SMP systems ? 
> 
>If it is Non SMP, I guess we can *NOT* use spinlocks --UNLESS-- it 
>internally takes care of it? 
> 
>Documentation/spinlocks.txt inside kernel source code says that, but was 
>just wondering how ? 
> 
>Regards, 
>Peyush Marwaha 
> 
>-----Original Message----- 
> From: kernelnewbies-bounce@xxxxxxxxxxxx 
>[mailto:kernelnewbies-bounce@xxxxxxxxxxxx]On Behalf Of Brandon Niemczyk 
>Sent: Wednesday, October 06, 2004 12:11 PM 
>To: Kenel Newbies 
>Subject: RE: Mutual Exclusion in Kernel 
> 
> 
>---------- Forwarded message ---------- 
> From: Brandon Niemczyk <bniemczyk@xxxxxxxxx> 
>Date: Wed, 6 Oct 2004 02:35:48 -0400 
>Subject: Re: Mutual Exclusion in Kernel 
>To: Ankit Jain <ankitjain1580@xxxxxxxxx> 
> 
> 
>check robert love's book, i think you'll find it's sections on locking 
>useful. 
> 
>IIUC a spinlock is a lock that doesn't cause sleeping (as opposed to a 
>semaphore which does) 
> 
>taken directly from love's book 
> 
>--------------------------------------------------- 
>spinlock_t mr_lock = SPIN_LOCK_UNLOCKED; 
> 
>spin_lock(&mr_lock); 
>/* critical region */ 
>spin_unlock(&mr_lock); 
>---------------------------------------------------- 
> 
> 
> 
> 
>On Wed, 6 Oct 2004 06:50:17 +0100 (BST), Ankit Jain 
><ankitjain1580@xxxxxxxxx> wrote: 
> > hi 
> > 
> > what is spin lock? 
> > 
> > thanks 
> > 
> > ankit 
> > 
> > 
> > --- "Dhiman, Gaurav" <Gaurav.Dhiman@xxxxxx> wrote: 
> > > 
> > > Use either semaphore or spin locks for mutual 
> > > exclusion 
> > > 
> > > Gaurav 
> > > 
> > > 
> > > -----Original Message----- 
> > > From: kernelnewbies-bounce@xxxxxxxxxxxx 
> > > [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf 
> > > Of Rakesh Jagota 
> > > Sent: Wednesday, October 06, 2004 9:03 AM 
> > > To: kernelnewbies 
> > > Subject: Mutual Exclusion in Kernel 
> > > 
> > > Hello All, 
> > > 
> > > I have defined one array of structures in the kernel 
> > > which can be seen 
> > > by 
> > > all the modules. Now I would like to have mutual 
> > > exclusion , that is if 
> > > any 
> > > module is accessing the array ,no other module 
> > > should not access the 
> > > same 
> > > array, since it is a global array. 
> > > 
> > > Thanks in advance 
> > > 
> > > Regards 
> > > Rakesh 
> > > 
> > > 
> > > -- 
> > > 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/ 
> > > 
> > > 
> > 
> > 
________________________________________________________________________ 
> > Yahoo! Messenger - Communicate instantly..."Ping" 
> > your friends today! Download Messenger Now 
> > http://uk.messenger.yahoo.com/download/index.html 
> > - 
> > To unsubscribe from this list: send the line "unsubscribe linux-newbie" in 
> > the body of a message to majordomo@xxxxxxxxxxxxxxx 
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html 
> > Please read the FAQ at http://www.linux-learn.org/faqs 
> > 
> 
> 
>-- 
>Brandon Niemczyk 
>http://bniemczyk.doesntexist.com 
> 
> 
>-- 
>Brandon Niemczyk 
>http://bniemczyk.doesntexist.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