cs 282 principles of operating systems ii middleware for distributed real-time & embedded...

31
CS 282 CS 282 Principles of Operating Systems II Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Middleware for Distributed Real-time & Embedded Systems Systems Dr. Douglas C. Schmidt [email protected] www.dre.vanderbilt.edu/~schmidt/cs282/ Professor of EECS Vanderbilt University Nashville, Tennessee

Upload: robert-fewell

Post on 30-Mar-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

CS 282CS 282Principles of Operating Systems IIPrinciples of Operating Systems IIMiddleware for Distributed Real-time & Middleware for Distributed Real-time &

Embedded SystemsEmbedded Systems Dr. Douglas C. [email protected]

www.dre.vanderbilt.edu/~schmidt/cs282/

Professor of EECS Vanderbilt University Nashville, Tennessee

Page 2: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

2

CS 282 Course Philosophy

Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify, human-engineered, efficient, and reliable, by the application of good design and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.

- Kernighan and Plauger

Page 3: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

3

•Required textbook

•Recommended reading

CS 282 Course Information•CS 282 class web page

www.dre.vanderbilt.edu/ ~schmidt/cs282/

•My office hours in Featheringill Hall 226

•Monday and Wednesday, noon to 2pm

•Our TA is Friedhelm Wolf ([email protected])

•His office hours are …

•Please send all questions to [email protected]

• I’ll send the answers to the class mailing list

Page 4: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

4

CS 282 Ground Rules

• Assignments must be submitted on time (including “Assignment 0”)

• Work must be your own

• No laptops in class

• You will be called upon periodically to answer questions

• You’ll get out of this course what you put into it, so be prepared to work hard

• Weekly quizzes

Page 5: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

5

Technology Trends (1/4)

Information technology is being commoditized • i.e., hardware & software are getting cheaper, faster, & (generally) better at a fairly predictable rate

These advances stem largely from standard hardware & software APIs & protocols, e.g.:

• TCP/IP, GSM, Link16

• POSIX, Windows, & VMs

• Middleware & component models

• Intel x86 & Power PC chipsets

• Quality of service (QoS) aspects

Page 6: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

6

Technology Trends (2/4)

Process Automation Quality Control

Avionics Mission Computing

Modalitiese.g., MRI, CT, CR,

Ultrasound, etc.

Electronic Medical Imaging

Software Defined Radio

Hot Rolling Mills

Growing acceptance of a network-centric component paradigm• i.e., distributed applications with a range of QoS needs are constructed by integrating components & frameworks via various communication mechanisms

Page 7: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

7

Technology Trends (3/4)

•Components encapsulate application “business” logic

•Components interact via ports•Provided interfaces, e.g.,facets•Required connection points, e.g., receptacles•Event sinks & sources•Attributes

•Containers provide execution environment for components with common operating requirements

•Components/containers can also•Communicate via a QoS-enabled middleware bus and

•Reuse common middleware services

QoS-enabled Component middleware is maturing & becoming pervasive

SecurityReplication NotificationPersistence

SchedulingA/V Streaming Load Balancing

Container

… …

QoS-enabled Middleware Bus

Container

Page 8: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

8

•e.g., standard technologies are emerging that can:1. Model2. Analyze3. Synthesize & optimize4. Provision & deploy

multiple layers of QoS-enabled middleware & applications

•These technologies are guided by patterns & implemented by component frameworks

•Partial specialization is essential for inter-/intra-layer optimization

Middleware

MiddlewareServices

DRE Applications

Operating Sys& Protocols

Hardware & Networks

<CONFIGURATION_PASS> <HOME> <…> <COMPONENT> <ID> <…></ID> <EVENT_SUPPLIER> <…events this component supplies…> </EVENT_SUPPLIER> </COMPONENT> </HOME></CONFIGURATION_PASS>

<CONFIGURATION_PASS> <HOME> <…> <COMPONENT> <ID> <…></ID> <EVENT_SUPPLIER> <…events this component supplies…> </EVENT_SUPPLIER> </COMPONENT> </HOME></CONFIGURATION_PASS>

Distributedsystem

Goal is not to replace programmers per se – it is to provide higher-level domain-specific languages for middleware developers & users

Model driven middleware that integrates model-based software technologies with QoS-enabled component middleware

Technology Trends (4/4)

Page 9: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

9

CS 282 Software Technology Focus

Distribute Real-time & Embedded (DRE) Middleware

Patterns & Pattern Languages

GPS IFF FLIR

Object Request Broker

AirFrame

AP Nav WTS

Event Channel

ReplicationService

SynchronizationPersistence

Fault Tolerance

Memory Management

Cross-cutting Concerns

Multi-faceted SoftwareDevelopment

Applications to DRE Systems

Collaborative Software Development Environments

Customizable Frameworks

Page 10: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

10

Getting Started with ACE+TAO

• This class will use ACE & TAO, which are object-oriented middleware that run on most operating systems

• e.g., Windows, Linux, & other UNIX platforms

• You can download ACE & TAO from http://download.dre.vanderbilt.edu

• There are instructions on how to build & use it in the release

• To use ACE & TAO you’ll need to learn a few new things

• e.g., Makefile Project Creator (MPC)

• Please let me know if you need help getting a C++ compiler installed on your machine

Page 11: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

11

Setting Up Your Environment

Setting up your environment on Windows• ACE_ROOT= the path to the DOC_ROOT directory

• TAO_ROOT=%ACE_ROOT%\TAO

• PATH=%ACE_ROOT%\lib;%PATH%

Setting up your environment on Linux (or other UNIX platforms)• ACE_ROOT=the path to the DOC_ROOT directory

• TAO_ROOT=$ACE_ROOT/TAO

• LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH

• Mac: Use DYLD_LIBRARY_PATH in lieu of LD_LIBRARY_PATH

Page 12: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

12

Configuring ACE

• ACE_ROOT/ace/config.h

• There are a number of config-*.h files in this directory• Copy one that matches your platform to config.h

• e.g., config-linux.h or config-windows.h

• ACE_ROOT/include/makeinclude/ platform_macros.GNU• Similarly here, e.g., platform

Page 13: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

13

Generating a Workspace for ACE & TAO

• Linux et al (in $TAO_ROOT$)• $ACE_ROOT/bin/mwc.pl –type gnuace TAOACE.mwc

• Windows• $ACE_ROOT/bin/mwc.pl –type vc8 TAOACE.mwc

Page 14: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

14

Generic MPC Template

Generic MPC templateproject (*Server) : taoserver {

IDL_Files {IDL_File_1.idl

}Source_Files {

Server_Code.cppServant_Code.cppOther_Code.cpp

}}

project (*Client) : taoclient {Source_Files {

Client_Code.cpp}

}

Page 15: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

15

Generating Project Files & Servant Code

• $ACE_ROOT/bin/mwc.pl [-type vc71 | -type gnuace]

• $ACE_ROOT/bin/tao_idl -GI idl_file.idl

Page 16: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

16

There are multiple COTS layers & research/

business opportunities

Historically, mission-critical apps were built directly atop hardware & OS•Tedious, error-prone, & costly over lifecycles

Standards-based COTS middleware helps:•Control end-to-end resources & QoS•Leverage hardware & software technology advances

•Evolve to new environments & requirements

•Provide a wide array of reuseable, off-the-shelf developer-oriented services

There are layers of middleware, just like there are layers of networking protocols

Component Middleware Layers

Page 17: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

17

Operating System & Protocols•Operating systems & protocols provide mechanisms to manage endsystem resources, e.g.,•CPU scheduling & dispatching•Virtual memory management•Secondary storage, persistence, & file systems•Local & remove interprocess communication (IPC)

•OS examples•UNIX/Linux, Windows, VxWorks, QNX, etc.

•Protocol examples•TCP, UDP, IP, SCTP, RTP, etc.

RTP

DNS

HTTP

UDP TCP

IP

TELNET

Ethernet ATM FDDI

