Multi-threaded concurrent system is multi-threaded in a multi-core processor, in a certain storage mode, based on the shared memory, under the operation process. Before analyzing the operation of multi-threaded system, give the semantic rules of multi-threaded system, the storage rules of running storage mode, the memory access rules and data transformation rules.
2.1. Multithreaded system
Here presents the syntax of concurrent programming language.
Values where Access modes
Locations Inst Sequential programs
Registers Tid → SProg (Concurrent) programs
Thread identifiers
Inst ∋ inst if e goto
A finite set Loc of memory location; a finite set Reg of (local) register; a finite set Val of value; a finite set TId of thread identifier;
Owicki Gries inference logic is used for concurrency. OG inference extends Hoare’s proof rule logic and rules to infer the concurrent program form ||, allowing the combination of verified programs and into a verified concurrent program, provided that the two C1 and C2 proofs do not interfere with each other:
READ:
|
|
WRITE:
|
|
SEQ:
|
|
ITE:
|
|
WHILE:
|
|
CONSEQ:
|
|
With the advent of non-volatile memory, the presence of permanent memory in the storage system requires new storage modes to verify multithreaded concurrent systems. volatile memory storage mode of random access memory (RAM), and non-volatile permanent storage mode(NVM) have emerged in the storage system, as shown in
Figure 2 and
Figure 3.
In persistent memory model [
39,
40,
41,
42], Multithreaded system verification [
39,
43] is very important, since it is difficult to verify the correctness of a Multithreaded system [
44,
45] sharing variables [
46,
47,
48,
49,
50,
51,
52,
52]. Prior work fails to well consider the impact of data on control flow, which makes verification more difficult [
17,
18,
19,
20].
Figure 4 is the two multi-thread systems sharing
x and
y in the persistent memory mode,
are local variables, where
x,
y are shared variables, thread 1 and thread 2 run concurrently, thread 1 and thread 2 assign 2 and 1 respectively to
x, and thread 1 reads the value of
x, which may be 1 or 2. If the read value of
x is 2, 1 is written to the
y. thread 2 may read the value of
y as 1 or 0 (initial), and judge the value of
. If the read value
of
y is 0, Number 3 is assigned as the value of
x.
2.2. Petri net with read-write data
Definition 6 (Petri net).
Petri net [53,54] is a triplet =(Pl, Tr, Fl), where Pl and Tr are respectively finite sets of places and transitions and . while is a set of arcs (flow relationships). ; . : .
Figure 5 is a simple example of Petri net, where
;
;
for
;
for
i = 1, 3, 4;
.
Definition 7 (PN transition rules). Let =(N, M) be a simple Petri net and the transition rules :
(1) For transition , if , it is said that transition is enabled under the marking , which is recorded as ;
(2) If , the transition can take place under the marking , and a new marking can be obtained from the transition caused by the marking , which is marked as for ,
The whole state space of
=(N,
) is determined by its network N and initial marking
.
Figure 6 shows a transition
firing based on
Figure 5, which presents new tokens distribution of this Petri net.
We can find that under marking, = (2, 0, 0, 0). Firing of results in a new marking, i.e., . = (0, 2, 1, 0). Again , It follows the firing rule that In marking = (0, 2, 1, 0), both transitions of and are enabled. If fires, the new marking, i.e., = (0, 2, 0, 1).If fires, the new marking, i.e., = (0, 1, 1, 1).
Definition 8 (Petri net with data: DPN). An 8-tuple is called Data Petri net if it meets:
(1) (Pc, Tc, Fc, ) is a Petri net;
(2) Pd= =[, ], = [, ] . . . = [, ]. [, ] is the data place, Pd is a finite set of elements , where is the value of , and the token of the initial =1, =0.
(3) Fd : Td×Pd ∪ Pd×Td. Fd includes read data (Rd) and write data (Wr) arcs, namely Rd : Pd×Td and Wr: Td×Pd;
(4) Wr writing data transition: write the value to . Rd read data transition: read the value from the data place .
(5) Td: Td×Pd ∪ Pd×Td. Write data transition Td Pd, read data transition: Pd Td.
(6) Configuration: Pc and Pd represent the configuration or state, where c , M is the control marking, σ is the data status. is the initial configuration of the control place, and is the initial configuration of the data place, .
For the data place ∈Pd in DPN, its value is obtained by using the function getValue(pd). For convenience, a pair of data transition functions on conversion are also provided, namely Read: getValue(), Write: setValue()=value.
Definition 9 (DPN transition rule). and set DPN=(DN,M,Σ) It is a Petri net and has the following transition rules:
(1) For transition t ∈ Tc, if , control transition t is said to be enabled under the marking , which is recorded as ;
(2) If , the control transition t can occur under the marking , and the transition t caused by the marking can get a new marking , which is recorded as ,and for ∀ p ∈ Pc ∪ Pd.
For the transition , if , the data transition t in marking is enabled, which is recorded as ;
(3) In the marking (, Σ), if (, Σ)[td〉, data transition is enabled and triggered to get a new marking (, ), i.e., .
Wherein, .
(4) Finally, the entire state space of =(DN,(M, Σ)) is determined by its network and initial marking .
In
Figure 7,
is the write data transition, which realizes the write data value 2 to the data place
x (there is a green arrow line between the write transition and the data place office).
and
are control transitions. The first step is to obtain the write permission in
x, i.e., the token of
x. After obtaining the write permission in
x, write the value 2 to
x, and then return the write permission of the token to
x;
is the change of write data. Write the data value 1 to the data place
x, and the process is the same as the change of write data
.
is read data transition. Read the value of data place
x (there is a blue line between the data place object and the change of read data, and the end of the read data place object is a solid circle). First, judge whether data place object
x has read permission, i.e., whether there is a token in
x, if hold, it can be read. Read the value of
x through the reading arc, if there is no token in
x,
x cannot be read. The semantics of read data transition
are the same as that of read data transition
.
In
Figure 7, if
has a token and the data place
has a token,
can occur. After the occurrence, the value of
x(
x, 2) in the data place change to number 2, and the status is shown in
Figure 8; If there is a token in
, and there is a token in data place
x(
x, 2),
can occur. After
transition occur, the value in data place
x(
x, 1) change to number 1; When
has a token, and the data place has a token in
x(
x, 1), then
transition can occur. Read the value in
x(
x, 1) of the data place, and the token in
x(
x, 1) of the data place remains unchanged, and read the value of data place
x is number 1.
In
Figure 8, if
is triggered again (i.e.,
is triggered first, then
is triggered), the state is shown in
Figure 9.