<!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>
      <title-group>
        <article-title>A Formal Model of Resource Sharing Con icts in Multithreaded Java ?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Nadezhda Baklanova</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Martin Strecker</string-name>
          <email>martin.streckerg@irit.fr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institut de Recherche en Informatique de Toulouse (IRIT), Universite de Toulouse</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Key terms. Model, Development</institution>
          ,
          <addr-line>ConcurrentComputation, FormalMethod, QualityAssuranceProcess</addr-line>
        </aff>
      </contrib-group>
      <fpage>550</fpage>
      <lpage>564</lpage>
      <abstract>
        <p>We present a tool for analysing resource sharing con icts in multithreaded Java programs. We consider two models of execution: purely parallel one and sequential execution on a single processor. A Java program is translated into a system of timed automata which is veri ed by the model checker Uppaal. We also present our work in progress on formalisation of Real-Time Java semantics and the semantics of timed automata.</p>
      </abstract>
      <kwd-group>
        <kwd />
        <kwd>resource sharing</kwd>
        <kwd>Java</kwd>
        <kwd>timed automata</kwd>
        <kwd>model checking</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Along with increasing usage of multithreaded programming, a strong need of
sound algorithms arises. The problem is even more important in programming
of embedded and real-time systems where liveness conditions are extremely
important. To certify that no thread would starve or would be deadlocked, lock-free
and wait-free algorithms have been developed. Lock-free algorithms do not use
critical sections or locking and allow to avoid thread waiting for getting access to
a mutual exclusion object. Nevertheless, only one thread is guaranteed to make
progress. Wait-free algorithms prevent starvation by guaranteeing a stronger
property: all threads are guaranteed to make progress, eventually. Such
algorithms for linked lists, described for example in [
        <xref ref-type="bibr" rid="ref11 ref4">4,11</xref>
        ], are very complex, di cult
to implement and, consequently, hard to verify.
      </p>
      <p>What is worse, these algorithms seem to be incompatible with hard real-time
requirements: the progress guarantees are not bounded in time. Thus, a lock-free
insertion of an element into a linked list by a thread may need several
(possibly in nitely many) retries because the thread can be disturbed by concurrent
threads. Under these conditions, it is not possible to predict how much time is
needed before the thread succeeds.
? Part of this research has been supported by the project Verisync
(ANR-10-BLAN0310)</p>
      <p>
        Critical sections are used in many applications in order to ensure concurrent
access to objects although if the scheduling order is wisely planned, locks are not
necessary since threads access objects at di erent moments of time. This is the
motivation for our work: we develop a tool for checking resource sharing con icts
in concurrent Java programs based on the statement execution time. This gives a
\time-triggered" [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] avor to our approach of concurrent system design: resource
access con icts are resolved by temporal coordination at system assembly time,
rather than during runtime via locking or via retries (as in wait-free algorithms).
      </p>
      <p>We assume that a program is annotated with WCET information known from
external sources. The checker translates a Java program into a timed automaton
which is then model checked by a tool for timed automata (concretely, Uppaal).</p>
      <p>In this paper, after an informal introduction (Section 2), we present a formal