Fibre Channel

FTP

INTERNETWORKING ARCH

TFTP

20th Century

Win2K Linux LynxOS

Solaris VxWorks

Middleware

MiddlewareServices

MiddlewareApplications

MIDDLEWARE ARCH

21st Century

Page 18: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

18 www.cs.wustl.edu/~schmidt/ACE.html

Host Infrastructure Middleware•Host infrastructure middleware encapsulates & enhances native OS communication & concurrency mechanisms to create reusable network programming components•These components abstract away many tedious & error-prone aspects of programming to low-level operating system APIs

•Examples•Java Virtual Machine (JVM), Microsoft Common Language Runtime (CLR), ADAPTIVE Communication Environment (ACE)

Synchronization

MemoryManagement

PhysicalMemoryAccess

AsynchronousEvent Handling

Scheduling

AsynchronousTransfer of

Control

www.rtj.org

Page 19: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

19

Distribution Middleware•Distribution middleware defines higher-level distributed programming models whose reusable APIs & components automate & extend the native OS network programming capabilities

•Examples•OMG CORBA, Sun’s Remote Method Invocation (RMI), Microsoft’s Distributed Component Object Model (DCOM)

•Distribution middleware enables clients to program distributed applications much like stand-alone applications• i.e., by invoking operations on target objects without hard-coding dependencies on their location, language, OS, protocols, & hardware

InterfaceRepository

IDLCompiler

ImplementationRepository

ClientOBJREF

Object(Servant)

in argsoperation()out args +

return

DIIIDL

STUBSORB

INTERFACE

IDLSKEL

DSI

Object Adapter

ORB CORE GIOP/IIOP/ESIOPS

Page 20: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

20

Common Middleware Services•Common middleware services augment distribution middleware by defining higher-level domain-independent services that allow application developers to concentrate on programming business logic

•Examples•CORBA Component Model & Object Services, Sun’s J2EE, Microsoft’s .NET

•Common middleware services alleviate need to write the “plumbing” code required to develop distributed applications by using lower-level middleware directly•e.g., application developers no longer need to write code that handles transactional behavior, security, database connection pooling or threading

Page 21: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

21

Domain-Specific Middleware

Modalitiese.g., MRI, CT, CR,

Ultrasound, etc.

Siemens MED •Common software platform for distributed electronic medical information & imaging systems

•Used by all ~13 Siemens MED business units worldwide

•www.syngo.com

Boeing Bold Stroke • Common software platform for Boeing avionics mission computing systems

• www.boeing.com

•Domain-specific middleware services are tailored to the requirements of particular domains, such as telecom, e-commerce, health care, process automation, or aerospace

•Examples

The domain-specific services

layer is where system integrators

can provide the most value &

derive the most benefits

The domain-specific services

layer is where system integrators

can provide the most value &

derive the most benefits

Page 22: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

22

•Present solutions to common software problems arising within a certain context

Overview of Patterns

•Help resolve key design forces

•Flexibility•Extensibility•Dependability•Predictability•Scalability•Efficiency

•Capture recurring structures & dynamics among software participants to facilitate reuse of successful designs

The Proxy Pattern

1 1Proxy

service

Service

service

AbstractService

service

Client

•Generally codify expert knowledge of design constraints & “best practices”

www.posa.uci.edu

Page 23: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

23

Overview of Pattern Languages

Benefits of Pattern Languages• Define a vocabulary for talking about software

development problems• Provide a process for the orderly resolution of

these problems• Help to generate & reuse software architectures

Motivation•Individual patterns & pattern catalogs are insufficient

•Software modeling methods & tools that just illustrate how, not why, systems are designed

Page 24: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

24

Software Design Abstractions for Concurrent & Networked Applications

Problem• Distributed app & middleware functionality is subject to change since it’s often reused in unforeseen contexts, e.g., •Accessed from different clients

•Run on different platforms•Configured into different run-time contexts

MIDDLEWARE

Solution•Don‘t structure distributed applications & middleware as a monoliths

•Instead, decompose them into modular classes, frameworks, & components

