ADA Language
ADA Language
a Programming real-time
systems (in Ada)
Scheduling model
Fixed-priority pre-emptive
FIFO within priorities
protected body
protected type Bounded_Buffer is Bounded_Buffer is
entry Get (Item : entry
outGet (Item :
Any_Type); out Any_Type)
procedure Put (Item :when
in In_Buffer > 0 is
Any_Type);
private begin -- first read then move pointer
Item := Buffer(First);
First : Index := Index'First; -- 0
First := First
Last : Index := Index'Last; -- 4 + 1; -- free from overflow
In_Buffer : Count := In_Buffer
0; := In_Buffer - 1;
Buffer : Buffer_T;end Get;
end Bounded_Buffer; entry Put (Item : in Any_Type)
when In_Buffer < Buffer_Size is
begin -- first move pointer then write
Last := Last + 1; -- free from overflow
Buffer(Last) := Item;
In_Buffer := In_Buffer + 1;
end Put;
end Bounded_Buffer;
protected body
protected type Bounded_Buffer is Bounded_Buffer is
entry Get (Item : entry
outGet (Item :
Any_Type); out Any_Type)
entry Put (Item : in when Any_Type);
In_Buffer > 0 is Guard
private begin -- first read then move pointer
Item := Buffer(First);
First : Index := Index'First; -- 0
First := First
Last : Index := Index'Last; -- 4 + 1; -- free from overflow
In_Buffer : Count := In_Buffer
0; := In_Buffer - 1;
Buffer : Buffer_T;end Get;
end Bounded_Buffer; procedure Put (Item : in Any_Type)
begin -- overwrite on full
Last := Last + 1; -- free from overflow
Buffer(Last) := Item;
In_Buffer := In_Buffer + 1;
end Put;
end Bounded_Buffer;
component
concurrency
thread
functionality
synchronization
PI RI
control agent operations
(OBCS) (OPCS)
Cyclic component
Sporadic component
Protected data component
Passive component
cyclic component
cyclic operation
thread
RI
operations
(OPCS)
Should be Time_Span
but cannot …
sporadic component
wait
sporadic operation
thread
PI RI
signal control agent operations
(OBCS) (OPCS)
Protected component
No thread, only synchronization and operations
Straightforward direct implementation with protected object
Passive component
Purely functional behavior, neither thread nor synchronization
Straightforward direct implementation with functional
package
package Ada.Real_Time.Timing_Events is
type Timing_Event is tagged limited private;
type Timing_Event_Handler is
access protected procedure (Event : in out Timing_Event);
procedure Set_Handler (Event : in out Timing_Event;
At_Time : in Time;
Handler : in Timing_Event_Handler);
...
procedure Cancel_Handler (Event : in out Timing_Event;
Cancelled : out Boolean);
...
end Ada.Real_Time.Timing_Events;
ms
ms
ms