semantics of the components of the translation, namely Timed Automata
(Section 3) and a multi-threaded, timed version of Java (Section 4). Then we describe
the mechanism of the concrete translator written in OCaml (Section 5) and give
some preliminary correctness arguments (Section 6) { the formal veri cation still
remains to be done. The conclusions (Section 7) discuss some restrictions of our
current approach and possibilities to lift them.</p>
      <p>Status of the present document: We give a glimpse at several aspects of our
formalisation, which is far from being coherent. Therefore, this paper is rather
a basis for discussion than a nished publication.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Informal Overview</title>
      <p>To show the main idea, we present an example of a concurrent Java program.
It is a primitive producer-consumer bu er with one producer and one consumer
where both producer and consumer are invoked periodically. The program is
annotated with information about statement execution time in //@ ... @//
comments.
One of the possible executions is shown in Figure 1.</p>
      <p>0 1
8
20</p>
      <p>After having translated this program to a system of timed automata we run
the Uppaal model checker to determine possible resource sharing con icts. The
checked formula is</p>
      <p>A[]8(i : int[0; objN umber 1])8(j : int[0; autN umber 1])waitSet[i][j] &lt; 1;
(1)
where waitSet is an array of boolean ags indicating whether a thread waits
for a lock of a particular object. If all array members in all moments of time
are false, no thread waits for a lock therefore no resource sharing con icts are
possible.</p>
    </sec>
    <sec id="sec-3">
      <title>Timed Automata Model</title>
      <p>
        Timed automata are a common tool for verifying concurrent systems; the
underlying theory is described in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. We formalize the basic semantics of an extension
of timed automata used in the Uppaal model checker. The formalized syntax
and semantics are adapted from [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>An automaton edge is composed of a starting node, a condition under which
the edge may be taken (guard), an action, clocks to reset and a nal node.
type-synonym ( 0n; 0a) edge = 0n
cconstr
0a list
id set
0n</p>
      <p>An invariant is a condition on a node which must be satis ed when an
automaton is in this node.
type-synonym 0n inv = 0n ) cconstr</p>
      <p>An automaton consists of a set of nodes, a starting node, a set of edges and
an invariant function.
type-synonym ( 0n; 0a) ta = 0n set
0n
( 0n; 0a) edge set
0n inv</p>
      <p>We use the model checker Uppaal which proposes an extension of classical
timed automata with variables. A full state comprises a node and a valuation
function. There are two types of variables: integer (aval ) and boolean (bval ),
and clock variables which have a special semantic status in timed automata.
The available transitions can be de ned knowing given this state.
record valuation=
aval :: id )nat
bval :: id )bool
cval :: id )time
type-synonym 0n state = 0n</p>
      <p>valuation</p>
      <p>A timed automaton can perform two types of transitions: timed delay and
edge taking. If an automaton takes an edge, variables may be updated or clocks
may be reset to 0. The Transition constructor takes a list of variable and clock
updates as an argument.
datatype 0a ta-action = Timestep time j Transition 0a list</p>
      <p>Accordingly, the timed automata semantics has two rules: delay and
transition. If an automaton is delayed, it stays in the same node, and values of all
clocks are increased to the value d. The invariant of the current node must be
satis ed.</p>
      <p>If an automaton takes a transition, the node is changed, and clock values
remain unchanged unless they are reset to 0. The invariants of both starting
and nal nodes must be satis ed as well as the guard of the taken transition. If
the action of the transition involves variable updates, the valuation function is
updated as well. This is done by the function application eval-stmts varv a.</p>
      <p>varv 0 = varv (jcval := add (cval varv ) d j)
varv j= invs l varv 0 j= invs l l 2 nodes
(nodes; init ; edges; invs) ` (l ; varv ) Timestep d ! (l ; varv 0)
varv j= g</p>
      <p>(l ; g; a; r ; l 0) 2 edges
varv 0 = eval-stmts varv a(jcval := reset (cval varv ) r j)
varv 0 j= invs l 0 l 2 nodes l 0 2 nodes
(nodes; init ; edges; invs) ` (l ; varv ) Transition a! (l 0; varv 0)</p>
      <p>
        A network of timed automata is a product automaton with exceptions in case
