Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP

HP.com home


Technical Reports



» 

HP Labs

» Research
» News and events
» Technical reports
» About HP Labs
» Careers @ HP Labs
» Worldwide sites
» Downloads
Content starts here

 
Click here for full text: PDF

Reordering Constraints for Pthread-Style Locks

Boehm, Hans-J.

HPL-2005-217

Keyword(s): threads; locks; memory barriers; memory fences; code reordering; data race; pthreads; optimization

Abstract: C or C++ programs relying on the pthreads interface for concurrency are required to use a specified set of functions to avoid data races, and to ensure memory visibility across threads. Although the detailed rules are not completely clear[8], it is not terribly hard to refine them to a simple set of clear and uncontroversial rules for at least a subset of the C language that excludes structures (and hence bit- fields). We precisely address the question of how locks in this subset must be implemented, and particularly when other memory operations can be reordered with respect to locks. Although our precise arguments are limited to a small subset language, we believe that our results capture the situation for a full C/C++ implementation, together with a literal (and reasonable, though possibly unintended) interpretation of the pthread standard. And they appear to have implications for other environments as well. The results appear to be surprising, and to not have been anticipated by pthread implementors, in spite of their significant performance impact on multi-threaded applications. Notes:

9 Pages

Back to Index

»Technical Reports

» 2009
» 2008
» 2007
» 2006
» 2005
» 2004
» 2003
» 2002
» 2001
» 2000
» 1990 - 1999

Heritage Technical Reports

» Compaq & DEC Technical Reports
» Tandem Technical Reports
Printable version
Privacy statement Using this site means you accept its terms Feedback to HP Labs
© 2009 Hewlett-Packard Development Company, L.P.