US 7039865 B1 Abstract A system and method for executing computational operations upon elements of a data structure. The method includes determinations of the commutativity of the computational operations. If the computational operations are determined to be commutative the computational operations are executed regardless of order.
Claims(9) 1. A computer readable medium containing computer readable code, the medium comprising:
a code segment for executing two computational operations if either computational operation does not violate a limit, and both computational operations do not operate upon a same element of a data structure;
a code segment for executing the two computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are addition operations; and
a code segment for executing the computational operations if one but not the other of the computational operations violates the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element.
2. A method for executing two computational operations upon elements of a data structure, the method comprising the steps of:
determining if one or more of two computational operations does not violate a limit;
executing the two computational operations if either computational operation does not violate the limit, and both computational operations do not operate upon a same element;
executing the two computational operations if:
both computational operations operate upon the same element,
both computational operations are addition operations, and
one or none of the computational operations violate a limit, but not if both of the two computational operations violate a limit; and
executing the computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element.
3. A method for executing two computational operations upon elements of a data structure, the method comprising the steps of:
executing the two computational operations if either computational operation does not violate a limit, and both computational operations do not operate upon a same element;
executing the two computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are addition operations;
executing the computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element; and
executing the two computational operations if one but not the other of the computational operations violates a limit, and both computational operations do not operate upon a same element.
4. A method comprising:
executing two computational operations if either computational operation does not violate a limit, and both computational operations do not operate upon a same element of a data structure;
executing the two computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are addition operations; and
executing the computational operations if one but not the other of the computational operations violates the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element.
5. A system comprising:
means for executing two computational operations if either computational operation does not violate a limit, and both computational operations do not operate upon a same element of a data structure;
means for executing the two computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are addition operations; and
means for executing the computational operations if one but not the other of the computational operations violates the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element.
6. A computer readable medium containing computer readable code, the code comprising:
a code segment for determining if one or more of two computational operations does not violate a limit;
a code segment for executing the two computational operations if either computational operation does not violate the limit, and both computational operations do not operate upon a same element;
a code segment for executing the two computational operations if:
both computational operations operate upon the same element,
both computational operations are addition operations, and
one or none of the computational operations violate a limit, but not if both of the two computational operations violate a limit; and
a code segment for executing the computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element.
7. A system comprising:
means for determining if one or more of two computational operations does not violate a limit;
means for executing the two computational operations if either computational operation does not violate the limit, and both computational operations do not operate upon a same element;
means for executing the two computational operations if:
both computational operations operate upon the same element,
both computational operations are addition operations, and
one or none of the computational operations violate a limit, but not if both of the two computational operations violate a limit; and
means for executing the computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element.
8. A computer readable medium containing computer readable code, the code comprising:
a code segment for executing the two computational operations if either computational operation does not violate a limit, and both computational operations do not operate upon a same element;
a code segment for executing the two computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are addition operations;
a code segment for executing the computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element; and
a code segment for executing the two computational operations if one but not the other of the computational operations violates a limit, and both computational operations do not operate upon a same element.
9. A system comprising:
means for executing the two computational operations if either computational operation does not violate a limit, and both computational operations do not operate upon a same element;
means for executing the two computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are addition operations;
means for executing the computational operations if either computational operation does not violate the limit, both computational operations operate upon the same element, and both computational operations are assignment operations that assign a same value to the same element; and
means for executing the two computational operations if one but not the other of the computational operations violates a limit, and both computational operations do not operate upon a same element.
Description This application is related to co-pending application Ser. No. 09/729,515 entitled “Method and System for Enhanced Concurrency in a Computing Environment”, by Clifford L. Hersh and Herbert W. Sullivan, filed on Dec. 4, 2000, the disclosure of which is hereby incorporated by reference. 1. Field of the Invention The invention relates generally to the field of computer algorithms and more particularly to a system and method for determining the commutativity of computational operations. 2. Description of the Related Art Pending computational operations such as updating entries in a database are conventionally stored in an ordered list. For each pending operation on the list, upon execution of the operation, an affected row in the database is locked until a commit or roll back. The affected row is locked in order that other pending operations do not intercede and produce inconsistent results. For example, if the list includes two updates to a cell in the database row, the affected row is locked so that a first update operation executes and commits before a second update operation executes and commits. In this manner, the integrity of the database is maintained. The execution of such computational operations using locks is expensive. For example, if two cashiers in a store have to post updates to the same account, the cashier who posts his update first proceeds while the cashier who posts his update second has to wait while the first cashier's update is executed. While in this example the productivity of the second cashier may not necessarily be adversely affected by waiting, in a situation where hundreds and possibly thousands of cashiers are posting updates to the same account, such waiting adversely affects the productivity of the cashiers. With the integration of computational operations enabled by the increase in computational speeds and the decrease in the cost of storage, conventional locking techniques have forced many operations to be done as batched operations. Thus, all updates to a particular account for example, are executed after the close of business so as to maintain the productivity of those making updates to the particular account. While such batched operations are effective in maintaining account information, their performance does not allow for efficiencies provided by realtime computation. For example, the ordering of inventory in an inventory control system dependent upon batched operations must be performed after the execution of the batched operations rather than in realtime when the inventory is needed. Using the locking technique of the prior art further requires that the lists of pending operations be processed by server machines generally located in geographically distinct locations from a central location where the database is maintained. Thus an enterprise having operations in a plurality of locations must maintain a server machine at each location at great cost to the enterprise. Thus, there is a need in the art for a system and method of performing computation operations which provides for realtime computation. Such a system and method preferably reduces the number of server machines required to maintain information in a database. A system and method for executing computational operations upon elements of a data structure. The method includes determinations of the commutativity of the computational operations. If the computational operations are determined to be commutative the computational operations are executed regardless of order. Otherwise the computational operations are executed in order. The invention further includes a method for executing two or more computational operations upon elements of a data structure, including the steps of determining if any of the computational operations to be executed are operable upon the same element, determining if any of the computational operations determined to be operable upon the same element are in kind operations, determining if any of the computational operations determined to be operable upon the same element and to be in kind operations are addition or assignment operations, and executing the computational operations determined to be operable upon the same element, to be in kind operations, and to be addition operations. Aspects of the invention include a computer-implemented method for executing computational operations upon elements of a data structure and a computer implemented method for determining the commutativity of computational operations. Another aspect includes a computer program recorded on a computer-readable medium for causing a computer to effect the method as described above. The foregoing and other objects and advantages of the disclosed system and method for executing computational operations upon element of a data structure will become apparent to those of ordinary skill in the art after having read the following detailed description of the preferred embodiments that are illustrated in the various drawing figures. The invention provides a system and method for determining the commutativity of computational operations. Two operations are commutative if the same result is obtained regardless of the order in which the operations are performed. Thus if two operations are determined to be commutative, the need for locking while either operation executes is eliminated as the order of execution will not affect the result. A preferred embodiment of the invention is practiced in the context of a conventional client/server architecture generally designated The present invention makes use of the reservation system disclosed in co-pending application Ser. No. 09/729,515 entitled “Method and System for Enhanced Concurrency in a Computing Environment.” With reference to A thread of execution including an update operation such as an atomic addition or subtraction operation (subtraction as addition of a negative value of an addend) is operable to operate upon a value stored in actual value register Subtraction and addition reservation registers Limit registers With reference to In a step In a step If the operation cannot succeed, in a step If the operation can succeed, in a LOCK XADD operation In the case where the update operation is an assignment operation, an assignment reservation register With reference to In a step In a step If it is determined in step If the computational operations are determined to be in kind in step If the in kind operation type is determined to be assignment, then in a step In the context of update operations to a database, inherently commutative operations may not be commutative and inherently non-commutative operations may be commutative. For example, addition is inherently a commutative operation yet in the case where addition operations violate a limit, the operations are not commutative. Similarly, the assignment operation is not inherently commutative yet in the case where the same value is being assigned, the assignment operations are commutative. The method of the invention exploits the commutativity of certain operations to provide advantages over the prior art locking techniques. Using the method of the invention, realtime updates to a database are enabled. If operations are determined to be commutative, the row being updated does not need to be locked and the operations can proceed in any order. Furthermore, commutative operations do not need to be put on a pending operations list and run in batches. It has been found that the use of the described method provides for the elimination of a substantial number of the locks employed in the prior art locking technique. Furthermore, the number of servers necessary to maintain a database in an enterprise having geographically distinct locations is also reduced significantly. The described method further provides for a substantial performance enhancement over the locking technique of the prior art. As noted above, locking is expensive. The method of the invention achieves the performance enhancement by allowing commutative operations to execute without locking. In another aspect of the invention and with reference to Several embodiments are specifically illustrated and/or described herein. However, it will be appreciated that modifications and variations are covered by the above teachings and within the scope of the appended claims without departing from the intended spirit and scope thereof. Patent Citations
Referenced by
Classifications
Legal Events
Rotate |