Hi everyone,
I have a very special spinlock question which I am not able to get an
appropriate answer by carefully reading any documentation.
Consider two different spinlocks: Spinlock A & Spinlock B (Systemspinlocks)
There is a hardware port that should be protected against multiple accesses:
Port
For accessing the port, i acquire let's say Spinlock A (Implying that i
release spinlock after access properly).
Due to different instances of the class that handles "Port out" and "Port
in" i also have different spinlock objects therefor it might happen that
concurrently accesses to the port are protected by different instances of the
spinlockobject.
The big question is: Is this approach practically save in a SMP environment?
The background: We are in need of a very high accurate port frequency near
to realtime, so using other dispatchobjects like mutex, events, asf. is
absolutely inadequate (we already tried them)
As i know, by acquiring the spinlock, priority is increased to
DISPATCH_LEVEL, but due to the nature of SMP paralleltasking i presume that
another CPU might get a different spinlock instance even though other CPU
owns the other spinlock instance.
Or is any spinlock instance atomically?
The other question is: Is process/thread scheduling in general prohibited
during spinlock holding or is this regarding just the CPU on which the
spinlock is held?