For years, various software applications have included multiple discrete operations that are executed at the same time. Often these operations need to access and manipulate common data at a single memory and/or disk location. If software is not carefully designed, then multiple operations may try to write to a single data location at the same time. This may be referred to as a race condition. Race conditions often result in corrupt data and can cause software applications to generate incorrect results.
Mechanisms called locks have been implemented to prevent race conditions. According to common locking schemes, operations request a “lock” before accessing a data location. If the data location is available, then the lock is granted and the operation is cleared to access the data location. If another operation is accessing the data location, (e.g., another operation has the lock) then the lock request may be denied. The requesting operation may then either terminate, or wait until the lock becomes available.
Although properly implemented locking schemes may prevent many race conditions, they have the capability to create their own problems. For example, an operation A and an operation B may both need to perform tasks that require access to two data locations, X and Y, at the same time. If A holds the lock for X and B holds the lock for Y, then neither application may be able to perform its task. In that case, A and B may each wait indefinitely for both locks to become available, causing the software application to stop or hang-up. This problem, called deadlock, is commonly avoided by using a lock ranking or lock hierarchy. According to a lock ranking, each concurrently executed operation is required to request locks in a particular order. For example, both A and B could be required to request the lock for X before requesting the lock for Y. Accordingly, the situation where both applications hold one, but not both, of the locks can be avoided.
As with all programming methods, specific implementations of locks and lock ranking systems often include bugs. These bugs can be particularly difficult to debug because their symptoms, race and deadlock conditions, are not deterministic and cannot be easily reproduced. For example, a program having a race or deadlock related defect may run flawlessly four times in a row, and then crash on the fifth execution. Adding to the difficulty of finding and correcting for race and deadlock problems is the fact that they are highly dependent on execution timing. For example, latent race or deadlock related problems in an application developed and tested on a first system type may not manifest themselves until the application is run on a faster system.
In one general aspect, embodiments of the invention are directed to methods of monitoring a computer system. The methods may comprise the steps of calculating a first checksum of a data location and receiving a request from an operation running on the computer system for a lock corresponding to the data location. The methods may also comprise the steps of calculating a second checksum of the data location, and generating an indication if the first checksum and the second checksum are not equivalent.
In another general aspect, embodiments of the invention are directed to methods of detecting a lock ranking violation in a computer system. The methods may comprise the steps of receiving a request from an operation for a first lock associated with a first data storage location and reviewing a list of locks issued to the operation. The methods may also comprise the step of determining whether the operation possesses a lock ranked higher than the first lock.
Embodiments of the present invention are described herein, by way of example, in conjunction with the following figures, wherein:
As used herein, the term “operation” refers to a series of instructions that may be executed by a processor or processors to carry out a specific purpose or purposes (e.g., a thread, a process, a fiber, a task, a job, a transaction, etc.). Also, as used herein, the term “application” may refer to a piece of software that may include one or more operations. For example, an application may be a user application, an operating system component or service, etc.
Various embodiments of the present invention are directed to lock utility functionality that may be used to detect lock-related defects in software applications. After lock-related defects are detected, they may be documented for debug purposes. In various embodiments, detected defects may be handled at run-time.
In various embodiments, the operations 104 may access various system resources, such as data storage locations, external hardware devices, etc., via operating system 106. The operating system 106 may be any suitable operating system. For example, in various non-limiting embodiments, the operating system 106 may be any version of MICROSOFT WINDOWS, any UNIX operating system, any Linux operating system, OS/2, any version of Mac OS, etc. For example, the operating system 106 may allow the operations 104 to access and manipulate data stored at data storage 108.
Data storage 108 may include any kind of storage drive or memory capable of storing data in an electronic or other suitable computer-readable format. In certain non-limiting embodiments, data storage 108 may include a single fixed disk drive, an array of disk drives, an array of disk drives combined to provide the appearance of a larger, single disk drive, a solid state drive, etc. The physical components making up data storage 108 may be located at a single location, or multiple locations. Data storage 108 may include one or more discrete data locations 109 where data may be stored. In various embodiments, data locations 109 may include a single addressable location, or a range of addressable locations.
It will be appreciated that the lock utility functionality described herein may be implemented by various pieces of the system architecture 100. For example, in various embodiments, all of the functionality may be implemented by the lock utility 102. In that case, the lock utility may receive requests to access data locations 109, determine whether locks should be issued, issue locks, etc., for example, as described below. In various embodiments, the lock utility 102 may implement its functionality in conjunction with the operating system 106 and/or a component thereof. For example, in various embodiments, the lock utility may receive requests to access data locations 109, and may determine whether a lock should issue, etc., but the actual issuance of locks and access to data locations 109 may be handled by the operating system 106. It will be appreciated that in other various embodiments, all lock functionality may be implemented by the operating system 106 or a component thereof.
Referring back to decision step 208, if the checksum is not valid, it may indicate that the data at location 109 has been modified by a system entity that did not follow the proper locking procedure (e.g., a locking violation may have occurred). As a result, the data at location 109 may be corrupted and may cause an error if the operation 104, or even the application 105 associated with the operation 104, is allowed to continue. Accordingly, the operation 104 or application 105 may be aborted at step 212 to avoid or minimize errors due to potentially corrupted data. A report describing the circumstances of the abort may be generated at step 214. The report may identify the data location 109 at issue, operations 104 that have recently held the lock 111, the operation 104 that made the request, the various checksums, etc. The report may be used by quality assurance personnel or other debuggers to identify and/or isolate underlying problems in the application 105 or operating system 106 that caused the unauthorized access.
Referring back to
After comparing the rank of the requested lock 111 to those locks already held' by the operation 104, it may be determined, at step 304, whether a lock rank violation will occur if the requested lock 111 is issued to the operation 104. For example, a lock rank violation may occur if the operation 104 already possesses one or more locks that are ranked higher than the requested lock 111 in the predetermined lock ranking (e.g. if the operation 104 already possesses a lock that should be obtained after the requested lock). If this is the case, then issuing the lock 111 to the operation 104 may cause a lock rank violation. If no potential lock rank violation is found, then the lock 111 may be issued to the operation at step 310.
If issuing the requested lock 111 to the operation 104 will cause a rank violation, then various steps may be taken. For example, as shown in
In various embodiments, as shown by process flow 400 in
In other various embodiments, potential lock ranking violations may be corrected, for example, as shown by process flow 500 of
The various devices 602, 604, 606 of the computer system 600 may generally store resources and/or execute software that may allow users (not shown) of the system 600 to perform various tasks, (e.g., use and/or manipulate the resources). User devices 602 may include any kind of device that allows a user to execute software, or access another device that may execute software (e.g., server 604). Example user devices 602 include a desktop computer, a laptop computer, a handheld computer, a personal digital assistant (PDA), etc. The user devices 602 may be used to monitor and/or manipulate software running on other components of the system 600 (e.g., the server 604), or access resources stored on other components of the system 600 (e.g., database 606). In various embodiments, however, user devices 602 may also store resources and/or execute software.
It is to be understood that the figures and descriptions of the present invention have been simplified to illustrate elements that are relevant for a clear understanding of the present invention, while eliminating other elements, for purposes of clarity. Those of ordinary skill in the art will recognize that these and other elements may be desirable. However, because such elements are well known in the art and because they do not facilitate a better understanding of the present invention, a discussion of such elements is not provided herein.
As used herein, a “computer,” “computer system,” and the like, may be, for example and without limitation, either alone or in combination, a personal computer (PC), server-based computer, main frame, server, microcomputer, minicomputer, laptop, personal data assistant (PDA), cellular phone, pager, processor, including wireless and/or wireline varieties thereof, a virtual computer system and/or any other computerized device or construct capable of configuration for processing data for standalone application and/or over a networked medium or media. Computers and computer systems disclosed herein may include operatively associated memory for storing certain software applications used in obtaining, processing, storing and/or communicating data. It can be appreciated that such memory can be internal, external, remote or local with respect to its operatively associated computer or computer system. Memory may also include any means for storing software or other instructions including, for example and without limitation, a hard disk, an optical disk, floppy disk, ROM (read only memory), RAM (random access memory), PROM (programmable ROM), EEPROM (extended erasable PROM), and/or other like computer-readable media.
The described systems may include various modules and/or components implemented as software code to be executed by a processor(s) of the systems or any other computer system using any type of suitable computer instruction type. The software code may be stored as a series of instructions or commands on a computer readable medium. The term “computer-readable medium” as used herein may include, for example, magnetic and optical memory devices such as diskettes, compact discs of both read-only and writeable varieties, optical disk drives, and hard disk drives. A computer-readable medium may also include memory storage that can be physical, virtual, permanent, temporary, semi-permanent and/or semi-temporary. A computer-readable medium may further include one or more data signals transmitted on one or more carrier waves.
While several embodiments of the invention have been described, it should be apparent that various modifications, alterations and adaptations to those embodiments may occur to persons skilled in the art with the attainment of some or all of the advantages of the present invention. It is therefore intended to cover all such modifications, alterations and adaptations without departing from the scope and spirit of the present invention.
This application is a continuation of U.S. patent application Ser. No. 11/505,582 filed on Aug. 17, 2006 now U.S. Pat. No. 7,512,748, which is incorporated herein by reference in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
4135240 | Ritchie | Jan 1979 | A |
4959811 | Szczepanek | Sep 1990 | A |
4984153 | Kregness et al. | Jan 1991 | A |
5027395 | Anderson et al. | Jun 1991 | A |
5488701 | Brady et al. | Jan 1996 | A |
5506983 | Atkinson et al. | Apr 1996 | A |
5530850 | Ford et al. | Jun 1996 | A |
5537588 | Engelmann et al. | Jul 1996 | A |
5551003 | Mattson et al. | Aug 1996 | A |
5606983 | Monty et al. | Mar 1997 | A |
5652879 | Harris et al. | Jul 1997 | A |
5664178 | Sinofsky | Sep 1997 | A |
5706504 | Atkinson et al. | Jan 1998 | A |
5715441 | Atkinson et al. | Feb 1998 | A |
5734861 | Cohn et al. | Mar 1998 | A |
5752252 | Zbikowski et al. | May 1998 | A |
5757915 | Aucsmith et al. | May 1998 | A |
5764880 | Gerdt et al. | Jun 1998 | A |
5781797 | Crick et al. | Jul 1998 | A |
5799324 | McNutt et al. | Aug 1998 | A |
5802344 | Menon et al. | Sep 1998 | A |
5832515 | Ledain et al. | Nov 1998 | A |
5857207 | Lo et al. | Jan 1999 | A |
5873097 | Harris et al. | Feb 1999 | A |
5923878 | Marsland | Jul 1999 | A |
5991893 | Snider | Nov 1999 | A |
5996054 | Ledain et al. | Nov 1999 | A |
6006227 | Freeman et al. | Dec 1999 | A |
6021408 | Ledain et al. | Feb 2000 | A |
6021509 | Gerdt et al. | Feb 2000 | A |
6038668 | Chipman et al. | Mar 2000 | A |
6065100 | Schafer et al. | May 2000 | A |
6079047 | Cotugno et al. | Jun 2000 | A |
6101186 | Craig | Aug 2000 | A |
6108420 | Larose et al. | Aug 2000 | A |
6128630 | Shackelford | Oct 2000 | A |
6148368 | DeKoning | Nov 2000 | A |
6240527 | Schneider | May 2001 | B1 |
6260036 | Almasi et al. | Jul 2001 | B1 |
6321239 | Shackelford | Nov 2001 | B1 |
6336164 | Gerdt et al. | Jan 2002 | B1 |
6347397 | Curtis | Feb 2002 | B1 |
6366987 | Tzelnic et al. | Apr 2002 | B1 |
6377958 | Orcutt | Apr 2002 | B1 |
6381682 | Noel et al. | Apr 2002 | B2 |
6418509 | Yanai et al. | Jul 2002 | B1 |
6430548 | Deis et al. | Aug 2002 | B1 |
6438594 | Bowman-Amuah | Aug 2002 | B1 |
6449688 | Peters et al. | Sep 2002 | B1 |
6490664 | Jones et al. | Dec 2002 | B1 |
6526570 | Click, Jr. et al. | Feb 2003 | B1 |
6529909 | Bowman-Amuah | Mar 2003 | B1 |
6535949 | Parker | Mar 2003 | B1 |
6577254 | Rasmussen | Jun 2003 | B2 |
6597812 | Fallon et al. | Jul 2003 | B1 |
6601104 | Fallon | Jul 2003 | B1 |
6604158 | Fallon | Aug 2003 | B1 |
6624761 | Fallon | Sep 2003 | B2 |
6625671 | Collette et al. | Sep 2003 | B1 |
6628411 | Miller et al. | Sep 2003 | B2 |
6633244 | Avery et al. | Oct 2003 | B2 |
6633883 | Koskas | Oct 2003 | B2 |
6643405 | Sako | Nov 2003 | B1 |
6643652 | Helgeson et al. | Nov 2003 | B2 |
6654851 | McKean | Nov 2003 | B1 |
6657565 | Kampf | Dec 2003 | B2 |
6664903 | Kugai | Dec 2003 | B2 |
6704839 | Butterworth et al. | Mar 2004 | B2 |
6711709 | York | Mar 2004 | B1 |
6732125 | Autrey et al. | May 2004 | B1 |
6738863 | Butterworth et al. | May 2004 | B2 |
6741747 | Burns et al. | May 2004 | B1 |
6775781 | Phillips et al. | Aug 2004 | B1 |
6782319 | McDonough | Aug 2004 | B1 |
6785768 | Peters et al. | Aug 2004 | B2 |
6795640 | Honda | Sep 2004 | B1 |
6795897 | Benveniste et al. | Sep 2004 | B2 |
6847681 | Saunders et al. | Jan 2005 | B2 |
6856993 | Verma et al. | Feb 2005 | B1 |
6901403 | Bata et al. | May 2005 | B1 |
6944619 | Gruenwald | Sep 2005 | B2 |
6983456 | Poznanovic et al. | Jan 2006 | B2 |
7051031 | Schein | May 2006 | B2 |
7085766 | Keith, Jr. | Aug 2006 | B2 |
7088823 | Fetkovich | Aug 2006 | B2 |
7107267 | Taylor | Sep 2006 | B2 |
7191189 | Bhatti | Mar 2007 | B2 |
7340581 | Gorobets et al. | Mar 2008 | B2 |
7370319 | Pensak et al. | May 2008 | B2 |
7392383 | Basibes et al. | Jun 2008 | B2 |
7428547 | Basso et al. | Sep 2008 | B2 |
7444625 | Anwar et al. | Oct 2008 | B2 |
7454411 | Birdwell et al. | Nov 2008 | B2 |
7523221 | Hillberg | Apr 2009 | B2 |
7530016 | Sahota et al. | May 2009 | B2 |
7536418 | Buchsbaum et al. | May 2009 | B2 |
20020052868 | Mohindra et al. | May 2002 | A1 |
20020073066 | Coutts et al. | Jun 2002 | A1 |
20020143735 | Ayi et al. | Oct 2002 | A1 |
20030110478 | Duesterwald et al. | Jun 2003 | A1 |
20030123446 | Muirhead et al. | Jul 2003 | A1 |
20040015958 | Veil et al. | Jan 2004 | A1 |
20050144189 | Edwards et al. | Jun 2005 | A1 |
20050240966 | Hindle et al. | Oct 2005 | A1 |
20060031246 | Grayson | Feb 2006 | A1 |
20060070076 | Ma | Mar 2006 | A1 |
20060101025 | Tichy et al. | May 2006 | A1 |
20060123250 | Maheshwari et al. | Jun 2006 | A1 |
20060195476 | Nori et al. | Aug 2006 | A1 |
20060277153 | Mason et al. | Dec 2006 | A1 |
20080134154 | Patel et al. | Jun 2008 | A1 |
20080270587 | Mason et al. | Oct 2008 | A1 |
20090249277 | Prakash | Oct 2009 | A1 |
Number | Date | Country | |
---|---|---|---|
Parent | 11505582 | Aug 2006 | US |
Child | 12388712 | US |