<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">PNTM -Integration of Petri Nets and Transactional Memory</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Weiyi</forename><surname>Wu</surname></persName>
							<affiliation key="aff0">
								<orgName type="department">Department of Computer Science and Technology</orgName>
								<orgName type="institution">Tsinghua University</orgName>
								<address>
									<postCode>100084</postCode>
									<settlement>Beijing</settlement>
									<country key="CN">China</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Yao</forename><surname>Zhang</surname></persName>
							<affiliation key="aff0">
								<orgName type="department">Department of Computer Science and Technology</orgName>
								<orgName type="institution">Tsinghua University</orgName>
								<address>
									<postCode>100084</postCode>
									<settlement>Beijing</settlement>
									<country key="CN">China</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Shengyuan</forename><surname>Wang</surname></persName>
							<affiliation key="aff0">
								<orgName type="department">Department of Computer Science and Technology</orgName>
								<orgName type="institution">Tsinghua University</orgName>
								<address>
									<postCode>100084</postCode>
									<settlement>Beijing</settlement>
									<country key="CN">China</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Yuan</forename><surname>Dong</surname></persName>
							<affiliation key="aff0">
								<orgName type="department">Department of Computer Science and Technology</orgName>
								<orgName type="institution">Tsinghua University</orgName>
								<address>
									<postCode>100084</postCode>
									<settlement>Beijing</settlement>
									<country key="CN">China</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">PNTM -Integration of Petri Nets and Transactional Memory</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">C904026E20CF91326772DE2B6210CE84</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-24T00:44+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>PNTM demonstrates a new concurrent programming model, providing explicit concurrency among cooperative transactions with correctness. It integrates a special Petri net and transactional memory, and improves the performance of transactions by decreasing the rate of conflicts. The GUI part of PNTM environment is based on PNK [1], the compiler is a modified GJC [2], and the runtime is based on DSTM2 [3].</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Editor The IDE provides a simple GUI with a code editor and a net editor. The editor for Petri net system is modified from PNK. All elements can have extra fields and be edited visually. The extra fields such as resources in places and code in transitions all correspond special variables and functions in the code, as in Table <ref type="table" target="#tab_0">1</ref>. The runtime is a Petri nets VM using DSTM2. The first 3 API can build up a simulator of a Petri net and the last 2 API control the simulator. The simulator allocate a DSTM2 Thread for every transition in the net. The Threads are all waiting for notification. Only notified Thread can consume resources, call function and produce new resources. A global lock is used to protect all resources in order to make manipulation on resources atomic and prevent deadlock. Some optimizations accelerate the check-and-consume process. Hence the overhead is relatively low. When the transition consumes resources and is ready to fire, corresponding petrinet function is called using reflection. If all global variables protected by STM successfully commit, the transition will produce new resources. Otherwise the transition will revert all state and return consumed resources.</p><p>Compilation At the early stage of compilation, the compiler will recognize and mark new keyword petrinet, resource, global. The global variables need to transform to instances of pre-defined interfaces in order to meet requirement of DSTM2's APIs. For example, equivalent code to transformed "global int a;" is shown in Table <ref type="table" target="#tab_2">2</ref>. AInt refers to "Atomic Integer". After AST is built, the compiler will check the semantic correctness. The functions with petrinet modifier and Petri nets themselves should meet constraints below: In addition, all references of global variables and all left-values consisted of global variables must be transformed to proper getter and setter in order to meet requirement of DSTM2's API. Equivalent code to getter and setter is shown in Table <ref type="table" target="#tab_3">3</ref>. The rest of compilation is the same with GJC.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Future Work</head><p>We are making efforts to some basic performance evaluation.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>1 .</head><label>1</label><figDesc>petrinet function must have function body. 2. petrinet function should have no parameter. 3. Only resource, global and local variables can be used in a petrinet function. 4. Only petrinet function can be called in transition. 5. Resources in incoming arcs of a transition must be a superset of all resource variable used in corresponding petrinet function.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_0"><head>Table 1 .</head><label>1</label><figDesc>Extra fields in Petri nets' elements and corresponding elements in code code in transition petrinet function name resource in place resource variable inscription in arc resource variable Virtual Machine The code editor can compile code along with Petri nets. Before compilation,</figDesc><table /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_1"><head>the Petri nets are interpreted to internal representation for static check. In order to guarantee correctness at the level of Petri nets, the Petri net must meet constraints below:</head><label></label><figDesc></figDesc><table><row><cell>1. AddTransition(transition, code) 2. AddPlace(place, resource) adds place. adds transition. 3. AddArc(source, target, inscription) adds arc. 4. Start() starts simulation. 5. Join() terminates simulation.</cell></row></table></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_2"><head>Table 2 .</head><label>2</label><figDesc>Equivalent code to transformed code</figDesc><table><row><cell cols="2">original code equivalent code</cell><cell>pre-defined interface</cell></row><row><cell></cell><cell></cell><cell>@atomic interface AInt {</cell></row><row><cell></cell><cell></cell><cell>int getValue ();</cell></row><row><cell>global int a;</cell><cell>AInt a = factory_AInt.create();</cell><cell>void setValue (int value); }</cell></row><row><cell></cell><cell></cell><cell>Factory&lt;AInt&gt; factory_AInt =</cell></row><row><cell></cell><cell></cell><cell>Thread.makeFactory(AInt.class);</cell></row></table></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_3"><head>Table 3 .</head><label>3</label><figDesc>Equivalent code to getter and setter</figDesc><table><row><cell cols="2">transform type original code</cell><cell>equivalent code</cell></row><row><cell>initializer reference</cell><cell cols="2">global int a = 0; ...;a.setValue(0); x = a + 1; x = a.getValue() + 1;</cell></row><row><cell>left-value</cell><cell>a = x + 1;</cell><cell>a.setValue(x + 1);</cell></row><row><cell cols="2">self-operation a++;</cell><cell>a.setValue(a.getValue() + 1);</cell></row></table></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_0">. One resource should appear at no more than one place at any time.</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_1">. The input arcs to one transition should have no common resource.</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="4" xml:id="foot_2">. The output arcs from one transition should have no common resource. Besides, the resources in output arcs must be the subset of resources in input arcs.After checking the correctness at the level of Petri nets, the editor will append a piece of code for building Petri Net simulator at runtime. Hence the simulator is created and initialized at runtime. The runtime</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="5" xml:id="foot_3">provide 5 APIs as below:</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_4">W. Wu, Y. Zhang, S. Wang, Y. Dong: Petri Nets and Transactional Memory</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_5">PNSE'11 -Petri Nets and Software Engineering</note>
		</body>
		<back>
			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<monogr>
		<ptr target="http://www.informatik.hu-berlin.de/lehrstuehle/automaten/ina" />
		<title level="m">INA:Integrated Net Analyzer</title>
				<imprint/>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<monogr>
		<title/>
		<author>
			<persName><surname>Gjc</surname></persName>
		</author>
		<ptr target="http://www.sun.com/software/communitysource/j2se" />
		<imprint/>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">A Flexible Framework for Implementing Software Transactional Memory</title>
		<author>
			<persName><forename type="first">Maurice</forename><surname>Herlihy</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Victor</forename><surname>Luchangco</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Mark</forename><surname>Moir</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Preceedings of OOPSLA&apos;06</title>
				<imprint>
			<date type="published" when="2006">2006</date>
			<biblScope unit="page" from="253" to="262" />
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
