Software Engineering Prof. Dr. Bertrand Meyer Dr. Manuel Oriol Dr. - - PowerPoint PPT Presentation

software engineering
SMART_READER_LITE
LIVE PREVIEW

Software Engineering Prof. Dr. Bertrand Meyer Dr. Manuel Oriol Dr. - - PowerPoint PPT Presentation

Chair of Software Engineering Software Engineering Prof. Dr. Bertrand Meyer Dr. Manuel Oriol Dr. Bernd Schoeller Lectures 20: Engineering Complex Systems Today Complex Systems What is it? Examples Technologies involved


slide-1
SLIDE 1

Software Engineering

  • Prof. Dr. Bertrand Meyer
  • Dr. Manuel Oriol
  • Dr. Bernd Schoeller

Chair of Software Engineering

Lectures 20: Engineering Complex Systems

slide-2
SLIDE 2

Today

  • Complex Systems
  • What is it?
  • Examples
  • Technologies involved
  • Dynamically Evolvable Systems
  • What is it?
  • Examples
  • Technologies involved
  • Challenging Systems Engineering
  • How to engineer dynamic systems on dynamic?
  • How to specify or model them?
slide-3
SLIDE 3

COMPLEX SYSTEMS

slide-4
SLIDE 4

Complex Systems

  • In this lecture, a complex system is a system that can
  • nly be understood through its code, its platform and its

dynamics

  • This covers multithreaded applications, applications

relying on complex runtime, dynamically evolvable programs…

slide-5
SLIDE 5

Kinds of Systems

  • Embedded Systems
  • Concurrent Systems
  • Distributed Systems
  • Modifiable Systems
slide-6
SLIDE 6

Embedded Systems

  • Typically:
  • Limited amount of memory
  • Limited amount of processor time
  • Limited interfaces and limited GUI
  • Real-time constraints
slide-7
SLIDE 7

Concurrent Systems

  • Typically:
  • Multithreaded or Multiprocess applications
  • Concurrent accesses to data
  • Trade-off performance/safety
slide-8
SLIDE 8

Distributed Systems

  • Typically:
  • Several applications running concurrently
  • Communications through the network
  • Service-oriented
  • Several administrative domains
slide-9
SLIDE 9

Modifiable Systems

  • Typically:
  • Applications or groups of applications that can have

their code evolve at runtime

  • Service-oriented
slide-10
SLIDE 10

Challenges: Designing the apps

  • How to represent applications that are not simple to

represent?

  • How to write specifications?
slide-11
SLIDE 11

Challenges: Feasibility

  • Feasibility is always an issue
  • Try and find projects with similar features to assess it
  • Specialists are the key
slide-12
SLIDE 12

Challenges: Understanding the apps

  • Difficult to understand because the code relies heavily on

the runtime (e.g. Aspects in Spring)

  • Boilerplate code is everywhere (e.g. JDBC code, Spring

Code)

  • Become a specialist to code them: tricks can make a big

difference (e.g. iPhone, Palm Pilots)

slide-13
SLIDE 13

Challenges: Testing the apps

  • Do you test them?
  • How to test them?
  • How to make tests reproducible?
  • Doug Lea: “I wrote thousands of unit tests”
slide-14
SLIDE 14

Challenges: Prototyping

  • These applications tend to be of the “All or nothing” type:
  • nce the difficult part is coded it is quite easy and fast

to code the rest… Before it is, it is difficult to show prototypes that make sense to non-specialists

  • Application Deployment is a challenge
slide-15
SLIDE 15

Challenges: Debugging the apps

  • The runtime structures are difficult to debug (e.g. there

is no good debugger for concurrent apps)

  • Printed values do not always reflect actual structures

(e.g. in Java System.out.println(o))

  • Once you get down to the runtime, how do you know what

actually happens?

slide-16
SLIDE 16

DYNAMICALLY EVOLVABLE SYSTEMS

slide-17
SLIDE 17

Example of Challenging Systems

  • Dynamically evolvable applications are applications that

can change their code and data types at runtime.

  • What applications do that?
  • Apps with plug-ins
  • Components-Based applications
  • Applications made on top of dynamic programming

languages (interpreted, compiled)

slide-18
SLIDE 18

Applications with Plug-ins

  • Eclipse
  • Firefox
  • Photoshop
  • iTunes
slide-19
SLIDE 19

Applications with made from Components

  • Eclipse
  • TomCat
slide-20
SLIDE 20

Dynamically Evolvable Applications

  • None?
  • Well… some very specialized cases are running (ex.

DynInst) and in the general case, we have done it!!! 

slide-21
SLIDE 21

Technologies involved

  • Dynamic Loading + Dynamic Linking
  • Instrumentations
  • On more level of indirection
slide-22
SLIDE 22

Dynamic Loading and Dynamic Linking

  • Dynamic Loading: the capacity to load code at runtime
  • In C/C++ there are various loaders and linkers
  • the most used one on Linux/Unix is dlopen
  • In Java the JVM loads classes lazily and the ClassLoader

abstraction can be used for specific loading

slide-23
SLIDE 23

Instrumentation

  • Instrumentation means that you replace some code by

some other code…

  • Aspects can help you out with that (e.g. Aspects used in

Spring for logging and transactions)

slide-24
SLIDE 24

One more level of indirection

  • Simply keep a table that returns a pointer on the most

recent structure on demand.

  • Works for methods…
slide-25
SLIDE 25

TWO SYSTEMS FOR DYNAMIC UPDATES

slide-26
SLIDE 26

26

Why Dynamic Updates?

  • 24/7 service providers
  • Embedded systems
  • End-user updates

