Procedure Chaining is another avoidance technique. It works by maniuplating the stack return addresses to cause procedures that would otherwise require synchronization to execute serially. For example, imagine a kill signal arriving in the middle of processing an interrupt. In the Synthesis Kernel, the return address of the interrupt handler is modified so that the signal processing code will run immediately after the interrupt handler. Optimistic Synchronization is used whenever the above avoidance techniques cannot be employed.
Data structures are optimistically updated.
At the end of the update, a check is made to see if another thread was simultaneously accessing the data structure. If so, the change is rolled back. Optimistic Queues are an example of a data structure using Optimistic Synchronization. For the SP-SC case, no synchronization is needed, since the producer and consumer operate on different parts of the queue. The loop is only executed if another thread is updating the pointer to the head of the queue, so in the normal case it will either succeed the first time or perhaps execute the loop once.