<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Shengyuan Wang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Weiyi Wu</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Yao Zhang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Yuan Dong</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science and Technology Tsinghua University</institution>
          ,
          <addr-line>Beijing, 100084</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
      </contrib-group>
      <fpage>136</fpage>
      <lpage>151</lpage>
      <abstract>
        <p>As newly developed transactional memory technology has received significant attention as a way to dramatically simplify sharedmemory concurrent programming, user-level transactional concurrent programming models have become a very interesting topic in the programming community. However, the fact is that, in existing transactional concurrent programming models, user-level mechanisms hav e not been well developed. The dilemma is how to make a balance between the performance and correctness of a program. Explicit concurrency among cooperative transactions can undoubtedly decrease the rate of conflicts and improve the performance, but it is harmful to the correctness. In this paper, a transactional concurrent programming approach, based on Petri nets, is presented, which can easily specify concurrency among transactions and do not aggravate programmers remarkably in writing correct transactional concurrent programs. In this approach, a special Petri net system with transition markings is developed. Although such a Petri net system is not defined conventionally, it is shown that its behavior can be simulated through a conventional net, so existing analysis and verification approaches for usual Petri nets can be applied indirectly.</p>
      </abstract>
      <kwd-group>
        <kwd>Concurrent Programming</kwd>
        <kwd>Transactional Memory</kwd>
        <kwd>Petri Nets</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Transactional memory mechanism has recently received significant attention as a
way to dramatically simplify memory-sharing concurrent pr ogramming, in which
mutual exclusion and synchronization can be constructed without using any locks
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. For convenience,a concurrent programming model based on transactional
memory mechanism is called a transactional concurrent programming model in
this paper.
      </p>
      <p>
        In existing user-level transactional concurrent programm ing models, there
