Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
KTLA Study
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
KTLA Study
Commits
6e124005
Commit
6e124005
authored
Feb 17, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
17fbf801
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
0 deletions
+78
-0
KBackery.tla
KBackery.tla
+46
-0
KBackery.toolbox/.project
KBackery.toolbox/.project
+24
-0
KBackery.toolbox/.settings/org.lamport.tla.toolbox.prefs
KBackery.toolbox/.settings/org.lamport.tla.toolbox.prefs
+2
-0
kbackery.txt
kbackery.txt
+6
-0
No files found.
KBackery.tla
0 → 100644
View file @
6e124005
------------------------------ MODULE KBackery ------------------------------
CONSTANT N \* number of processes
(*******
--algorithm KBackery
variables
\* > *[i] is located on memory unit of proc[i]
ticket = [i \in 1..N |-> 0] \* ticket=0 means "inactive" XXX or `^\infty^' ?
inentry = [i \in 1..N |-> FALSE] \* T while in entry. To avoid ~ME(cs) on wait/entry race
process(i \in 1..N)
variable j \in Nat
{
while (TRUE) {
\* > get a ticket
inentry[i] := TRUE
ticket[i] := 1 + max(ticket[j] \A j \in 1..N) \* NOTE race wrt reading ticket[j]
inentry[i] := FALSE
\* > wait till when got ticket is < all other tickets
for j \in 1..N {
\* wait while proc[j] completes its entry, if it was in there, to make
\* sure that ticket[j] becomes settled if it was wait[i]/entry[j] race.
\* NOTE wait[i]/entry[j] race is only possible if entry[i]/entry[j] race precedes it.
Lwait_entry:
while (inentry[j])
goto Lwait_entry;
\* wait for proc[i] is ahead of proc[j].
Lwait_mytick:
while (~(ticket[j]=0 \/ (ticket[i],i) < (ticket[j],j)))
goto Lwait_mytick;
}
\* > service
cs: skip
\* > end - recycle the ticket
ticket[i] := 0
}
}
*******)
=============================================================================
KBackery.toolbox/.project
0 → 100644
View file @
6e124005
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
KBackery
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
toolbox.builder.TLAParserBuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
toolbox.natures.TLANature
</nature>
</natures>
<linkedResources>
<link>
<name>
KBackery.tla
</name>
<type>
1
</type>
<locationURI>
PARENT-1-PROJECT_LOC/KBackery.tla
</locationURI>
</link>
</linkedResources>
</projectDescription>
KBackery.toolbox/.settings/org.lamport.tla.toolbox.prefs
0 → 100644
View file @
6e124005
ProjectRootFile=PARENT-1-PROJECT_LOC/KBackery.tla
eclipse.preferences.version=1
kbackery.txt
0 → 100644
View file @
6e124005
process(i)
ticket[i] := 0
получить талончик
ticket[i] := 1 + max(ticket[j]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment