Hi:
I want to do somework on postgresql's parallelization. I found that
postgresql uses two kinds of locks: semaphores and spinlocks. The
platform I used now is linux-elf's. In such platform, the default
options is spinlocks. The question is: if two processes(p1 and p2) use
spinlocks for mutex using of resource, and p1 acquires the lock and p2
has to wait for the lock and enter suspended state. When p1 release the
lock, is p2 be activated by os?
The real situation is: I want to implement a parallel backend through
multi engines and multi I/O processes in multi PCs. Each PC contains an
engine and an I/O process. The engine and I/O process share the same
buffer pool and through spinlock to mutex-use the buffer pool. They use
spinAcquire and SpinRelease to acquire and release the lock. After the
engine acquires the lock, if the I/O process needs the lock,it has to
wait and enter suspended state. When the engine releases the lock, the
I/O process seems to remain suspended.
Do semaphores and spinlock have the functions. If one process is
blocked by the lock or semaphore, when the lock is released, is the
process be activated automatically by os?
Thanks in advances!
SQYang