are two major solutions. One of them is to use directly some API’s for
transactional memory mechanism, which may be implemented by hardware, software or
hybrid. For example, programmers can write transactional concurrent programs
in Java together with the library DSTM2 [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], or in C together with the library
TL2-x86 [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. The advantage of this solution is that one can us e existing
common languages without changing their compilers, but programmers have to use
non-structural library functions carefully.
      </p>
      <p>
        Another solution is to extend conventional programming languages with some
transactional features, such as atomic statement-blocks, as in some new
languages Fortress [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], X10 [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], Chapel [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], etc. In this solution, it is easier for
programmers to write correct transactional concurrent programs, however, an
appropriate compiler must be provided.
      </p>
      <p>To develop a user-level transactional concurrent programm ing mechanisms,
one dilemma is how to make a balance between the performance and correctness
of a program. On the one hand, to write an efficient program in the
transactional programming paradigm, it still needs programmers’ w isdom to build the
explicit parallelism among cooperative transactions, in order to decrease the rate
of conflicts. On the other hand, however, explicit parallelism is harmful to the
correctness of a program, while one of the initial intents of the transactional
memory mechanism is to alleviate the burden for a programmer to write
concurrent programs.</p>
      <p>
        There have been some contributions in the literature to introduce
transactions into existing concurrent programming model. For example, a CCR-based
transactional concurrent programming model was proposed by T. Harris and
K. Fraser [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], and Baek et al extend the APIs’ of OpenMP [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] to O penTM [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
Unfortunately, these approaches still have the usual drawbacks of concurrent
programs, that is, not easy to write and not easy to verify.
      </p>
      <p>
        As well known, Petri nets [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] are useful tools in the specification and
verification of concurrent applications. With true concurrency dynamical semantics,
a Petri net system has a good opportunity to become a realistic part of a
concurrent program for multi-core or multi-thread architectu re. In this paper, we
present informally a transactional concurrent programming mechanism based
on a Petri net, in order to specify concurrency among transactions explicitly
while not to aggravate programmers remarkably in writing correct concurrent
programs.
      </p>
      <p>Fig.1 shows a simple example described in a typical transactional concurrent
program structure, where an atomic statement-block declar es a transactional
region, and fork 1, fork 2, fork 3 and cake_c are shared objects among cooperative
transactions.</p>
      <p>In the Petri net system shown in Fig.2, to be explained in more details,
each of the transitions declares a transactional region, and fork 1, fork 2, fork 3
and cake_c are shared objects among three cooperative transactions. Since the
accesses of fork 1, fork 2 , and fork 3 will never conflict, the rate of access conflicts
among transactions is decreased, compared to the program in Fig.1.</p>
      <p>Extremely, we can protect all shared objects by the Petri net system,
corresponding to the so-called conservative concurrency cont rol. However, if the
number of shared objects increases dramatically, the net system may get too big
in size. Fortunately, we can leave some shared objects to be protected by the
thread ph1:
while ( true ) {
atomic {
read fork1 ;
read fork2 ;
write fork1+1 to fork1 ;
write fork2+1 to fork2 ;
int fork1 = 0, fork2 = 0, fork3 = 0; thread ph2:
int cake_c = 12; while ( true ) {
atomic {
read fork2 ;
read fork3 ;
write fork2+1 to fork2 ;
write fork3+1 to fork3 ;
if ( fork2 mod 10 == 0 ) {
read cake_c ;
write cake_c-1 to cake_c ;
}
}
}
}
}
thread ph3:
while ( true ) {
atomic {
read fork3 ;
read fork1 ;
write fork3+1 to fork3 ;
write fork1+1 to fork1 ;
if ( fork1 mod 20 == 0 ) {
read cake_c ;
write cake_c-1 to cake_c ;
}
}
}
transactional memory mechanism, if the probability of access conflicts for those
shared objects is not that big. For example, we have not made the accesses to
cake_c protected by the net system in Fig.2.</p>
      <p>We call a shared object to be critical or non-critical according to its
probability of access conflicts. So in the transactional concurrent programming approach
suggested in this paper, programmers are encouraged to implement the
protection of critical shared objects through Petri net systems, and to leave the
non-critical shared objects to be protected automatically by the transactional
memory system. In the example shown in Fig.1 and Fig.2, the shared object
cake_c is less frequently accessed than fork is’, hence, it is assumed that fork i’s
be critical shared objects among phis’, and cake_c be the non-critical shared
object among them.</p>
      <p>
        The Petri net model we use is a special colored Petri net model [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], called
resource nets, which guarantee the access consistency for shared objects. The
semantics for a transactional memory mechanism is inspired by the
implementation of DSTM2 [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>The rest of the paper is organized as follows. In Section 2, we make some
informal interpretation to the Petri net model, resource nets. Further in Section
3, the behavior simulation of a resource net system is discussed. Then in Section
4, the program model is briefly presented. Section 5 shows a sample user-level
transactional concurrent programming tool, where the concept resource nets is
applied. Finally, Section 6 gives some remarks and the future work.
2</p>
      <p>The Net Model
As stated above, a transactional concurrent program can access two classes of
shared objects, critical or non-critical ones. We use resource variables to access
critical shared objects, and global variables to access non-critical shared objects.
In the following, the set of resource variables is denoted by VR, and the set of
global variables is denoted by VT .</p>
      <p>A resource net system is a special colored Petri net system N = (P, T, A, W, m0, MF ),
where</p>
      <p>MT
cake_c : 12</p>
      <p>MR
fork1 : 0
fork2 : 0
fork3 : 0</p>
      <p>ph1
1: read fork1 ;
read fork2 ;
write fork1+1 to fork1 ;
write fork2+1 to fork2
fk2
fk1
fk3
– P ⊆ { ρk | k ∈ N} , and T ⊆ { (τk, Ik) | k ∈ N} are the set of places and the
set of transitions respectively.
– A = (P × T) ∪ (T × P) is the set of arcs.
– W : A → { S | S ⊆ VR} is the inscription function.
– m0 ∈ Marking is the initial marking, where Marking =</p>
      <p>{ m | m : (P ∪ T) → { S | S ⊆ VR} .
– MF ⊆ Marking is the set of final markings.</p>
      <p>A resource net system N = (P, T, A, W, m0, MF ) has the following features:
– For each transition (τk, Ik) ∈ T, a command sequence Ik is attached. When a
transition (τk, Ik) is fired, it starts a transaction for the command sequence
Ik. A command in Ik can access shared variables in VR ∪VT , and the variables
local to τk.
– A transition can hold a token while its transaction is executing, and the
token does not return to the net system until the computation is committed
or aborted. So we extend the definition of marking with transition markings.
– It is possible that MF is empty, which is the usual case in conventional Petri
net systems..</p>
      <p>It is worth to noting that variables in VR should be disjoined in locations
with each other, which are usually implemented by the compiler.
2.1</p>
    </sec>
    <sec id="sec-2">
      <title>An Example</title>
      <p>Example 1 Fig.2 shows a transactional concurrent program with VR = { fork 1,
fork 2,fork 3} and VT = { cake_c }. The resource net system N = (P, T, A, W, m0, MF ),
where
– P = { f k1, f k2, f k3} .
– T = { tr1, tr2, tr3} , where tr1 = (ph1, I1), tr2 = (ph2, I2), and tr3 =
(ph3, I3), where I1, I2 and I3 are command sequences attached to
transitions ph1, ph2, and ph3 respectively, as is illustrated in Fig.2.
– A = {(tr1,f k1), (tr1,f k2), (tr2,f k2), (tr2,f k3), (tr3,f k3), (tr3,f k1), (f k1,tr1),
(f k1, tr3), (f k2, tr2), (f k2, tr1), (f k3, tr3), (f k3, tr2)}.
– W is defined by:</p>
      <p>W (f k1, tr1) = W (tr1, f k1) = W (f k1, tr3) = W (tr3, f k1) = { fork1} , W (f k2, tr2) =
W (tr2, f k2) = W (f k2, tr1) = W (tr1, f k2) = { fork2} , W (f k3, tr2) = W (tr2, f k3) =
W (f k3, tr3) = W (tr3, f k3) = { fork3} .
– m0 ∈ Marking is defined by:
m0(f k1) = { fork1} , m0(f k2) = { fork2} , m0(f k3) = { fork3} , and m0(τ ) = ∅
for τ = tr1, tr2, tr3.</p>
      <p>– MF = ∅.
2.2</p>
    </sec>
    <sec id="sec-3">
      <title>Well-Formed Resource Net Systems</title>
      <p>A resource net system N = (P, T, A, W, m0, MF ) is well-formed , if
– P ∩ T = ∅.
– ∀ρ ∈ P.∀v1, v2 ∈ m0(ρ).(v1 6= v2), that is, at the initial marking, all tokens
owned by a place are corresponding to different resource variables.
– ∀ρ1, ρ2 ∈ P.∀v1∀v2.(ρ1 6= ρ2 ∧ v1 ∈ m0(ρ1) ∧ v2 ∈ m0(ρ2) → v1 6= v2), that is,
at the initial marking, tokens owned by different places have disjoint resource
variables.
– ∀τ ∈ T.(m0(τ ) = ∅), that is, at the initial marking, every transition contains
no tokens.
– ∀m ∈ MF .∀τ ∈ T.(m(τ ) = ∅), that is, at each of final markings, every
transition will not contain any tokens.
– ∀τ ∈ T.∀ρ1, ρ2 ∈ • τ.∀v1∀v2.(ρ1 6= ρ2 ∧ v1 ∈ W (τ, ρ1) ∧ v2 ∈ W (τ, ρ2) → v1 6=
v2), that is, all sets of resource variables on the incoming arcs of the same
transition are disjoined with each other.
– ∀τ ∈ T.∀ρ1, ρ2 ∈ τ • .∀v1∀v2.(ρ1 6= ρ2 ∧ v1 ∈ W (ρ1, τ ) ∧ v2 ∈ W (ρ2, τ ) →
v1 6= v2), that is, all sets of memory blocks on the outgoing arcs of the same
transition are disjoined with each other.
– ∀τ ∈ T.∀ρ ∈ τ • .(W (τ, ρ) ⊆ Sρ′ ∈• τ (W ((ρ′ , τ ))), that is, no extra shared
objects be produced within a transaction associated to each of transitions.
For simplification,in this paper, we don’t consider the dyna mic memory
allocation for a shared object within a transaction.</p>
      <p>In the above,the pre-set and post-set of a transition τ ∈ T or a place ρ ∈ P
are used, which are defined as usual: • τ = { ρ | (ρ, τ ) ∈ A} , τ • = { ρ | (τ, ρ) ∈ A} ,
• ρ = { τ | (τ, ρ) ∈ A} , and ρ• = { τ | (ρ, τ ) ∈ A} .</p>
      <p>Example 2 It is easy to show that the resource net system in Example 1 is
well-formed.
2.3</p>
    </sec>
    <sec id="sec-4">
      <title>Execution Semantics</title>
      <p>To show the execution semantics of a resource net system, we define TranState =
{blocked, active, aborted, committed }, consisting of 4 transaction states of a transition.
At the initial marking, every transition has the state blocked.</p>
      <p>Entering a Transition Whenever a transition τ in the resource net system is in
state blocked, and the firing condition for τ is satisfied under the current marking m,
that is, ∀ρ ∈ • τ.(m(ρ) ⊇ W (ρ, τ )), and in the same time, the current marking is not a
final state, that is, m ∈/ MF , the system can enter the transition such that a
transaction is started and the transition gets to hold tokens. When it occurs, the
state of the τ will be active.</p>
      <p>Execution of a Command Sequence Whenever a transition τ in the resource
net system is in state active, and the next command in its remained command
sequence is c, the transition can make a progress by executing the command c. We
need several separate rules respectively for several cases:</p>
      <p>(1) If c reads or writes to a global variable which has been written most recently
by some other transition but τ , a read/write confliction occurs, and τ will be in the
state aborted.</p>
      <p>(2) If the execution of c has no read/write confliction and c has no write operation
to any global variables, the transition will keep in state active.</p>
      <p>(3) If the execution of c has no read/write confliction and c has a write operation
to some global variable x, the transition will keep in state active, while the system
will record τ to be the transition that most recently written to x.</p>
      <p>Ready to Commit a Transaction Whenever a transition τ in the resource net
system is in state active, and there is no next command in its remained command
sequence, the system can make a progress to change the state of τ from active to
committed, meaning that the transaction associated to τ is ready to commit.
Committing a Transaction Whenever a transition τ in the resource net system is
in state committed, the system can make a progress to commit the transaction
associated to τ , changing the state of τ from committed to blocked.
Aborting a Transaction Whenever a transition τ in the resource net system is in
state aborted, the system can make a progress to return tokens to places in the pre-set
of τ , changing the state of τ from aborted to blocked.</p>
      <p>Let N = (P, T, A, W, m0, MF ) be a well-formed resource net system, it is easy to
show that for any reachable marking m from the initial marking m0, the following two
properties are satisfied
– ∀x ∈ P ∪ T.∀v1, v2 ∈ m(x).(v1 6= v2),that is, at the marking m, all tokens owned
by a place or a transition are corresponding to different resource variables.
– ∀x1, x2 ∈ P ∪ T.∀v1∀v2.(x1 6= x2 ∧ v1 ∈ m(x1) ∧ v2 ∈ m(x2) → v1 6= v2), that is,
at the marking m, all tokens owned by different places or transitions have disjoint
resource variables.</p>
      <p>Example 3 Since the resource net system N = (P, T, A, W, m0, MF ) in Example 1
is well-formed. So the above two properties will keep in a wel l-formed program state
during its execution.
3</p>
      <p>Behavior Simulation of a Resource Net System
In this section, it will be shown that a well-formed resource net system N can be
reduced to an usual colored Petri net system desugar(N ) so that the behavior of N
can be simulated by desugar(N ), which can be analyzed and verified by using existing
approaches in the Petri net community.</p>
      <p>The transformation from N to desugar(N ) is called desugaring. Before and after
desugaring, the change of net structure can be illustrated by Fig.3.</p>
      <p>……
m
……
m
(a)
……
m
enter</p>
      <p>rollback
(b)</p>
      <p>commit
……
m
Example 4 Consider the well-formed resource net system N = (P, T, A, W, m0, MF )
in Example 1. desugar(N ) = (P′ , T′ , A′ , W ′ , m′0, M F′ ) can be depicted in Fig.4, where</p>
      <p>It is not difficult to establish a behavior simulation relation between N and desugar(N ),
and show that many behavior properties, including deadlockf-reeness , for N can be
verified indirectly by verifying those for desugar(N ). For example, it is easy to verify
that the usual Petri net system desugar(N ) in Example 4 is deadlock-free, so we can
conclude that the resource net system N is also deadlock-free.</p>
      <p>It is worth to noting that the execution semantics can guarantee behaviour
consistence between N and desugar(N ). For every transition τ in N and ρτ in desugar(N )
as illustrated in Fig.3, we have
– If τ is in state blocked, there no token in ρτ , and τenter is enabled. If τenter fires, τ
will be in state active at the same time.
– If τ is in state active, nether τcommit or τrollback will fire though there exist tokens
in ρτ .
– If τ is in state committed, τcommit is enabled.
– If τ is in state aborted, τrollback is enabled.</p>
      <p>– τ is in state active, committed, or aborted, iff there no token in ρτ .
In the transactional concurrent programming approach of this paper, a program
consists of a set of Petri net systems, which are protected parts in the system, and a set of
unprotected threads which contains an initial thread identified root and other
unprotected threads. Resource variables can only be accessed within protected parts. At the
beginning, the thread root is initialized to execute at the level which we call top level.</p>
      <p>A set of Petri net systems can spawn outside a Petri net system, initialized with
new allocated resource variables or their references. When a transition in a Petri net
system is fired, it becomes a (transactional) transition thread, which will eventually
commit, or rollback due to conflicts to access the shared memory.</p>
      <p>An unprotected thread except for the thread root can be spawned outside a Petri
net system.</p>
      <p>The program ends if all the Petri net systems achieve one of their final states, and
in the same time all the unprotected threads execute to the end.
5</p>
      <p>
        A sample userl-evel transactional concurrent
programming tool
A sample user-level transactional concurrent programming tool has been developing in
our lab, based on available software sources, DSTM2 [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], PNK [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] and GJC [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. In
the programming model of this sample programming tool, a program consists of a set
of Petri net systems, corresponding to resource net systems in this paper, and other
part written in Java Language.
      </p>
      <p>A simple visual IDE for this programming model has been developing.
Editors In the IDE, each of the elements of a program can be visually edited. Fig.5
shows a basic editing view. A editor for a Petri net system is similar to that provided
in PNK source, but some modifications to add code editing area, to make the code
editing to be the main input area, and to integrate with associate compilation
operations.</p>
      <p>A visually edited Petri net system will be automatically translated to some code
to be fed to the compiler. It actually completes a class inherited from a class PetriNet
for the programmer, where PetriNet is the class encapsulated for a special Petri net
virtual machine. For example, for the Petri net system in Fig.6, the result class will be
the one in Fig.7.</p>
      <p>package base_directory.pnml.compile;
public class PNTest extends PetriNet{
public PNTest(Object objectSource) {
super(objectSource);
this.AddTransition("t1","code", "f1");
this.AddTransition("t2","code", "f2");
this.AddTransition("t3","code", "f3");
this.AddPlace("p1", "a,b", "marking");
this.AddPlace("p2", "", "marking");
this.AddArc("p1", "t1", "a", "inscription");
this.AddArc("t1", "p2", "a", "inscription");
this.AddArc("p1", "t2", "b", "inscription");
this.AddArc("t2", "p2", "b", "inscription");
this.AddArc("p2", "t3", "a,b", "inscription");
}
}
Associate Compilation The associate compilation makes the static check of a
Petri net system, then associates its code with all other parts of opened codes and
compiles them together with each other. At the early time of the compilation, the
Petri net system is translated into its internal form as the Petri net virtual machine
instructions, which then is added to its specific class.</p>
      <p>Variables corresponding to transaction memory blocks and resource memory blocks
are declared with the modifiers global and resource respectively. Besides, the code for
each transition of a Petri net system is defined by a specific member function with the
modifier petrinet. In the associate compilation, the lexical, syntactical, and semantical
analysis associate to the modifiers global, resource and petrinet has been processed
carefully.</p>
      <p>
        The compiler has been implemented based on GJC [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], a open Java compiler
released by Sun, and kept the original logic of GJC unchanged.
      </p>
      <p>The statical semantic check for a Petri net system is corresponding to the definition
of a wellf-ormed resource net system in Section 2.2.</p>
      <p>
        STM Integration The transactional memory support is based on DSTM2 [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], with
each piece of transition code automatically trisected by invoking provided STM APIs.
Hence the variable with modifier Global can be protected by the transactional
memory system.
      </p>
      <p>In order to integrate DSTM2s’ API, we need to make some modific ation to GJC.
We need to change the type of every variable with modifier Global to a wrapper class
with a factory. Also we need to change every reference of those variables and every
left-value consisted of those variables to corresponding D STM2s’ APIs.
Petri Net Virtual Machine As stated above, a Petri net system is finally
translated to some class inherited from a class PetriNet, which encapsulates interfaces
for a special Petri net virtual machine. The Petri net virtual machine is now simply
designed with the following instructions:
– AddTransition (name,code)
– AddPlace (name,resource)
– AddArc (Source, Target, Inscription)
– Start ()
– Join ()
where AddTransition, AddPlace, and AddArc are used to construct a Petri net
system, and Start and Join used for scheduling the execution of a Petri net system.
package base_directory.pnml.compile;
public class Test {
private resource int a =0;
private resource int b =0;
public static void main(String[] args) {</p>
      <p>Test t= new Test();
new PNTest(t).start();
}
public petrinet void f1() {</p>
      <p>a=1;
}
public petrinet void f2() {</p>
      <p>System.out.print("a="+a);
b=3;
}
public petrinet void f3() {</p>
      <p>System.out.print("a="+a);
System.out.print("b="+b);
a=4;
b=5;
}</p>
      <p>
        }
The paper presents an approach to integrate a Petri net system with a transitional
memory mechanism, which has currently been applied to the implementation of a
userlevel transactional concurrent programming tool in our lab. There is few formalism
to play such a role as we have known so far. There exist researches based on Petri
nets to model atomic or transactional threads, however the net system is not a part
of the program. For example, an approach to check causal atomicity is proposed by
modeling programs using Petri Nets [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. At some extent, concurrent programming
models based on Petri nets, such as OPN [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], CLOWN [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], COO [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], CO-OPN/2
[
        <xref ref-type="bibr" rid="ref18">18</xref>
        ], and Elementary Object Nets [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] may be extended to support various transaction
semantics with the conservative concurrency control.
      </p>
      <p>We observed that the integration of Petri nets with transactional memory can bring
benefits to both side, which is the motivation of the paper. On the one hand, with</p>
      <sec id="sec-4-1">
        <title>TestAndConsumeToken(); DoThings(); ProduceToken();</title>
        <sec id="sec-4-1-1">
          <title>PN-Transition routine</title>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>Thread.onCommit(new Runnable() {</title>
        <p>public void run () {</p>
        <p>Commit();
}
});
Thread.onAbort(new Runnable() {
public void run () {</p>
        <p>Abort();
}
});
Thread.doIt(new Callable&lt;Void&gt;() {
public Void call ()</p>
        <p>throws Exception {</p>
        <p>DoThings();
}
});</p>
        <sec id="sec-4-2-1">
          <title>DSTM routine Fig. 11. Petri net transition and DSTM routines</title>
          <p>transactional memory, a finer granularity of concurrency can be achieved in a Petri
net system, and the scale of the net model can be controlled flexibly. On the other
hand, with a Petri net system, the concurrency among cooperative transactions can be
built explicitly, which can undoubtedly decrease the rate of conflicts and improve the
performance, while the analysis and verification capability of a Petri net model can be
inherited.</p>
          <p>The main idea in a resource net system, the net system presented in the paper,
is to classify shared resources in two classes: (1) resources such that the access policy
is driven by the net structure, so that mutual exclusion is guaranteed; (2) resources
whose access policy is driven by a transactional memory model, with possible conflicts,
resolved by a commit-rollback protocol.</p>
          <p>That is, our approach advocates the methodology that critical objects shared among
concurrent transactions will be protected through a resource net system, while
noncritical shared objects be left protected automatically by the transactional memory
system. Thus the net system can be designed flexibly to keep a moderate size and in a
finer granularity than usual net system.</p>
          <p>
            It is shown that the behavior of a well-formed resource net sy stem can be
simulated by its desugar net system, which can be analyzed and verified by using existing
approaches in the Petri net community. Behavior properties for a well-formed resource
net system, such as deadlock-freeness, can be verified indir ectly by verifying those for
its desugaring net system. For example, INA tool [
            <xref ref-type="bibr" rid="ref20">20</xref>
            ] can be directly integrated into
our programming tool being developed, as has been done in PNK.
          </p>
          <p>
            A practical user-level transactional concurrent programm ing tool, based on DSTM2
[
            <xref ref-type="bibr" rid="ref2">2</xref>
            ], PNK [
            <xref ref-type="bibr" rid="ref13">13</xref>
            ] and GJC [
            <xref ref-type="bibr" rid="ref14">14</xref>
            ], has been developing in our lab. The version so far is not
suitable to make a performance analysis because the target virtual machine on which a
program with Petri net structures runs is implemented simply based on JVM. We are
making a plan to extend the virtual machine and its implementation such that some
basic performance analysis could be made.
          </p>
          <p>Certainly, the approach could be extended to other formalisms as well. Furthermore,
how to decide critical or non-critical shared objects, we be lieve, would become an
interesting area in software design methodology.</p>
        </sec>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Tim</given-names>
            <surname>Harris</surname>
          </string-name>
          , et al.,
          <string-name>
            <surname>Transactional</surname>
            <given-names>Memory</given-names>
          </string-name>
          :
          <article-title>An Overview</article-title>
          , IEEE Micro, vol.
          <volume>27</volume>
          , no.
          <issue>3</issue>
          ,
          <string-name>
            <surname>Pages</surname>
          </string-name>
          8-
          <fpage>29</fpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Maurice</given-names>
            <surname>Herlihy</surname>
          </string-name>
          , Victor Luchangco,
          <string-name>
            <given-names>Mark</given-names>
            <surname>Moir</surname>
          </string-name>
          ,
          <article-title>A Flexible Framework for Implementing Software Transactional Memory</article-title>
          ,
          <source>In Preceedings of OOPSLA0'6</source>
          ,
          <string-name>
            <surname>Pages</surname>
            <given-names>253</given-names>
          </string-name>
          <source>-262</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <fpage>TL2</fpage>
          -x86, Stanford Transactional Applications for Multi -Processing, http://stamp.stanford.edu/.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>E.</given-names>
            <surname>Allen</surname>
          </string-name>
          et al.,
          <source>The Fortress Language Specification</source>
          , Sun Microsystems,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>P.</given-names>
            <surname>Charles</surname>
          </string-name>
          et al,
          <article-title>X10: An Object-Oriented Approach to Non- Uniform Cluster Computing</article-title>
          ,
          <source>Proc. 20th Ann. ACM SIGPLAN Conf Object-Oriented Pr ogramming, Systems, Languages, and Applications (OOPSLA05)</source>
          , ACM Press, pp.
          <fpage>519</fpage>
          -
          <lpage>538</lpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <issue>Chapel Specification 0</issue>
          .4,
          <string-name>
            <given-names>Cray</given-names>
            <surname>Inc</surname>
          </string-name>
          .,
          <year>2005</year>
          ; http://chapel.cs.washington.edu/Specification.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Tim</given-names>
            <surname>Harris</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Keir</given-names>
            <surname>Fraser</surname>
          </string-name>
          ,
          <article-title>Language Support for Lightweight Transactions</article-title>
          ,
          <source>OOPSLA0'3</source>
          ,
          <string-name>
            <surname>October</surname>
            <given-names>26</given-names>
          </string-name>
          <source>-30</source>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <article-title>8. The OpenMP API specification for parallel programming</article-title>
          . URL: http://openmp.org.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Baek</surname>
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Minh</surname>
            <given-names>C. C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Trautmann</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kozyrakis</surname>
            <given-names>C.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Olukotun</surname>
            <given-names>K.</given-names>
          </string-name>
          ,
          <article-title>The OpenTM Transactional Application Programming Interface, In PACT0'7: Proceedings of the 16th international conference on Parallel architectures and compilation techniques</article-title>
          , Washington, DC, USA: IEEE Computer Society, pp.
          <fpage>376</fpage>
          -
          <lpage>387</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. W. Reisig, Petri Nets,
          <source>EATCS Monagraphs on Theoretical Computer Science</source>
          , Springer Verlag,
          <year>1985</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>K.</given-names>
            <surname>Jensen</surname>
          </string-name>
          .
          <source>Coloured Petri Nets: Basic Concepts</source>
          ,
          <source>Analysis Methods and Practical Use</source>
          , Volume
          <volume>1</volume>
          , EATCS Monographs in Computer Science, Springer verlag,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Azadeh</surname>
            <given-names>Farzan</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Madhusudan</surname>
          </string-name>
          ,Causal Atomicity.
          <source>In Proceedings of Computer Aided Verification (CAV) 2006, Lecture Notes in Computer Science</source>
          , volume
          <volume>4144</volume>
          :
          <fpage>315</fpage>
          -
          <lpage>328</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Ekkart</surname>
            <given-names>Kindler</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Michael</given-names>
            <surname>Weber</surname>
          </string-name>
          ,
          <article-title>The Petri Net Kernel: An infrastructure for building Petri net tools</article-title>
          ,
          <source>International Journal on Software Tools for Technology Transfer (STTT)</source>
          , Vol
          <volume>3</volume>
          , No.:
          <fpage>486</fpage>
          -
          <lpage>497</lpage>
          ,
          <year>2001</year>
          . PNK available at : http:// www2.informatik.huberlin.de/top/pnk/.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>14. GJC available at : http://www.sun.com/software/communitysource/j2se /java2/download.xml</mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>A. Lakos, Object-Oriented Modelling with Object Petr i Nets, Concurrent Object-Oriented Programming</article-title>
          and
          <string-name>
            <given-names>Petri</given-names>
            <surname>Nets</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Agha</surname>
          </string-name>
          ,
          <string-name>
            <surname>F.D.</surname>
          </string-name>
          <article-title>C indio,</article-title>
          and G. Rozenberg (eds.),
          <source>Lecture Notes in Computer Science</source>
          <year>2001</year>
          , Springer-Verlag, pages
          <fpage>1</fpage>
          -
          <lpage>37</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16. E.
          <string-name>
            <surname>Batiston</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Chizzoni</surname>
          </string-name>
          , Fiorella De Cindo,
          <article-title>CLOWN as a Testbed for Concurrent Object-Oriented Concepts, Concurrent Object-Oriented Pr ogramming</article-title>
          and Petri Nets,
          <string-name>
            <given-names>G.</given-names>
            <surname>Agha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.D.</given-names>
            <surname>Cindio</surname>
          </string-name>
          , and G. Rozenberg (eds.),
          <source>Lecture Notes in Computer Science</source>
          <year>2001</year>
          , Springer-Verlag, pages
          <fpage>131</fpage>
          -
          <lpage>163</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17. C.
          <article-title>Sibertin-Blanc, CoOperative Objects: Principles, U se and Implementation, Concurrent Object-Oriented Programming</article-title>
          and
          <string-name>
            <given-names>Petri</given-names>
            <surname>Nets</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Agh a</surname>
          </string-name>
          , F.
          <string-name>
            <given-names>D.</given-names>
            <surname>Cindio</surname>
          </string-name>
          , and G. Rozenberg (eds.),
          <source>Lecture Notes in Computer Science</source>
          <year>2001</year>
          , Springer-Verlag, pages
          <fpage>216</fpage>
          -
          <lpage>246</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <given-names>O.</given-names>
            <surname>Biberstein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Buchs</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Guelfi</surname>
          </string-name>
          ,
          <article-title>Object-Oriented Nets with Algebraic Specifications: The CO-OPN/2 Formalism, Concurrent Object-Orie nted Programming and Petri Nets</article-title>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Agha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.D.</given-names>
            <surname>Cindio</surname>
          </string-name>
          , and G. Rozenberg (eds.),
          <source>Lecture Notes in Computer Science</source>
          <year>2001</year>
          , Springer-Verlag, pages
          <fpage>73</fpage>
          -
          <lpage>130</lpage>
          ,
          <fpage>200</fpage>
          1.
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <given-names>R.</given-names>
            <surname>Valk</surname>
          </string-name>
          .
          <article-title>Petri Nets as Token Objects An Introduction to Elementary Object Nets</article-title>
          .
          <source>Proceedings of 19th International Conference on the Application and Theory of Petri Nets, LNCS 1420</source>
          , Springer-Verlag,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>20. INA:Integrated Net Analyzer, at http://www.informatik.huberlin.de/lehrstuehle/automaten/ina.</mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>