26

slide-27
SLIDE 27

27

Existing Solutions?

  • Stop and launch
  • Redundant hardware
  • Unsafe (e.g. Smalltalk 80)
  • Safe but limited (e.g. Malabarba 2001, K42, dynamic

libraries...)

slide-28
SLIDE 28

28

Issues: D’ replaces D

Object Graph Call Graph

slide-29
SLIDE 29

29

Requirements for Dynamic Updates in Java

  • Safe (type-safe)
  • As flexible as possible
  • Usable by programmers with minimal effort
  • Use a standard JVM
  • Change code on-the-fly with no constraint on time of

change or type of change Components platform isolation of components

slide-30
SLIDE 30

30

Solution: Components

Object Graph Call Graph Solved with Associative Naming Solved with Asynchronous Invocations

slide-31
SLIDE 31

31

Associative Naming

? d offers services that are requested, if d changes, they are called on its next version

slide-32
SLIDE 32

32

Asynchronous Invocations

arguments passed by value

slide-33
SLIDE 33

33

Software Produced: LuckyJ

  • Component platform
  • Components in isolation (using class loaders)
  • Associative naming
  • Asynchronous invocations
  • State transfer from one component to another

when updated

  • Local, distributed centralized, and P2P

implementation

slide-34
SLIDE 34

34

Results: WeeselJ Web Server

  • 160 versions of some parts of the code
  • 18 months
  • 4 reboots due to external causes
  • M. Oriol, G. Di Marzo Serugendo. Disconnected Service Architecture for

Unanticipated Runtime Evolution of Code. In IEE Proceedings - Software special issue on Unanticipated Software Evolution, vol. 151, no. 2, pp. 95-107, 2004 M.Oriol. Primitives for the Dynamic Evolution of Component-Based

  • Applications. In Proceedings of the 22nd Annual ACM Symposium on Applied

Computing (SAC 2007), 2007. (Short Paper)

slide-35
SLIDE 35

35

Requirements for Dynamic Updates in C

  • Safe (type-safe)
  • As flexible as possible
  • Usable by programmers with minimal effort
  • Make real programs dynamically updatable
  • Dynamic patches easy to make
slide-36
SLIDE 36

36

Issues: D’ replaces D f4’ replaces f4

Data Graph Call Graph Solved with Type Transformers Solved with Indirect Calls

slide-37
SLIDE 37

37

Type Transformers

? Based on versions and a level of indirection Type Transformer

slide-38
SLIDE 38

38

Indirect Calls

It always calls the latest version of f4

slide-39
SLIDE 39

39

Software Produced: Ginseng

  • A compiler based on cil that performs static

analyses and links to runtime libraries

  • Instruments concrete accesses of named

types and function calls

  • Type transformers generated mostly

automatically with heuristics

  • Loop extraction for long-running loops
  • The stack is untouched (implies delayed

updates to keep type-safety)

slide-40
SLIDE 40

40

Using Ginseng

slide-41
SLIDE 41

41

Results

  • Updated real programs
  • 3 years/12 versions of vsftpd
  • 1 years/9 versions of openssh
  • used the tool on apache, bind, zebra, linux kernel...
  • I. Neamtiu, M. Hicks, G. Stoyle, M. Oriol. Practical Dynamic Software

Updating for C. In Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI 2006), 2006.

slide-42
SLIDE 42

ENGINEERING COMPLEX SYSTEMS

slide-43
SLIDE 43

Complex Systems?

  • What is different with complex systems is that intuition

is not enough

  • Studies to check feasibility are time-consuming
  • Theory/Specifications to take care of nasty details.
slide-44
SLIDE 44

Usual Techniques still work…

  • They just don’t reflect very well what is happening in the

system…

  • How do you model dynamic updates?
slide-45
SLIDE 45

Updating pattern

Oriol, SAC, 2007

slide-46
SLIDE 46

Techniques especially adapted to complex systems

  • Example of Petri Nets for concurrency… (as well as

formal calculi such as Pi-Calculus or Ambients)

  • Example of updating components (which is a UML

extension)

  • Do not hesitate to make your own extension of the norm
  • r to reuse an existing one (from a research paper for

example)

slide-47
SLIDE 47

Reusing Formalisms…

Oriol, SAC, 2007

slide-48
SLIDE 48

Petri Nets

Inputs Outputs Transition Places Token

slide-49
SLIDE 49

Petri Net

  • Firing a transition means removing all tokens from the

input state and putting one on each of the output state

  • Inputs are all needed to fire a transition
  • The whole thing is asynchronous and non-deterministic
slide-50
SLIDE 50

Petri Nets Example: simple concurrency

join fork

slide-51
SLIDE 51

Petri Nets Example: simple concurrency

slide-52
SLIDE 52

Petri Nets Example: simple concurrency

slide-53
SLIDE 53

Example

http://www.informatik.uni-hamburg.de/TGI/PetriNets/tools/ java/Guth/

slide-54
SLIDE 54

Conclusions on Complex Systems

  • Engineering systems is not easy: Simply coding them will

not work.

  • Need to have more rigor than usual in the process
  • Modeling behavior and the way it works is a necessary

step

  • The good software engineer is able to work these things
  • ut and reuse modeling techniques found on the web, or

in articles when possible, make his own when not possible.

slide-55
SLIDE 55

Today

  • Complex Systems
  • What is it?
  • Examples
  • Technologies involved
  • Dynamically Evolvable Systems
  • What is it?
  • Examples
  • Technologies involved
  • Complex Systems Engineering
  • How to engineer dynamic systems on dynamic?
  • How to specify or model them?