EDEADLK
Some threads implementations return the EDEADLK error when a mutex attempts to relock a mutex that it already owns. The POSIX standard specifies that the results are undefined when a mutex is re-locked by the owner. The Single UNIX® Specification addresses these issues by providing a new mutex attribute called type.
The IBM® i threads support takes the same implementation route that the Single UNIX Specification suggests, and it also causes the thread to deadlock when it attempts to re-lock a normal (non-recursive) mutex. Because many users of Pthreads do not check return codes from functions, the deadlock protects applications from corrupted data that might result if they attempt to relock an already held mutex, then unlock the mutex as if the lock was successful.
Single UNIX Specification
The Single UNIX Specification is the standard in which the core interfaces of a UNIX OS are measured. The UNIX standard includes a rich feature set, and its core volumes are simultaneously the IEEE Portable Operating System Interface (POSIX) standard and the ISO/IEC 9945 standard. The specification encompasses the base operating system environment, networking services, windowing system services, and internationalization aspects and programming languages. The latest version of the certification standard is UNIX V7, aligned with the Single UNIX Specification Version 4, 2018 Edition.
Read or download the Single UNIX Specification here.
The Open Group Governing Board UNIX Systems Work Group sets the strategy and influences the direction for the evolution of the Single UNIX Specification. The Work Group is comprised of The Open Group Platinum Members, all industry leaders each with a representative on The Open Group Governing Board. A few examples of UNIX based operating systems are IBM® AIX®, HPE™ HP-UX®, Oracle® Solaris®, and Inspur® K-UX.
Deadlocks
In concurrent computing, deadlock is any situation in which no member of some group of entities can proceed because each waits for another member, including itself, to take action, such as sending a message or, more commonly, releasing a lock. Deadlocks are a common problem in multiprocessing systems, parallel computing, and distributed systems, because in these contexts systems often use software or hardware locks to arbitrate shared resources and implement process synchronization.
In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process. If a process remains indefinitely unable to change its state because resources requested by it are being used by another process that itself is waiting, then the system is said to be in a deadlock.
In a communications system, deadlocks occur mainly due to loss or corruption of signals rather than contention for resources.