JavaScript engine
First Claim
Patent Images
1. A method for avoiding using a locking mechanism when a thread having a context requests to use an object having a scope and having an owner of said scope, said method comprising:
- determining if said owner is the same as said context;
if said owner is the same as said context, then avoiding using locking mechanism;
if said owner is not the same as said context, then promoting a lock on said object'"'"'s scope.
8 Assignments
0 Petitions
Accused Products
Abstract
A JavaScript enhancement is provided that increases performance of the JavaScript by avoiding the use of locking mechanisms in multi-threaded sessions. To do so, an object is deemed owned by a thread exclusively until the script is ended or suspended. Because scripts are typically short and complete quickly, the overhead to start and end a request containing a script is much less than the overhead of locking each and every object access done by the script, on average.
25 Citations
6 Claims
-
1. A method for avoiding using a locking mechanism when a thread having a context requests to use an object having a scope and having an owner of said scope, said method comprising:
-
determining if said owner is the same as said context;
if said owner is the same as said context, then avoiding using locking mechanism;
if said owner is not the same as said context, then promoting a lock on said object'"'"'s scope. - View Dependent Claims (2)
-
-
3. A method for locking an object having an ownership attribute, wherein a first thread having a first context makes a first request to a JavaScript engine at a first time, said first request comprising using said object, and a second thread having a second context makes a second request to the JavaScript engine at a second and later time, said second request comprising using said object, said method comprising:
-
said JavaScript engine determining if said first request is finished with said object;
if said first request is not finished with said object, then;
said JavaScript engine comparing said second context of said second thread with said ownership attribute of said object;
if said comparison is different, then suspending said second request until said first request is finished with said object;
said JavaScript engine setting said ownership attribute of said object to null;
said JavaScript engine resuming said second request;
otherwise, said JavaScript engine setting said ownership attribute of said object to said second context and processing said second request.
-
-
4. An apparatus for avoiding using a locking mechanism when a thread having a context requests to use an object having a scope and having an owner of said scope, said apparatus comprising:
-
means for determining if said owner is the same as said context;
if said owner is the same as said context, then means for avoiding using locking mechanism;
if said owner is not the same as said context, then means for promoting a lock on said object'"'"'s scope. - View Dependent Claims (5)
-
-
6. An apparatus for locking an object having an ownership attribute, wherein a first thread having a first context makes a first request to a JavaScript engine at a first time, said first request comprising using said object, and a second thread having a second context makes a second request to the JavaScript engine at a second and later time, said second request comprising using said object, said method comprising:
-
means for said JavaScript engine determining if said first request is finished with said object;
if said first request is not finished with said object, then;
means for said JavaScript engine comparing said second context of said second thread with said ownership attribute of said object;
if said comparison is different, then means for suspending said second request until said first request is finished with said object;
means for said JavaScript engine setting said ownership attribute of said object to null;
means for said JavaScript engine resuming said second request;
otherwise, means for said JavaScript engine setting said ownership attribute of said object to said second context and processing said second request.
-
Specification