05.08.2014 Views

here - Stefan-Marr.de

here - Stefan-Marr.de

here - Stefan-Marr.de

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5. An Ownership-based MOP for Expressing Concurrency Abstractions<br />

is applied to all objects the domain owns. A domain is similar to a meta-group<br />

in group-based MOPs (cf. Sec. 5.1) and the notion of object ownership realizes<br />

the meta relation in this MOP. However, compared to group-based MOPs, the<br />

OMOP requires every object to be owned by exactly one domain. T<strong>here</strong>fore the<br />

MOP proposed <strong>here</strong> is called an ownership-based metaobject protocol (OMOP). A<br />

visual representation of the OMOP is given in Fig. 5.1.<br />

0..*<br />

Object<br />

1<br />

owned by<br />

Domain<br />

readField:of:(idx, obj)<br />

: Object<br />

write:toField:of:(val, idx, obj)<br />

: Object<br />

requestExecOf:on:with:lkup:(sel, obj, args, cls): Object<br />

requestThreadResume:(thread)<br />

: Thread<br />

initialDomainForNewObjects()<br />

: Domain<br />

primCopy:(obj)<br />

: Object<br />

prim*(...) : Object<br />

readGlobal:(global)<br />

: Object<br />

write:toGlobal:(val, global)<br />

: Object<br />

adopt:(obj)<br />

: Object<br />

evaluateEnforced:(block)<br />

: Object<br />

spawnHere:(block)<br />

: Thread<br />

1<br />

runs in<br />

0..*<br />

Thread<br />

enforced : bool<br />

Method<br />

unenforced : bool<br />

Basic Interface VM specific Helper<br />

Figure 5.1.: Ownership-based Metaobject Protocol. The domain is the metaobject<br />

providing the intercession handlers that can be customized to adapt the language’s<br />

behavior. Each object is owned by exactly one domain. Every thread executes<br />

in one domain. Execution is either enforced, i. e., operations on an object<br />

trigger intercession handlers, or it is unenforced and intercession handlers are<br />

not triggered. The handlers enable the customization of field reads and writes,<br />

method invocation, thread resumption, and initial owner of an object. If the VM<br />

offers primitives and globals, they are reified as well, but these handlers are VMspecific.<br />

Methods can be marked as unenforced to execute them always without<br />

triggering the intercession handlers.<br />

Fig. 5.2 <strong>de</strong>picts a simple object configuration during the execution of an<br />

application that uses the OMOP. The example consists of two domains, represented<br />

by the dashed circles at the meta level, with interconnected object<br />

graphs on the base level. Note that the pointers between domains do not<br />

need special semantics. Instead, the concurrency properties of a base-level object<br />

are <strong>de</strong>fined by the domain object that owns the base-level object. Thus,<br />

the owned-by relation is the meta relation of the OMOP.<br />

The remain<strong>de</strong>r of this section discusses in more <strong>de</strong>tail the semantics associated<br />

with the OMOP and establishes the connection of its elements to the<br />

requirements.<br />

Basic Interface The first compartment of the Domain class <strong>de</strong>picted in Fig. 5.1<br />

contains the basic intercession handlers provi<strong>de</strong>d by the OMOP. This basic<br />

114

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

Saved successfully!

Ooh no, something went wrong!