Using Transition Systems to Formalize a Pattern for ... - Marcus Fontoura

0 downloads 0 Views 148KB Size Report
Frameworks”, Monografias em Ciência da Computação,. MCC28/98, Departamento de Informática, PUC-Rio, 1998. (also submitted to IEE Proceedings – ...
Using Transition Systems to Formalize a Pattern for Time Dependable Applications

Edward Hermann Haeusler and Marcus Fontoura Computer Science Department, Pontifical Catholic University of Rio de Janeiro Rua Marquês de São Vicente, 225, 22453-900 Rio de Janeiro, Brazil {hermann, mafe}@inf.puc-rio.br

pattern utilization is described through the use of a high-

Abstract

level specification language. The implementation section This paper presents an example of the use of transition

discusses the C++ code generation from the high-level

systems to formalize a pattern for soft real-time systems.

specification [7].

The importance of this relies on the fact that this formalization can be used as a guide to a mapping from

INTENT

projects to transition systems based model-checkers.

Promote synchronous behavior among several interacting

Since model-checking is a technique based on finite

and concurrent elements in a soft1 real-time environment.

transition systems, this approach, currently, can only be

MULTI-AUTOMATA

applied to applications that do not modify dynamically

message passing between the elements.

the

amount

of

interacting

objects.

Hence,

the

also

allows

asynchronous

MOTIVATION

applicability of the pattern is limited to statically configurable systems.

Consider a multimedia presentation environment where several

The pattern, namely MULTI-AUTOMATA, is presented through a variation of the GoF form. A high-level specification language used to instantiate the pattern is also presented. The high-level language respects the pattern semantics and is used to help the pattern

different

components

interact,

each

one

presenting a different multimedia element like text, audio, video, and still images. Each of these components should

have

its

own

execution

thread.

Also,

synchronization mechanisms among the components should be specified to control the presentation.

utilization.

1. The multi-automata pattern 1

This section presents the MULTI-AUTOMATA pattern

This paper considers soft real time systems as not concerning concrete

time specifications, but relative synchronization constrains among the

through a variation of the GoF pattern form [6]. The

interacting elements.

Figure 1 illustrates a scenario where a presentation is

the one presented in Figure 2. Four state diagrams are

composed of a book (text structured into chapters),

presented: one for each interacting element and one for

videos, and still images. Each book chapter has its own

the user. The language constructor “sync” specifies

video and set of pictures. The user can browse the

which transitions should happen at the same time. The

presentation elements in any order, but when the current

user has only one state, which is “Watching”. The

chapter is changed in one of the elements, the other two

asynchronous message “set(chapter

elements must also change.

to the object aBook, modeled by the Book state diagram, Multimedia Presentation

chapter1)” is sent

in the beginning of the system execution. The presentation starts when aBook handles the message.

Text Book User Control

The pattern guarantees that the three presentation objects will start showing their content at the same time because

Video

Chapter Synchronization

there is a synchronism specified for the transitions NextChapter, NextVideo, and NextChapterImages. The

Still Images

same holds for the finishing transitions, assuring that the three objects always show the content related to the same chapter.

Figure 1. Multimedia presentation example This means that if the user current focus is on the video element, and the video being presented is the one related to chapter 2, when she decides to see chapter 3 video, the book and the still images must also change.

The design structure presented in Figure 3 is a simplified utilization of the MULTI-AUTOMATA pattern for this example. Each one of the presentation objects is a subclass of the abstract class InteractingElement and has a message

queue

(queue)

to

handle

asynchronous

messages. The behavior of these objects is specified by In a general case, possibly new multimedia elements

the ShowChapter method: they have to check the

would be added to the system and more complex

message queue, handle the first message (if any), and

synchronization constrains could be needed. The

then show the content of the current chapter. The static

MULTI-AUTOMATA pattern provides a high level

variable chapter stores the value of the current chapter.

language to specify synchronization constrains among interacting objects. The language has constructors for specifying state transition diagrams for each class, synchronization constrains, and asynchronous message passing.

The MultimediaPresentation class aggregates all the interacting objects. Note that the configuration of how many interacting objects of each class are presented has to be statically defined. This is a limitation of the pattern, which can be applied only to statically configurable

Taking a deeper look into the multimedia presentation example, one possible specification of the application is

systems.

BOOK

STILL IMAGES NextChapterImages

NextChapter

Zoom Stoped

Stoped

ZoomOut

ShowText FinishChapterImages Zoom -

Zoom +

FinishChapter

Zoom + ZoomIn

VIDEO

NextVideo

Stoped

USER

Presenting Watching

FinishVideo

Pause

aBOOK

Suggest Documents