US 12,379,974 B2
Data race detection with per-thread memory protection
Sangho Lee, Bellevue, WA (US); and Adil Ahmad, West Lafayette, IN (US)
Assigned to Microsoft Technology Licensing, LLC, Redmond, WA (US)
Filed by Microsoft Technology Licensing, LLC, Redmond, WA (US)
Filed on Dec. 15, 2022, as Appl. No. 18/082,444.
Application 18/082,444 is a division of application No. 16/752,470, filed on Jan. 24, 2020, granted, now 11,556,395.
Prior Publication US 2023/0119005 A1, Apr. 20, 2023
Int. Cl. G06F 9/52 (2006.01); G06F 9/54 (2006.01); G06F 11/362 (2025.01); G06F 12/084 (2016.01); G06F 12/10 (2016.01)
CPC G06F 9/526 (2013.01) [G06F 9/544 (2013.01); G06F 11/3624 (2013.01); G06F 11/3632 (2013.01); G06F 12/084 (2013.01); G06F 11/3636 (2013.01); G06F 12/10 (2013.01); G06F 2212/657 (2013.01)] 20 Claims
OG exemplary drawing
 
1. A method for data race detection during execution of a multi-threaded program comprising one or more critical sections, the method using a set of access keys available to protect memory objects in the one or more critical sections, wherein each memory object is protected by only one of the access keys at a time, the method comprising:
maintaining, in one or more machine-readable media, a first subset of the set of access keys, the first subset consisting of access keys currently not held by any of multiple threads and thus available for acquisition;
maintaining, in the one or more machine-readable media, multiple second subsets of the set of access keys, each of the second subsets associated with one of the multiple threads and consisting of access keys held by that thread, the first subset and the multiple second subsets collectively containing all keys of the set of access keys available to protect the memory objects in the one or more critical sections of the program, wherein an access key is removed from the first subset upon acquisition from the first subset by any of the multiple threads and added back to the first subset upon release by that thread;
maintaining, in the one or more machine-readable media, one or more third subsets of the set of access keys, each of the one or more third subsets associated with one of the one or more critical sections of the program, each access key within one of the one or more third subsets of access keys being one of the keys of the set of access keys and being associated with a memory object to be accessed within the respective critical section, at least one of the third subsets comprising at least two access keys; and
detecting, by a computer processor, an attempt of one of the multiple threads to access a memory object whose associated access key is held by another one of the multiple threads, and registering a data race in response thereto.