of handshaking actions [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Handshaking allows to synchronize two automata so
that both take an edge simultaneously.
      </p>
      <p>(s1; g1; a; cs1; s1 0) 2 edges1 (s2; g2; a; cs2; s2 0) 2 edges2</p>
      <p>a 2 getEdgeActions edges1 \ getEdgeActions edges2
((s1; s2); g1 d^e g2; a; cs1 [ cs2; s1 0; s2 0) 2 edges-shaking edges1 edges2
(s1; g; a; cs; s1 0) 2 edges1
a 2= getEdgeActions edges2
a 2 getEdgeActions edges1
s2 2 getEdgeNodes edges2
((s1; s2); g; a; cs; s1 0; s2) 2 edges-shaking edges1 edges2
(s2; g; a; cs; s2 0) 2 edges2
a 2= getEdgeActions edges1
a 2 getEdgeActions edges2
s1 2 getEdgeNodes edges1
((s1; s2); g; a; cs; s1; s2 0) 2 edges-shaking edges1 edges2
4</p>
    </sec>
    <sec id="sec-4">
      <title>Java Model</title>
      <p>
        The look of the Java semantics has been inspired by the Jinja project [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and its
multithreaded extension JinjaThreads [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. The Java execution ow is modeled
by three transition relations: evaluation, scheduler and platform. The evaluation
semantics is the semantics of a single thread, the scheduler semantics is
responsible for thread scheduling, and the platform semantics formalizes the notion
of time advancement. Taking into account the passage of time is the essential
increment wrt. the above-mentioned semantics.
      </p>
      <p>Following Jinja, we do not distinguish expressions and statements; their
datatype is the following:
datatype expr
= Val val
j Var vname
j VarAssign vname expr
j Cond expr expr expr
j While expr expr
j Annot annot expr
j Sync expr expr
j Sleep expr
... and others.</p>
      <p>The system state is large and complex; it stores local information of all
threads such as local variable values and expression to be evaluated, shared
objects, time, actions to be carried out by the platform, locks and wait sets.
Given this state and scheduler logic, the further execution order is deterministic.
record full-state =
threads :: id ) schedulable option | threads pool
th-info :: thread-id ) thread-state option | expression to be evaluated and state
sc-info :: schedule-info | locks and thread statuses
pl-info :: platform-info | global time
gl-info :: heap | heap state
ws-info :: waitSet | wait sets
running-th :: thread-id | currently running thread
pending-act :: action | action to be carried out by platform</p>
      <p>Evaluation semantics depends solely on local and heap variables therefore we
use the reduced variant of full state for thread evaluation step.
record eval-state =
ev-st-heap :: heap
ev-st-local :: locals</p>
      <p>When a thread expression is reduced, the duration of the performed action
is not taken into account on the evaluation step, so the action type is passed
further to the platform step where time advances according to the action. For
now we assume that any action of a particular type takes a xed amount of time
for execution.</p>
      <p>The evaluation rules take an expression and a local state and translate them
to the new pair of expression and state and also emit an action for the platform
step. Here are some examples of evaluation rules.</p>
      <p>fs ` (e; s) act ! (e 0; s 0)
fs ` (VarAssign vr e; s) act ! (VarAssign vr e 0; s 0)
fs ` (VarAssign vr (Val vl ); s) EvalAct (exec-time VarAssignAct )! (Val Unit ;
s(jev-st-local := ev-st-local s(vr 7! vl )j))</p>
      <p>Several rules use information about locks and wait sets that is not included
in the local state therefore they pull it from the full state.</p>
      <p>: locked a fs
fs ` (Sync (Val (Addr a)) e; s) lock-action a fs 0 ! (Sync (Val (Addr a)) e; s)
locked a fs</p>
      <p>fst (the (sc-lk-status (sc-info fs) a)) 6= runnint-th fs
fs ` (Sync (Val (Addr a)) e; s) lock-action a fs 0 ! (Throw [ResourceSharingCon ict ]; s)
locked a fs
fs ` (Sync (Val (Addr a)) (Val v ); s)</p>
      <p>
        unlock-action a fs 0 ! (Val Unit ; s)
5
We consider two models of program execution. The rst one is purely parallel, i.e.
each thread is assumed to execute on its own processor so that no thread waits
for CPU time. Another model is the sequential one when a program executes
on a single processor. The parallel model is easier, however, it does not seem to
be realistic. The sequential model represents the realistic situation for real-time
Java applications since the RTSJ (Real-Time Speci cation of Java [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]) speci es
the behavior for monoprocessor systems only.
      </p>
      <p>The translated Java programs must be annotated with timing information
about execution time of the following statement. The translation uses timing
annotations to produce timed automata which model the program. The obtained
system is model checked for possible resource sharing con icts.
5.1</p>
      <sec id="sec-4-1">
        <title>General principles</title>
        <p>We suppose that the translated program has a xed number of threads and
shared elds, all of them de ned statically. The initialization code for threads
and shared elds must be contained in the main method. The classes
implementing Runnable interface must be nested classes in the class containing the main
method. The required program structure is shown in the gure 2.</p>
        <p>Each thread created in the program is translated into one automaton, and
one more additional automaton modeling the Java scheduler is added to the
generated system.</p>
        <p>Java statements are translated into building blocks for condition statement,
loop etc. which are assembled to obtain the nal automaton. Annotated
statement is translated into its own block. Method calls and wait/notify statements
are not translated for now.</p>
        <p>The timed automata system contains an array of object monitors representing
acquired locks on shared objects. When a thread acquires a lock of an object,
the monitor corresponding to this object is incremented, and when the lock is
released, the monitor is decremented.</p>
        <p>There is a number of checks which are performed before on the program
source code which guarantee correctness of the generated model. One of the most
critical is the requirement that the whole parse tree must be annotated, i.e. for
any leaf of the AST there is a timing annotation somewhere above this leaf.
With this requirement the behavior of the generated system can be determined
in each moment of time.
public class Main {</p>
        <p>Res1 field1 ; // shared fields declaration
public static void main ( String [] args ){</p>
        <p>Run1 r1 ; // declarations of Runnable object instances
Thread t1 , t2 ; // thread declarations
r1 = new Run1 () ; // Runnable objects initialization
field1 = new Res1 () ; // shared fields initialization
t1 = new Thread ( null ,r1 ," t1 "); // thread creation
t1 . start () ; // thread start
}
private class Run1 implements Runnable {
public void run () { // thread logic implementation</p>
        <p>...
}</p>
        <p>}
}
private class Res1 { // resouce classes</p>
        <p>...
}</p>
      </sec>
      <sec id="sec-4-2">
        <title>5.2 Parallel model</title>
        <p>In the parallel model threads are supposed not to wait for processor time if
they want to execute a statement. However, threads can wait for a lock if they
need one which has been taken by another thread. Since this model is not very
realistic we concentrate on the sequential model further.</p>
      </sec>
      <sec id="sec-4-3">
        <title>5.3 Sequential model</title>
        <p>In the sequential model we assume that at every moment of time only one thread
or scheduler can execute. Threads which do not execute in a particular moment
of time wait for processor time. Also threads can wait for a lock; waiting does
not consume CPU time.</p>
        <p>Automata communicate with the scheduler through channels: if the scheduler
has selected one thread, it sends a message to it so the thread starts executing.
After nishing its execution, the thread sends a message to the scheduler, and
the next scheduling cycle starts. The scheduler uses channels run[i] to call the
i-th automaton, and the automata use the channel scheduler to give the control
back to the scheduler.</p>
        <p>There is an array of clocks c[i], each of them corresponding to one thread
automaton. These clocks are used to calculate time of annotated statements
execution or sleeping time. There is also one clock cGlobal used for tracking
global time.</p>
        <p>final2</p>
        <p>FINAL
(a) Assignment
(b) Sequence</p>
        <p>(c) Annotation
auxIf</p>
        <p>start1</p>
        <p>START</p>
        <p>The building blocks and their translation are the following for the sequential
model:
(a) Assignment (3a). Three new states and two transitions between them are
added. The transition from START to MIDDLE listens to the channel run[i],
and the transition from MIDDLE to FINAL calls the channel schedule. The
state MIDDLE is urgent since we assume that any statement except the
annotated one takes time for execution.
(b) Sequence (3b). Having two automata with start and nal states called start1,
start2 and final1, final2 correspondingly, the states final1 and start2
are merged.
(c) Annotation (3c). Three new states and two transition between them are
added. The transition from START to MIDDLE listens to the channel run[i],
sets the variable execTime[i] to the value of the current annotation and
resets the clock c[i] to 0. The transition from MIDDLE to FINAL calls the
channel schedule and resets the variable execTime[i] back to 0. The state
MIDDLE has an invariant forbidding the automaton to stay in this state if the
value of the clock c[i] bypasses execTime[i]. The transition from MIDDLE
start1
to FINAL has a guard enabling this transition only if the value of c[i] is
greater or equal to execTime[i]. The invariant and the guard ensure that
the automaton would be in the MIDDLE state as long as the annotation claims.
(d) Condition (3d,3e). Three new states and four transitions are added. If both
if and else branches are presented, the nal states of automata representing
the branch internals are merged. The states auxIf and auxElse are auxiliary
states introduced to divide listening and calling transitions therefore they
are made committed. Two transitions from START to auxIf and auxElse
listen to the channel run[i], and the transitions from auxIf to start1 and
from auxElse to start2 (or to final1 in case of absence of the else branch)
call the channel schedule.
(e) Lock (4a). Two meaningful states and two auxiliary states are added. The
transition from START listens to the channel run[i] and has a guard checking
whether a lock for the object in the argument of the synchronized statement
is not taken by other threads.
(f) Loop (4b). Two meaningful states and two auxiliary states are added. One
transition from the START goes to the next loop iteration, another one exits
the loop. Both transitions from START to auxLoop and auxEnd listen to the
channel run[i]. The transitions from auxLoop to start1 and from auxEnd
to FINAL call the channel schedule. Both auxLoop and auxEnd are made
committed. The nal state of the automaton corresponding to the loop body
is merged with the START state.
(g) Sleeping (4c). The automaton for sleep statement resembles the
automaton for annotated statement with additional elements for returning control
to the scheduler during sleeping. There are three meaningful and two
auxiliary states with transitions connecting them into a chain. The auxiliary
states, auxSleep and auxWake, are committed. The transition from START
to auxSleep listens to the channel run[i], sets the variable execTime[i] to
the duration of sleeping period and resets the clock c[i] to 0. The transition
from auxSleep to MIDDLE calls the channel schedule so that the scheduler
can schedule other threads. The transition from MIDDLE to auxWake listens
to the channel run[i] and has a guard enabling this transition only if c[i]
is greater or equal to execTime[i]. The update on this channel resets the
value of execTime[i] back to 0. Unlike the automaton for the annotated
statement, there is no invariant in the MIDDLE state because a thread is not
obliged to continue its execution right after it has woken up. It may wait
for processor time before. The transition from auxWake to FINAL calls the
schedule channel.
5.4</p>
      </sec>
      <sec id="sec-4-4">
        <title>Scheduler</title>
        <p>The Java scheduler maintains thread statuses and grants permission to execute
to threads. The scheduler model has three states: scheduling, runThread, wait.
The scheduler starts in the state scheduling which has transitions for updating
thread eligibility statuses. When all thread statuses are updated, the scheduler
moves to the state runThread calling the channel run[i] for some thread with
index i which is eligible for execution. While the thread is executing, the
scheduler stays in the state runThread. When the thread has nished its execution,
it calls a channel schedule, and the scheduler returns back to the scheduling
state, and the new scheduling cycle starts. If there was no thread eligible for
execution, the scheduler goes to the wait state where it can stay for some time
and repeat scheduling.</p>
        <p>
          Each thread gets two transitions for status updates. One assumes that a
deadline for an action performing by a thread has passed, another one assumes that
the deadline has not been reached yet. In the rst case the ag isEligible[i]
is set to true, and the thread with index i can be scheduled for execution.
Otherwise, isEligible[i] is set to false, and the thread with index i cannot be
scheduled.
c[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]&gt;=execTime[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]&amp;&amp;!isUpdated[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]
isEligible[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]=true,
isUpdated[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]=true,
updateAllStatuses()
c[0]&lt;execTime[0]&amp;&amp;
!isUpdated[0]
isEligible[0]=false,
isUpdated[0]=true,
updateAllStatuses()
noScheduled&amp;&amp;
statusUpdated
scheduling
        </p>
        <p>
          schedule?
resetStatusUpdated()
resetStatusUpdated()
wait
runThread
c[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]&lt;execTime[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]&amp;&amp;
!isUpdated[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]
isEligible[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]=false,
isUpdated[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]=true,
updateAllStatuses()
i:int[
          <xref ref-type="bibr" rid="ref1">0,1</xref>
          ]
isEligible[i]&amp;&amp;
statusUpdated
run[i]!
Java threads have a complex lifecycle shown in Figure 7. We adopt it to our
model with limitations (see Figure 6). States in building blocks for automata
can be attributed to a single class. For example, the start and end states of any
building block belong to the scheduling state.
        </p>
        <p>Each thread automaton starts
in the scheduling state; after being
scheduling scheduled it can go to one of the three
states below. A thread is in the state
//@ time @// executing if there is an assignment or
deadline passed an annotated statement to be
executed. A thread goes to the sleeping
executing state if it has met a sleep call; if a
thread wants to acquire a lock but it
sleep(time) cannot because another thread owns
deadline passed it, the active thread has to go to the
blocked state and wait until another
sleeping thread releases the lock.</p>
        <p>wait for lock The listed states are general, and
lock acquired automata may perform several
internal steps while staying in the same
blocked generalized state.</p>
        <p>Based on the state classi cation
above, the simulation function can be
Fig. 6: Thread model used by the trans- easily built by mapping states of Java
lation. semantics to states of TA semantics
belonging to the same class. This is a preliminary thought concerning a
construction of the simulation function.
6.1</p>
      </sec>
      <sec id="sec-4-5">
        <title>Outline of Correctness Proof</title>
        <p>We are in the process of carrying out a formal correctness proof. In the
foreseeable future, we will concentrate on the following ingredients:
1. We will de ne a simulation relation between the TA semantics (Section 3)
and the Java execution semantics (Section 4). Both semantics are instances
of timed transition systems.
2. We show that for each thread i, the Java execution semantics of thread i is
simulated by the execution semantics of the TA obtained from abstracting
(Section 5) the thread. Thus: Let Ji be the code executed by thread i. Let
T Ai = abstr(Ji) be the automaton obtained by the abstraction function
sketched in Section 5. Then we show that Ji T Ai.
3. We establish an analogous simulation relation between the Java code of the
scheduler JS and the corresponding timed automaton T AS (Figure 5), and
show JS T AS.</p>
        <p>
          Future work will concentrate on establishing a correspondence between timed
transition systems (TTSs), logics, and simulation, in the following sense:
1. We will formalize a notion of execution trace of a TTS, formalize an
appropriate temporal logic and establish the traditional model relation between
traces and formulae of the temporal logic. In this context, we hope to be
able to extend previous work described in [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
2. We will show that simulation induces a trace inclusion property, which
again induces preservation of a certain class of models of formulae.
3. Using this result and the system re nement property of (4), we will show
that the correctness formula established by model checking (1) makes indeed
a correct prediction about the behaviour of our concurrent Java programs.
Di erently said: A Java program certi ed as free of resource access con icts
by model checking has no execution traces in which two threads access a
resource at the same time.
7
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusions</title>
      <p>This paper describes work in progress. The generation of Timed Automata out
of Java code is still undergoing major changes, and the precise de nition of a
correctness statement and its proof still have to be done.</p>
      <p>We may however comment on some fundamental assumptions of our
approach, which may in part seem unrealistic.</p>
      <p>
        { Obtaining WCET annotations: In the examples of this paper, the WCET
annotations are ctitious values. There are WCET analysis tools especially
geared at Java [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] that could be used to provide these annotations.
{ Worst-case vs. exact execution time: Even then, the problem remains that
our assumptions refer to the exact execution time of the code, whereas a
WCET analysis only provides an upper bound. We intend to introduce sleep
statements at the end of annotation statements so that a thread remains
blocked until its WCET has indeed elapsed.
{ Granularity: The size of code blocks we analyze (included, for example, in
annotation statements) is not supposed to be in the order of a few
instructions, but in the order of several hundred instructions. This is meant to
reduce the relative error when estimating the WCET, and also to obtain
reasonably-sized timed automata.
{ Non-interruptible annotation statements: We presently assume that
annotation statements are not interrupted, without verifying it. Future work will
try to extend our approach in such a way
that threads are annotated with more accurate timing information (such
as: periodicity) so that the mentioned assumption can be veri ed;
this assumption can be relaxed and interruption by higher-priority threads
is possible, again under the hypothesis that the release parameters of
periodic threads are known.
      </p>
      <p>Acknowledgements. We are grateful to Marie Du ot-Kremer, Pascal Fontaine
and Stephan Merz (Loria) and Jan-Georg Smaus (Irit) for discussions about this
work.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Alur</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dill</surname>
            ,
            <given-names>D.L.</given-names>
          </string-name>
          :
          <article-title>A theory of timed automata</article-title>
          .
          <source>Theoretical Computer Science</source>
          <volume>126</volume>
          ,
          <issue>183</issue>
          {
          <fpage>235</fpage>
          (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Baier</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Katoen</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          :
          <article-title>Principles of Model Checking</article-title>
          . MIT Press (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bengtsson</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yi</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          :
          <article-title>Timed automata: Semantics, algorithms and tools</article-title>
          . In: Desel,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Reisig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            ,
            <surname>Rozenberg</surname>
          </string-name>
          ,
          <string-name>
            <surname>G</surname>
          </string-name>
          . (eds.)
          <source>Lectures on Concurrency and Petri Nets, Lecture Notes in Computer Science</source>
          , vol.
          <volume>3098</volume>
          , pp.
          <volume>87</volume>
          {
          <fpage>124</fpage>
          . Springer Berlin / Heidelberg (
          <year>2004</year>
          ),
          <volume>10</volume>
          .1007/978-3-
          <fpage>540</fpage>
          -27755-2
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Harris</surname>
            ,
            <given-names>T.L.:</given-names>
          </string-name>
          <article-title>A pragmatic implementation of non-blocking linked-lists</article-title>
          .
          <source>In: Lecture Notes in Computer Science</source>
          . pp.
          <volume>300</volume>
          {
          <fpage>314</fpage>
          . Springer-Verlag (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Klein</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nipkow</surname>
            ,
            <given-names>T.:</given-names>
          </string-name>
          <article-title>A machine-checked model for a Java-like language, virtual machine, and compiler</article-title>
          .
          <source>ACM Trans. Program. Lang. Syst</source>
          .
          <volume>28</volume>
          (
          <issue>4</issue>
          ),
          <volume>619</volume>
          {
          <fpage>695</fpage>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Kopetz</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bauer</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>The time-triggered architecture</article-title>
          .
          <source>Proceedings of the IEEE</source>
          <volume>91</volume>
          (
          <issue>1</issue>
          ),
          <volume>112</volume>
          {
          <fpage>126</fpage>
          (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Lochbihler</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Verifying a compiler for Java threads</article-title>
          . In: Gordon, A.D. (ed.)
          <source>European Symposium on Programming (ESOP'10)</source>
          . LNCS, vol.
          <volume>6012</volume>
          , pp.
          <volume>427</volume>
          {
          <fpage>447</fpage>
          . Springer (Mar
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <article-title>8. The Real-Time for Java Expert Group: The Real-Time Speci cation for Java (Jan</article-title>
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Schimpf</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Merz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Smaus</surname>
            ,
            <given-names>J.G.</given-names>
          </string-name>
          :
          <article-title>Construction of Buchi automata for LTL model checking veri ed in Isabelle/HOL</article-title>
          . In: Nipkow,
          <string-name>
            <given-names>T.</given-names>
            ,
            <surname>Urban</surname>
          </string-name>
          , C. (eds.) 22nd
          <source>Intl. Conf. Theorem Proving in Higher-Order Logics (TPHOLs</source>
          <year>2009</year>
          ).
          <source>Lecture Notes in Computer Science</source>
          , vol.
          <volume>5674</volume>
          . Springer, Munich, Germany (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Schoeberl</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pedersen</surname>
          </string-name>
          , R.:
          <article-title>WCET analysis for a Java processor</article-title>
          .
          <source>In: Proceedings of the 4th international workshop on Java technologies for real-time and embedded systems</source>
          . pp.
          <volume>202</volume>
          {
          <fpage>211</fpage>
          . JTRES '06,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Timnat</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Braginsky</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kogan</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Petrank</surname>
          </string-name>
          , E.:
          <article-title>Wait-free linked-lists</article-title>
          . In: Ramanujam,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Sadayappan</surname>
          </string-name>
          , P. (eds.) PPOPP. pp.
          <volume>309</volume>
          {
          <fpage>310</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <article-title>uml-diagrams.org: Java 6 thread states and life cycle</article-title>
          . http://www.uml-diagrams. org/examples/java-6
          <article-title>-thread-state-machine-diagram-example.html? context=stm-examples</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>