A Generative Programming Approach to Middleware Development · Middleware Framework Deployment &...
Transcript of A Generative Programming Approach to Middleware Development · Middleware Framework Deployment &...
1
A Generative Programming Approach to Middleware Development
OMG Workshop on Distributed Object ComputingReal-Time And Embedded Systems, July 14-17,2003
Venkita Subramonian and Christopher GillWashington University, St. Louis
{venkita,cdgill}@cse.wustl.edu
2OMG RT and Embedded Workshop, July 2003
Scope of Component Models• Component Models for
configuring and assembling application level components
• Weaving of components done based on application characteristics
• Component configuration isolated from component development
• Some level of automation• Serves reusability of
components
Component Server
Containers Containers
FlightSchedulingProcessing
WebGateway
ComponentDeployment
&ConfigurationMechanism
Middleware Framework
Deployment&
ConfigurationMetadata
ComponentRepository
Compose Deploy
MiddlewareConfiguration Metadata 6
4
3
1234
6
Configuring and deploying an application services end-to-end
Synthesizing application component implementations
Configuring application component containers
Composing components into application server components
Synthesizing middleware-specific configurations
BusinessLogic
7
7 Synthesizing middleware implementations
ClientMiddleware Bus
CentralDataStore
1
System Development
Field RadarControl
SystemsReal-time
FlightStatusBulletinBoard
ChicagoData
Center
ComponentAssembly
FlightScheduling
2Airport
ApproachControl
5 Synthesizing dynamic QoS provisioning and adaptation logic
5
3OMG RT and Embedded Workshop, July 2003
Need for Finer-level Configuration• Component configurations
– Inter-Component configuration – Intra-component configuration
• Component Implementation infrastructure
• Mapping of– High level component configurations to– Low level infrastructure elements
• Configuration of low-level infrastructure elements involve – Selection of various strategies based on
high level configurations– Validating appropriate combinations of
configurations
Component Server
Containers Containers
FlightSchedulingProcessing
WebGateway
ComponentDeployment
&ConfigurationMechanism
Middleware Framework
Deployment&
ConfigurationMetadata
ComponentRepository
Compose Deploy
MiddlewareConfiguration Metadata 6
4
3
1234
6
Configuring and deploying an application services end-to-end
Synthesizing application component implementations
Configuring application component containers
Composing components into application server components
Synthesizing middleware-specific configurations
BusinessLogic
7
7 Synthesizing middleware implementations
ClientMiddleware Bus
CentralDataStore
1
System Development
Field RadarControlSystems
Real-timeFlightStatusBulletinBoard
ChicagoData
Center
ComponentAssembly
FlightScheduling
2Airport
ApproachControl
5 Synthesizing dynamic QoS provisioning and adaptation logic
5
4OMG RT and Embedded Workshop, July 2003
Static vs. Dynamic Configuration• Static configuration chosen at
system startup– compile-time decisions to improve
performance– compile-time checks based on system
properties known a priori– Inference of strategies based on high
level configurations• Reconfiguration during system
mode changes– Expensive, but more flexible and
dynamic– E.g. Factory based configurations
• Hybrid strategies – as a balance between the two
10Hz 10Hz
5Hz 5Hz
20Hz10Hz5Hz
critical
non-critical
RMS+MLF
10Hz 10Hz5Hz 5Hz
20Hz10Hz5Hz
critical
non-critical
MUF
5OMG RT and Embedded Workshop, July 2003
Generative Approach as a Solution• Generative Programming
– Focus on families of software systems– Concrete system generated based on
configuration knowledge• Extend Generative programming
approach to low-level infrastructure configuration– Generate low level configurations from high
level configurations automatically• Configuration generators
– For mapping high level to low level configurations
– For assembling and weaving the right infrastructure elements
Generator
Configuration Knowledge
Concrete Implementation
6OMG RT and Embedded Workshop, July 2003
C++ Template Meta-Programming• Mechanism to embed generators in C++
– Completely within the purview of C++ language• Metainformation represented using
– Member traits, Traits classes, Traits templates• Compile-time control-flow constructs
– Template metafunctions E.g. IF, THEN, ELSE, CASE– Conditional compilation based on evaluation of type-
expressions• Issues
– Advanced usage of C++ templates – Compiler support an issue
7OMG RT and Embedded Workshop, July 2003
Example – RT Dispatching
Threads are all from dispatcher• Timers trigger suppliers• Suppliers push to EC• Events land in queues• Worker threads pull from queues
and push to consumers
Threads are all from dispatcher• Timers trigger suppliers• Suppliers push to EC• Events land in queues• Worker threads pull from queues
and push to consumers
Dispatcher
laxity
static
static
Prox
yProx
yFi
lterin
gC
orre
latio
n
Event Channel
ConsumersSuppliers
8OMG RT and Embedded Workshop, July 2003
RT Dispatching Configuration• QoS attributes based on
scheduling policy• Bundle together all QoS
attributes in one descriptor• Can we generate the
appropriate QoS descriptor?– Use a configurator to generate the
attributes– Scheduling policy as input to
generator
QoS DescriptorGenerator
Scheduling policy
QoS Descriptor
9OMG RT and Embedded Workshop, July 2003
Generator for QoS Descriptorenum Disp_Rule_t{ RMS, EDF, MLF, MUF, other };
template<Disp_Rule_t>struct QoSDesc{};//template specializationstemplate<>struct QoSDesc<RMS>{long period;//fields specific to RMS
};template<>struct QoSDesc<EDF>{long deadline;//fields specific to EDF
};template<>struct QoSDesc<MLF>{//fields specific to MLF
};
template <Disp_Rule_t disp_rule>struct QoSDescriptorGenerator{typedef typename
CASE<EDF,QoSDesc<EDF>,CASE<RMS,QoSDesc<RMS>,CASE<MLF,QoSDesc<MLF> > > >
disp_rule_case_list;
typedef typenameSWITCH<disp_rule,
disp_rule_case_list>::RET QoSDescriptor_;
typedef QoSDescriptor_ RET;};
typedefQoSDescriptorGenerator<EDF>::RET
QoSDescriptor;
10OMG RT and Embedded Workshop, July 2003
Other Use-Cases• ORB Infrastructure
configuration– Strategies based on inference
from system properties• E.g. Strategy used to wait for
replies – Wait on connection
• No interleaved processing of incoming requests
• No blocking factor– Wait on reactive mechanism
• Interleaved processing of incoming requests
• Blocking factor needs to be considered
• Configurator to choose strategy based on system characteristics
Client ServerC
Reactor
wait
Reactor
Servant
Callback6
Deadlockavoided
by waitingon reactor
1
3
42
5
Client ServerC
Reactor
3 wait
Reactor
Servant
Deadlockhere
Callback
1 2 4
5
Nested Upcall scenario
11OMG RT and Embedded Workshop, July 2003
Related Work• RMA using template meta programming
– RMA schedulability analysis at compile-time within the C++ type system
– Compile error when utilization bound exceeds the RM utilization bound
– “Rate-Monotonic Analysis in the C++ Typesystem”, Deters, Gill and Cytron, presented at RTAS 2003 Workshop on Model-Driven Embedded Systems
• Task-Scheduler Logic– Work by John Regehr and Alastair Reid– Reasoning about Concurrency in Component-Based
Systems Software– First order logic for representing system knowledge
12OMG RT and Embedded Workshop, July 2003
Conclusions• Component models deal with higher level
application components• Need to map high level specifications to
configuration of finer-grained components• Extend generative programming to configuration
of fine-grained infrastructure• Algebraic specification of system behavior • Inference of infrastructure configuration
strategies by reasoning of system behavior