Hi! On 11:58 Wed 15 Sep , Smital Desai wrote: > Hi everyone, > > It's an extract in LDD3 , regarding spink lock. I have put my query in brackets. > > Spinlocks are, by their nature, intended for use on multiprocessor systems, although a uniprocessor workstation running a preemptive kernel behaves like SMP, as far as concurrency is concerned. > ( I need to understand , how this is true with an example preferably ) There is a timer interrupt on every system which causes the cpu to stop processing whatever it is processing to run the scheduler. The scheduler will start a different task. This way it looks like all tasks run at the same time. > If a nonpreemptive uniprocessor system ever went into a spin on a lock, it would spin forever; no other thread would ever be able to obtain the CPU to release the lock. For this reason, spinlock operations on uniprocessor systems without pre-emption enabled are optimized to do nothing, with the exception of the ones that change the IRQ masking status. > ( I don't get the meaning of last sentence "with the exception of ......" Please can somebody explain ) There are many variants of spin_(un)lock. Some of them (e.g. spin_lock_irq + spin_lock_irqsave) turn off interrupts, so that nothing else can get in the way of critical sections. -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