HDK Technical Reference

Locks, non-DDI

The SVR5 kernel primitives used for locking behave differently for different versions of SVR5. DDI-conformant drivers are not affected, but kernel code (such as filesystems) for which no defined interface is available may be affected by changes made for UnixWare 7 Release 7.2.

This change affects kernel code that access the following structures directly:

read/write spin lock

sleep lock

read/write sleep lock

and kernel code that calls any of the following macros:






The changes implemented for UnixWare 7 Release 7.2 restore older implementations of sleep locks, read-write sleep locks, and read-write spin locks to improve performance and maintainability.

For background, the implementation of locked instructions in kernel and binary code was modified in SCO SVR5 2.0 because such instructions resulted in significant bus activity in the Pentium® processor. Because of the bus activity associated with locked instructions, reducing locked instructions helped to increase performance and scalability. Reducing bus locks and increasing the write sync operations improved performance on Pentium hardware but added complexity to kernel synchronization activities.

While the tradeoff of bus locks for write syncs was a good performance tradeoff for the early Pentium processors, it is not a good tradeoff for more recent IA-32 processors, in which bus locks are less expensive and write syncs are more expensive than they were for the Pentium. Consequently, restoring the old implementations of sleep locks, read-write sleep locks, and read-write spin locks improves performance for most current processors while simplifying the code and making it more reliable and easier to maintain.

Restoring the old implementation also restores the policy that forces readers of read/write locks to wait behind requesting writers, even if the lock is held in read mode. This eliminates the possibility that requesting writers could be delayed indefinitely, which, while unlikely, is a possibility in SVR5 Releases 7.0 and 7.1.

All device drivers should be written to use a DDI version and so are unaffected by this change; see ``DDI interface versioning'' for information about the DDI scheme and ``Synchronization primitives'' for a list of DDI-conformant locking and synchronization primitives.

These changes are source-compatible so recompiling any modules that access these primitives for the appropriate platform is adequate to resolve any issues that may arise.

© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005