Messages in this thread | | | Date | Thu, 22 Apr 1999 03:46:00 +0530 (IST) | From | V Ganesh <> | Subject | Re: mutexs for synchronization between kernel threads? |
| |
> Well, under 2.2.6 spin_lock and spin_unlock in the non SMP case are > NOOPS (do { } while(0)). This is not what I want.
no, this _is_ what you want. remember that on UP, a kernel thread cannot thread can be pre-empted unless it voluntarily blocks. this itself guarantees mutual exclusion for your threads A and B. that's why spinlocks are no-ops in UP. what this means is that A and B do not run in "parallel". however, interrupts may occur "in parallel" or asynchronous with A and B, so you need to protect against them. that's why you use spinlock_irqsave and spinlock_irqrestore to protect your structures in A and B rather than plain spinlocks. they work out to save_flags(flags);cli() and restore_flags(flags) in UP which is exactly what you want.
ganesh
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |