Mutation Operators for Concurrent Java (J2SE 5.0)

ADVERTISEMENT


Mutation Operators for Concurrent Java (J2SE 5.0) pdf cover page
In general, the method and class level mutation operators do not directly mutate the synchronization portions of the source code in Java (J2SE 5.0) that handle concurrency. Mutation Operators for Concurrent Java (J2SE 5.0) 1 JeremyS. Bradbury, James R. Cordy, Juergen Dingel School of Computing, Queen’sUniversity Kingston, Ontario, Canada{ bradbury, cordy, …

2 Java Concurrency Threads. Java concurrency is built around the notion of multi-threaded programs. The Java documentation definesa thread as”…athreadof execution in a program.”2 Atypical thread is created and then started using the start() method and will be terminated once it has finished running. Whilea thread is alive it can often alternate between beingrunnable and not runnable. A number of methods exist that can affect the status of a thread: •sleep(): will cause the current thread to become not runnablefora certain amount of time. •yield(): will cause the current thread that is running to pause (temporarily). •join(): will cause the caller thread to wait fora target thread to terminate. •wait(): will cause the caller thread to wait until acondi- tionissatisfied. Another thread notifies the caller that a condition is satisfied using the notify() ornotifyAll() method. Synchronization. Prior to J2SE 5.0, Java provided support for concurrency primarily through the use of the syn- chronizedkeyword. Java supports both synchronization methods and synchronization blocks. Additionally, synchronization blocks can be used in combination with im- plicitmonitor locks. Other Concurrency Mechanisms. In J2SE 5.0, addi- tionalmechanisms to support concurrency were added as part of java.util.concurrent: •Explicit Lock: Provides the same semantics as the im- plicitmonitor locks but provides additional functional- itysuchas timeouts during lock acquisition. •Semaphore: Maintains a set of permits that restrict the number of threads accessinga resource. A Semaphore with one permit acts the same asa Lock. •Latch: Allows threads from a set to wait until other threads completeasetof operations. •Barrier: A point at which threads from a set wait until all other threads reach the point. •Exchanger: Allows for the exchange of objects between two threads at a given synchronization point…. 4.1.5 MXC-Modify Concurrency Mechanism-X Count The MXCoperatoris applied to parameters in three of Java’sconcurrency mechanisms: Semaphores, Latches, and Barriers. A latch allows a set of threads to countdowna set of operations and a barrier allows a set of threads to wait at a point until a number of threads reach that point. The count being modified in Semaphores is the set of permits, and in Latches and Barriers it is the number of threads. We will next provide an example of the MXC operator for Semaphores. For examples involving Latches and Barriers see our technical report[3]. The constructor of the Semaphore class has aparame- terthatrefersto the maximum number of available permits that are used to limit the number of the threads accessing the shared resource. Access is acquired using the acquire() method and released using the release() method. Both the acquire() and release() method calls have optional count parameters referring to the number of permits being acquired or released. The MXC operator modifies the number of permits, p, in calls to these methods by decrementing (p–) and incrementing (p++) it by 1. For example: Original Code: int permits=10; private final Semaphoresem =new Semaphore (permits, true) ; … MSC Mutant: int permits=10; private final Semaphoresem =new Semaphore (permits, true) ; …

Download Mutation Operators for Concurrent Java (J2SE 5.0).pdf

Leave a Reply


Map: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67