Information Technology Reference
In-Depth Information
RudderSingleton
instance
RudderSingleton()
+ Instance()
Machine
Command
Bridge
Fig. 3. UML class diagram showing a rudder control design
object has one RudderSingleton and one Machine object should have one Rud-
derSingleton and not that it should be the same object. However, the verification
pattern allows us to deduce that.
Also, depending on the structure of the application, it may show us that the
Machine and the Bridge has simultaneous access to the rudders, and that may
lead to some conflicts about who controls the ship; but such a source conflict
is not handled by the Singleton pattern. It only ensures that there is a single
control object with atomic operations.
Timing Verification Condition: In embedded applications, the only timing con-
dition we can think of in connection with the Singleton pattern is the (worst
case) execution time for the method. It produces a rely condition, which is an
invariant that the application has to satisfy:
Active ( p )
(
Instance
> 0) ; (
Instance )
WCET Instance
here, Active is for each process a state variable which is true exactly when
the process is executing. A naive formulation would use for Active ( p ) but
that would assume a dedicated processor for each process. The Active variable
is manipulated by scheduling mechanisms which may be specified by duration
formulas [29].
3.2
Observer Pattern
A more intricate example is the Observer pattern. It is often used in embedded
systems to signal changes in an environment.
Intent: The intent of the observer pattern is to define a one to many dependency
on objects, so that when one object changes state, all its dependents are notified.
Motivation: Partitioning leads to a need to maintain consistency between objects
without tight coupling for reusability. Observers are updated when the subject
changes state. The key objects in the Observer pattern are observer and subject .
A subject may have any number of dependant observers, where all observers are
notified when the subject has changed state. The subject sends its notifications
without knowing its observers.
 
Search WWH ::




Custom Search