Ada - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Ada

Description:

Append. Take. Rendez vous. task body Buffer is. B: array(0..N-1) of Integer; ... Append and Take can alternate, and have guards; Non-deterministic choice! SPIN demo ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 8
Provided by: phar68
Category:
Tags: ada | append

less

Transcript and Presenter's Notes

Title: Ada


1
Ada
2
Bounded buffer (reminder)
Take
Append
Consumer process
Producer process
3
Rendez vous
Buffer is now a task!
task body Buffer is B array(0..N-1) of
Integer In_Ptr, Out_Ptr Integer 0
count Integer 0 begin loop accept
Append(I in Integer) do B(In_Ptr)
I end Append Count Count 1
In_Ptr (In_Ptr 1) mod N accept
Take(I out Integer) do I
B(Out_Ptr) end Take Count Count
- 1 Out_Ptr (Out_Ptr 1) mod N end
loop end Buffer
Strict alternation Append and Take
procedure Producer( B Buffer I in
Integer) is begin B.Append(I) end Append
What if the buffer is empty?
4
SPIN demo
  • See fig8_2.prom
  • Simulate
  • Message Sequence Chart

How can we avoid the problem?
5
Select
loop select when Count lt N gt
accept Append(I in Integer) do
B(In_Ptr) I end Append
Count Count 1 In_Ptr
(In_Ptr 1) mod N or when Count
gt 0 gt accept Take(I out Integer)
do I B(Out_Ptr)
end Take Count Count - 1
Out_Ptr (Out_Ptr 1) mod N end
select end loop
Append and Take can alternate, and have
guards Non-deterministic choice!
6
SPIN demo
  • See fig8_3.prom
  • Simulate
  • Message Sequence Chart
  • Verify
  • Safety
  • Liveness

7
Conclusions
  • Ada features can be modelled in Promela
  • Ada is used for safety critical applications
  • Read the book for further details
Write a Comment
User Comments (0)
About PowerShow.com