Saturday, May 11, 2024

Global Lock

Global locks are created for sets of global supervisory functions that have minimal interaction among them. There are separate global lock for dispatcher, storage manager, I/O and a miscellaneous functions. 

Global locks are larger disabled spin lock (vs local lock is enabled spin lock). The holder of the lock will disabled interrupt  the waiter of the lock will be spinning enabled for interrupter (external interrupt). Even page fault is disabled when holding the global lock  

I/O and storage manager covers a vast area of functions. Thus they sub-divide their area into multiple locks 

Cross memory service locks is a global lock that holder can be run in enabled state. 

Both global and local lock owner cannot issue SVC. 

Local Lock

There is one local lock in each address space. Local lock is obtained with interrupt enabled. When the function holding local lock is interrupted, dispatcher will not dispatch new TCB in the address space. When the interrupt is handled, the function holding the lock is re-dispatched to let it finishes its work quickly, even though there may be other work that has higher priority is ready. 

If a TCB is already running on another cpu while a local lock is obtained by the current task, dispatcher will let that TCB continue to run until it releases control or interrupted.  But then that TCB will remain suspended until the local lock is released by the current task. 

When a normal task is interrupted, system saved its registers in the IHSA (interrupt handler save area). But if the task is holding a local lock when it is interrupted, the register is saved in a different location. 

Local lock can be requested either as spin or suspend lock.