ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/concep27.htm

58 lines
2.4 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Read/write locks do not favor writers</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- NETMG2 SCRIPT A converted by B2H R4.1 (346) (CMS) by HOLTJM at -->
<!-- RCHVMW2 on 29 Jan 1999 at 10:01:37 -->
<!--File Edited November 2001 -->
<!--End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>Read/write locks do not favor writers</h2>
<p>The i5/OS implementation of read/write locks does not favor writers. If
your application has a large number of readers contending for the same lock,
the writers may not be allowed to write.</p>
<p>The i5/OS implementation of <strong>pthread_rwlock_tryrdlock</strong>(),
for example, does not completely honor the Single UNIX Specification in its
treatment of reader/writer contention.</p>
<p>The standard states the following: "The function pthread_rwlock_tryrdlock()
applies a read lock as in the pthread_rwlock_rdlock() function with the
exception that the function fails if any thread holds a write lock on rwlock or
there are writers blocked on rwlock."</p>
<p>In the i5/OS implementation, if <strong>pthread_rwlock_tryrdlock</strong>()
is used on a read/write lock that has multiple readers holding the lock and
multiple waiting writers blocked on the lock, the <strong>
pthread_rwlock_tryrdlock</strong>() are allowed to complete successfully.</p>
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center">
<a href="rzah4mst.htm">Pthread APIs</a> |
<a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>