Solution•Don‘t structure distributed applications & middleware as a monoliths

•Instead, decompose them into modular classes, frameworks, & components

Page 25: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

25

Overview of Frameworks

Framework Characteristics

Application-specific functionality

•Frameworks exhibit “inversion of control” at runtime via callbacks

Networking Database

GUI

•Frameworks provide integrated domain-specific structures & functionality

Mission Computing E-commerce

ScientificVisualization

•Frameworks are “semi-complete” applications

Page 26: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

26

Comparing Class Libraries, Frameworks, & Components

Class Libraries

Frameworks

Macro-levelMeso-levelMicro-level

Borrow caller’s thread

Inversion of control

Borrow caller’s thread

Domain-specific or Domain-independent

Domain-specific

Domain-independent

Stand-alone composition

entities

“Semi-complete”

applications

Stand-alone language entities

Components

Class Library Architecture

ADTs

Strings

LocksIPC

Math

LOCAL INVOCATIONSAPPLICATION-

SPECIFICFUNCTIONALITY

EVENTLOOP

GLUECODE

Files

GUI

A class is a unit of abstraction & implementation in an OO

programming language

Framework Architecture

ADTs

Locks

Strings

Files

INVOKES

A framework is an integrated set of classes that collaborate to produce a reusable architecture for a family of applications

Reactor

GUI

DATABASE

NETWORKING

APPLICATION-SPECIFIC FUNCTIONALITY CALLBACKS

Middleware Bus

Component Architecture

A component is an encapsulation unit with one or more interfaces that provide

clients with access to its services

Naming

LockingLogging

Events

Page 27: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

27

Using Frameworks Effectively

Observations•Frameworks are powerful, but hard to develop & use effectively by application developers•It’s often better to use & customize COTS frameworks than to develop in-house frameworks

•Components are easier for application developers to use, but aren’t as powerful or flexible as frameworks

Successful projects are therefore often

organized using the “funnel” model

Page 28: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

28

Overview of the ACE Frameworks

Features•Open-source•6+ integrated frameworks

•250,000+ lines of C++•40+ person-years of effort

•Ported to Windows, UNIX, & real-time operating systems

• e.g., VxWorks, pSoS, LynxOS, Chorus, QNX

•Large user community

www.cs.wustl.edu/~schmidt/ACE.html

Acceptor Connector Component

Configurator

Stream

Reactor Proactor

Task

Application-specific

functionality

Local AreaNetwork

NYSE

NASDAQ

Page 29: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

29

The Pattern Language for ACEPattern Benefits• Preserve crucial design information used by applications & middleware frameworks & components

• Facilitate reuse of proven software designs & architectures

• Guide design choices for application developers

Page 30: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

30

• CORBA is a distribution middleware standard

• Real-time CORBA adds QoS to classic CORBA to control:

www.cs.wustl.edu/~schmidt/TAO.html

3. Memory Resources

•These capabilities address some (but by no means all) important DRE application development & QoS-enforcement challenges

2. Communication Resources

ProtocolProperties

Explicit Binding

Client Propagation & Server Declared Priority Models

Portable Priorities

Thread Pools

Static Scheduling Service

StandardSynchonizers 1. Processor Resources

Request Buffering

Example of Applying Patterns & Frameworks:

Real-time CORBA & The ACE ORB (TAO)

Page 31: CS 282 Principles of Operating Systems II Middleware for Distributed Real-time & Embedded Systems Dr. Douglas C. Schmidt d.schmidt@.vanderbilt.edu schmidt/cs282

31

Key Patterns Used in TAOwww.cs.wustl.edu/~schmidt/PDF/ORB-patterns.pdf

• Wrapper facades enhance portability

• Proxies & adapters simplify client & server applications, respectively

• Component Configurator dynamically configures Factories

• Factories produce Strategies

• Strategies implement interchangeable policies

• Concurrency strategies use Reactor & Leader/Followers

• Acceptor-Connector decouples connection management from request processing

• Managers optimize request demultiplexing