Safe strength reduction for Java synchronized procedures

Data processing: database and file management or data structures – Database design – Data structure types

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C709S241000, C710S200000, C711S150000, C711S204000

Reexamination Certificate

active

06542891

ABSTRACT:

TECHNICAL FIELD
The present invention relates generally to a method and system of enabling multiple executing computer instructions to view a shared resource. More particularly the invention relates to a method and system for enabling multiple threads running in a Java computer language environment to view a shared object.
BACKGROUND
In recent years a new programming language called Java has been developed. Applications written in Java can be executed in many different computer architectures, generally referred to as hardware platforms. The platform independent characteristic of Java applications is obtained by compiling the source code to a form that is platform, or machine independent. Generally, most compilers generate machine code that is machine dependent and can only execute on a specific computer architecture. In contrast, the Java compiler generates an intermediate form of “pseudo-code” generally called “byte-code.”
The Java byte-code does not require a specific computing-platform architecture and is therefore capable of executing in many different computers. Because Java's byte-code is platform independent it is ideally suited for usage in a computer network environment. In a computer network, a stream of byte-codes can be transmitted from a remote computer or server to a local computer where the byte-codes are recognized, compiled and executed.
In order for the local computer to execute the byte-code, it must be Java-enabled. In other words, in the receiving platform, the byte-codes must be interpreted by a Java Virtual Machine (JVM) or, a just-in-time (JIT) compiler. The stream of byte-codes are compiled line-by-line to a machine code that is recognized by the local hardware platform while the Java application is running. This method of compiling is also known as dynamic compiling. Java also supports static compiling, in which the entire Java source code application is compiled to a specific hardware platform machine readable code all at once.
Computer systems are generally able to execute multiple tasks or processes at the same time. Processes that are executing simultaneously are part of an overall active program executing in the memory of the computer. The concept of executing multiple tasks or processes also extends to Java. In Java, threads are similar to processes, however, whereas processes execute in a completely separate application, threads execute with an application. The thread mechanism enables modern computers to execute a variety of concurrent tasks.
Another characteristic of threads is that they share resources, such as memory, with all other threads executing with the current application. Sharing computer system resources by concurrently executing threads may lead to interference between the threads. In multithreaded Java applications problems may arise when multiple threads attempt to share the same resource, such as an object. Because threads run independently of each other they can interfere with other thread's operation during the execution of complex instructions.
To address the problem of multiple threads executing and attempting to read or write to shared resources, the execution of the multiple threads must be synchronized. Synchronization allows multithreaded environments to apply locks on shared resources so that only one thread may have exclusive access of the shared resource at any given time. The other threads are then paused until the controlling thread releases the lock(s) to the shared resource(s).
Accordingly, Java uses a relatively simple strategy to resolve resource contention between threads by implementing a synchronized operation between the multiple threads that share resources. Namely, Java adds a “synchronized” keyword to a given object for the associated method. When an object is marked with a “synchronized” keyword, its contents cannot be changed other than by the currently invoked synchronized method. By inference this process requires all methods of a class, with some rare exceptions, to be synchronized, lest they view portions of the object in an unexpected state.
Synchronized methods within a class may be labeled or tagged with the keyword “synchronized.”, Threads that would like to access shared objects are queued and only one thread at a time can execute “synchronized” methods. By adding the keyword “synchronized” to a method definition, when a thread invokes a synchronized method on a particular object it automatically obtains a lock for that object. Accordingly, any other thread that attempts to invoke the same, or other “synchronized” method for that object, must wait until the current thread releases the lock for the object. The only time a lock is released is when the thread exits the “synchronized” method. Only one thread at a time can execute “synchronized” methods. The Java language automatically manages all the locking and queuing activities occurring during execution.
In other words, Java controls the execution of the various threads and blocks concurrently executing threads from executing a “synchronized” method whenever another thread (usually the first one to gain access) invokes the “synchronized” method. As soon as one thread invokes a “synchronized” method, all other concurrently executing threads are blocked from executing the “synchronized” method. Whenever the current thread finishes the execution of the “synchronized” method it releases the lock and all other threads will be allowed to execute the “synchronized” method. Threads that are waiting to execute a “synchronized” method are queued.
Taken as a language keyword and a definition, this type of synchronization provides exclusive access to the object by a thread during the entire execution duration of the method. This method of operation maximizes contention for resources between the threads since only one thread at a time can view the object (e.g., until the thread releases the lock to the object). Such contention is a drawback to using the Java language in a multithreaded environment because since the entire purpose of threading (e.g., having a program perform more than one task at the same time) may well be defeated if there are multiple threads waiting for locks to be released before they can access shared objects. This is especially true if the threads that have halted execution merely require viewing the contents of the locked object without necessarily modifying the object.
In other programming languages, it is known that if a given method does not attempt to change an object, then the programmer may manually obtain a “weaker” class of lock on the object via suitable coding. This weaker class of lock allows an arbitrary multiple number of threads to simultaneously view an object provided the threads were invoking “immutable methods.” As used herein, the term immutable method refers to a method which does not change an object. Allowing immutable methods to view otherwise locked objects can be referred to as a “shared read lock.” In other words, methods that do not attempt to change an object are given permission to view or “read” the object.
On the other hand, methods that change the object (“mutable methods”) would still require an exclusive type lock. Forcing mutable methods to obtain exclusive locks can be referred to as an “exclusive write lock.” In other words, only the single thread possessing an exclusive lock on a particular object may modify or “write” to the object.
Implementation of this locking technique requires one lock to have two states; a “shared read” state and an “exclusive write” state. In this manner of implementing a lock function, it is implied that possession of the “exclusive write” lock excludes all other threads from obtaining access to a “shared read” lock. This implementation is well known in the art as “read by many, write by one” or “shared/exclusive locks.” Such schemes are used, for example, in the computer systems having the designations S/38 and AS/400, which are manufactured by International Business Machines Corporation (IBM), the assignee of the present invention.
In view of the foregoing,

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Safe strength reduction for Java synchronized procedures does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Safe strength reduction for Java synchronized procedures, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Safe strength reduction for Java synchronized procedures will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3093635

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.