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.

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

have an impact on the execution. This typically inclu<strong>de</strong>s lexical globals and<br />

primitive operations of a VM. The corresponding meta interface is sketched in<br />

the second compartment of the Domain class. In addition to these operations,<br />

the VM-specific part can also inclu<strong>de</strong> an unenforced bit for each method. If<br />

this unenforced bit is set, the corresponding method is always executed in<br />

the unenforced execution mo<strong>de</strong>. If the bit is not set, the method will execute<br />

either enforced or unenforced <strong>de</strong>pending on the current execution mo<strong>de</strong> of<br />

the thread. In general, the bit is used to mark operations that should execute<br />

always at the meta level. This inclu<strong>de</strong>s for instance the intercession handlers<br />

of a domain themselves to guarantee that their execution is performed unenforced.<br />

Other examples are methods that implement general language behavior,<br />

for instance in Sec. 5.3.2, it is used in the agent example to mark the #read<br />

method unenforced to represent the notion that the agent’s state is readable<br />

without any restrictions.<br />

Helper Methods The third compartment of the Domain class in Fig. 5.1 contains<br />

a set of helper methods. These methods sketch functionality that is<br />

merely convenient to have, but is not a fundamental part of the OMOP. Thus,<br />

the operations offered <strong>here</strong> are not strictly orthogonal to the other mechanisms<br />

offered by the OMOP. For instance, in the theoretical mo<strong>de</strong>l <strong>de</strong>picted<br />

by Fig. 5.1, the owner of an object is represented directly by the owned by relation,<br />

and thus, can be modified directly. The helper methods offer the #adopt:<br />

method which requests a domain to take over ownership for the given object.<br />

This abstracts from the low-level <strong>de</strong>tails of how the owned by relation<br />

is realized. For instance, it could be just another object field, or it could be<br />

represented by arranging the objects of different domains in separate heaps.<br />

The #evaluateEnforced: method also provi<strong>de</strong>s a high-level interface to the<br />

execution mo<strong>de</strong> by evaluating a block of co<strong>de</strong> in the enforced execution mo<strong>de</strong>.<br />

This is convenient for the implementation of concurrency policies, as is the<br />

spawning of new threads in a given domain via #spawnHere:.<br />

Elements of the OMOP The remain<strong>de</strong>r of this section gives a brief brief<br />

summary of the elements of the OMOP and relates them to the requirements.<br />

Domains own objects, and every object has one owner. They <strong>de</strong>fine the concurrency<br />

semantics for owned objects by refining field read, field write,<br />

method execution, and thread resumption. Newly created objects belong<br />

to the domain specified by #initialDomainForNewObjects. With<br />

#adopt:, the owner of an object can be changed during execution. This<br />

116

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

Saved successfully!

Ooh no, something went wrong!