A method of detecting portions of code of a computer program that protect resources of a computer system unnecessarily can include identifying threads and synchronization objects that are used by a computer program during execution, determining the number of threads that have accessed each resource while it has been consistently protected by a particular synchronization object, and indicating whether the resource is suited for protection according to the number of threads that have accessed the resource.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method of detecting portions of code of a computer program that protect resources of a computer system unnecessarily, said method comprising: identifying a synchronization object that has been engaged by a thread of the computer program; while the synchronization object is engaged, determining whether state memory has been allocated for a resource of the computer system that is protected by the synchronization object and, if state memory has not been allocated, allocating state memory for recording accesses to the resource; recording each access of the resource and a thread associated with the access; when the synchronization object is disengaged, determining a number of threads that have accessed the resource while protected by the synchronization object during execution of the computer program; and indicating whether the resource protected by the synchronization object is suited for protection according to the number of threads that accessed the resource while the synchronization object was engaged during execution of the computer program.
2. The method of 1 , said allocating step further comprising apportioning a number of state bits determined according to a number of synchronization objects that have been engaged in the computer program, a number of threads running in the computer program, and a measure of a size of the resource.
3. The method of claim 2 , said recording step further comprising, for each access of the resource, setting at least one bit corresponding to a thread responsible for the access and the synchronization object engaged during the access.
4. The method of claim 1 , said indicating step further comprising, if more than one thread has accessed the resource during an execution of the program under test while the synchronization object was engaged, noting that the resource is suitable for protection by that synchronization object.
5. The method of claim 1 , said indicating step further comprising, if a single thread accessed the resource while the synchronization object was engaged, noting that the resource is unsuitable for protection.
6. The method of claim 1 , further comprising storing a call chain leading to a first access of the resource protected by the synchronization object.
7. The method of claim 6 , said indicating step further comprising: counting a number of instances in which the resource is deemed apparently unsuitable for protection; and if the number of instances exceeds a predetermined threshold, indicating the call chain.
8. A method of detecting portions of code of a multithreaded computer program that cause unnecessary task switching within a computer system comprising: identifying resources protected by synchronization objects during execution of the multithreaded computer program; for each resource that is accessed while a synchronization object is engaged for the resource, determining whether state memory has been allocated; if state memory has not been allocated, allocating state memory for recording accesses to the resource; counting instances during execution of the multithreaded computer program in which a resource that is protected by a synchronization object is accessed by only a single thread that engaged the synchronization object; and indicating that resources accessed by only the single thread that engaged the synchronization object during execution of the multithreaded program are unsuitable for protection by a synchronization object.
9. The method of claim 8 , said allocating step further comprising apportioning a number of state bits determined according to a number of synchronization objects that have been engaged in the multithreaded computer program, a number of threads running in the multithreaded computer program, and a measure of a size of the resource.
10. The method of claim 9 , said identifying step further comprising, for each access of a memory block, setting at least one bit corresponding to the thread responsible for the access and the synchronization object engaged during the access.
11. The method of claim 8 , further comprising storing a call chain leading to a first access of the resource protected by the synchronization object.
12. The method of claim 11 , said indicating step further comprising if the number of instances exceeds a predetermined threshold, indicating the call chain.
13. A machine readable storage, having stored thereon a computer program having a plurality of code sections comprising: code for identifying resources protected by synchronization objects during execution of the multithreaded computer program; code for, for each resource that is accessed while a synchronization object is engaged for the resource, determining whether state memory has been allocated; code for, if state memory has not been allocated, allocating state memory for recording accesses to the resource; code for counting instances during execution of the multithreaded computer program in which a resource that is protected by a synchronization object is accessed by only a single thread that engaged the synchronization object; and code for indicating that resources accessed by only the single thread that engaged the synchronization object during execution of the multithreaded program are unsuitable for protection by a synchronization object.
14. The machine readable storage of claim 13 , said code for allocating further comprising code for apportioning a number of state bits determined according to a number of synchronization objects that have been engaged in the multithreaded computer program, a number of threads running in the multithreaded computer program, and a measure of a size of the resource.
15. The machine readable storage of claim 13 , said code for identifying further comprising code for, for each access of a memory block, setting at least one bit corresponding to the thread responsible for the access and the synchronization object engaged during the access.
16. The machine readable storage of claim 13 , further comprising code for storing a call chain leading to a first access of the resource protected by the synchronization object.
17. The machine readable storage of claim 13 , said code for indicating further comprising code for, if the number of instances exceeds a predetermined threshold, indicating the call chain.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
October 12, 2005
January 10, 2012
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.