Java Reference
In-Depth Information
7.3
Control flow models
We identify three types of control flow models.
1 Single-threaded . This is the basic model where no concurrency is
present; at any time there is only one instruction that is being executed.
Only one component at a time is active and it has to yield control to other
components (usually by method invocation).
2 Virtual processes . This is based on a single threaded model but gives the
appearance of concurrent execution. In this approach a controller com-
ponent schedules the execution of the other components and gives them
control. The scheduling can be performed periodically or based on events.
The components whose execution is scheduled are responsible for
performing the scheduled activity and returning the control back to the
controller. This model is based on a logical decomposition of activities in
simple steps whose execution requires only short intervals of time. The
programmer has the responsibility of decomposing the components'
activities according to the application requirements.
3 Multithreaded . This approach allows real concurrency; it is based on the
concurrency mechanisms of the operating system. Several threads can be
running at the same time in an application. Even in this case, only one
component has control over the application execution. In contrast to the
virtual processes approach, the decomposition of components' activities
in simple steps is performed by the operating system at a lower granu-
larity. The main disadvantage is that the threads management raises the
computational load.
7.4
Part overview
The second part of this topic is organized in four case studies. They
present object architectures that implement different architectural styles,
communication mechanisms and concurrency models. The case studies use
different methods to synthesize generic components (see Table 7.1).
The case study presented in Chapter 8 (Code documentation) deals with
the development of a graphical application that parses a source Java code
Table 7.1 Architectures adopted in the case studies
Architectural
Communication
Concurrency
Case study
style
mechanism
models
8 Code documentation
Data-centred
Method invocation
Single-thread
9 Work cell
Virtual machine
Event-driven
Virtual processes
10 Mobile robot
Master-slave
Message-oriented
Multithread
11 Car Parking
Layered
Method invocation and
Multithread
event-driven
 
Search WWH ::




Custom Search