05.08.2014 Views

here - Stefan-Marr.de

here - Stefan-Marr.de

here - Stefan-Marr.de

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3. Which Concepts for Concurrent and Parallel Progr. does a VM need to Support?<br />

related properties, Hibernate can observe inconsistencies because of race conditions<br />

caused by the other actor executing in parallel. In the case of Java,<br />

the java.util.concurrent.atomic 23 package introduced an API for updating<br />

fields specifically to maintain concurrency properties such as those given<br />

by volatile fields. However, this requires mixing different APIs and is only<br />

restricted to field semantics.<br />

Other language guarantees that need to be maintained are for instance constraints<br />

on method invocations. For instance, active objects require that their<br />

methods are not executed directly but via an indirection that ensures that the<br />

method is executed asynchronously by the active object’s thread. With Join<br />

Java [Itzstein and Jasiunas, 2003], execution constraints can be more complex.<br />

It allows the <strong>de</strong>veloper to <strong>de</strong>fine join patterns that need to be fulfilled before a<br />

method is activated. Using reflection to circumvent these constraints can have<br />

un<strong>de</strong>sired effects. Thus, <strong>de</strong>pending on the use case, even reflective invocation<br />

should be able to preserve the constraints specified by such methods.<br />

Another complication comes from the vision of a multi-language VM. In<br />

this scenario it is insufficient to make reflection aware of a single set of <strong>de</strong>sired<br />

guarantees. Instead, additional flexibility is required. Language semantics<br />

such as isolation for an actor language are to be implemented on top of<br />

the VM, based on a unifying abstraction. A multi-language VM will need<br />

to be able to distinguish between situations w<strong>here</strong> an enforcement of guarantees<br />

is required and situations w<strong>here</strong> enforcement is not <strong>de</strong>sired. Kiczales<br />

et al. [1997] and Tanter [2009] discuss how to scope reflection. Similarly, in<br />

the context of multi-language VMs, it also needs to be possible to scope, i. e.,<br />

restrict reflection to circumvent a small set of language guarantees only, while<br />

maintaining others.<br />

Reflection and Security The power of reflection is also an issue for security.<br />

T<strong>here</strong>fore, the JVM and CLI provi<strong>de</strong> infrastructure to manage reflection in<br />

a way that allows them to restrict the reflective capabilities <strong>de</strong>pending on a<br />

security context. For the JVM the SecurityManager 24 is consulted for reflective<br />

operations to verify that the necessary permissions are given. The CLI<br />

provi<strong>de</strong>s similar mechanisms with its System.Security facilities. 25<br />

The SecurityManager provi<strong>de</strong>s the flexibility to customize the check that<br />

is performed for reflective operations. However, the offered interface is very<br />

23 http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/packagesummary.html<br />

24 http://docs.oracle.com/javase/7/docs/api/java/lang/SecurityManager.html<br />

25 http://msdn.microsoft.com/en-us/library/stfy7tfc.aspx<br />

80

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!