Implement the mutex primitive via MI instructions CHKLKVAL and CLRLKVAL.
Written by Junlei Li
Efforts of numerous computer scientists have been devoted to solving performance problems in different performance-critical circumstances. One of these performance problems is the expense in thread synchronization. Thread synchronization is the application of particular mechanisms to ensure that two concurrently executing threads do not execute specific portions of a program at the same time. By using MUTual EXclusion (mutex), access to shared resources from multiple threads can be serialized, and mutually exclusive program logic can be guaranteed to run in a single thread at any time. Thread synchronization is not limited to threads in the same process; it also applies to synchronization between different processes, or in other words, threads in different processes.
In last month's column, "Automating Recovery, Part II," we looked at the Process Commands (QCAPCMD) API and the flexibility the API provides for determining just what went wrong when attempting to run a CL command and the command fails for one reason or another. In this article, we will look at what's available with the API system when it comes to determining what went wrong when a CL command fails in the middle of our RPG application and attempting to recover from the error situation.