• No results found

Object-Oriented Software Construction

N/A
N/A
Protected

Academic year: 2021

Share "Object-Oriented Software Construction"

Copied!
26
0
0

Loading.... (view fulltext now)

Full text

(1)

OOSC - Summer Semester 2004

1

Chair of Sof tware Engineering

Object-Oriented Software Construction

(2)

2

Lecture 24:

(3)

OOSC - Summer Semester 2004

3

Chair of Sof tware Engineering

The goal

 Provide a practical and general foundation for

concurrent and distributed programming, ensuring reliability, reusability availability and extendibility.

(4)

4

The issue

 Everyone wants to benefit from concurrency and

distribution

 Physical (networks, multiprocessors)

 Logical (processors, threads)

 but applications remain extremely difficult to

build, especially to build right.

 SCOOP provides:

 Generality

 Ease of programming

 Robustness (including liveness, ...)

(5)

OOSC - Summer Semester 2004

5

Chair of Sof tware Engineering

Generality

 Provide a simple, general, easy to use

concurrency and distribution mechanism for programming concurrent applications:

 Internet and Web programming.

 Web services, peer-to-peer...

 Client-server applications.

 Distributed processing.

 Multi-threading.

 Multiple processes (Unix, Windows 95, Windows

(6)

6

An example: Multithreading

 Increasingly popular

 Notoriously hard to get right; major mistakes

remain in released applications; theoretical pitfalls

 Impedance mismatch with O-O programming

concepts

 Synchronization often achieved by low-level

mechanisms “Almaviva” name landlord loved_one O1 “Figaro” O2 “Susanna” O3

(7)

OOSC - Summer Semester 2004

7

Chair of Sof tware Engineering

Concurrency and objects

“I can’t understand why objects [of O-O languages]

are not concurrent in the first place”. Robin Milner, 1991

(8)

8

Formulating the question

 What is the simplest extension of object

technology that will support all forms of

concurrent computation — in an elegant, general and efficient way?

(9)

OOSC - Summer Semester 2004

9

Chair of Sof tware Engineering

Basic O-O mechanism

 Feature call (message passing):

(10)

10

Concurrent O-O should be easy!

(But: it’s not!)

 Analogies between objects/classes and

processes/process-types:

 General decentralized structure, independent

modules.

 Encapsulated behavior (a single cycle for a

process; any number of routines for a class).

 Local variables (attributes of a class, variables

of a process or process type).

 Persistent data, keeping its value between

(11)

OOSC - Summer Semester 2004

11

Chair of Sof tware Engineering

But the analogy breaks down quickly…

 ... and leaves room to apparent incompatibilities:

 Classes are repositories of services; it is

fundamental that they should be able to support more than one.

 How will processes serve each other’s requests?

(12)

12

Capturing common behaviors

deferred class PROCESS feature

live is

-- General structure with variants.

do from setup until over loop step end finalize end feature {NONE}

setup is deferred end

over: BOOLEAN is deferred end

step is deferred end

finalize is deferred end end

Why limit ourselves to just one behavior when we can have as many as we want?

(13)

OOSC - Summer Semester 2004

13

Chair of Sof tware Engineering

A printer mechanism

class PRINTER inherit

PROCESS

rename

over as off_line,

finalize as stop

end feature

stop is

-- Go off-line.

do

off_line := True end

step is

-- Execute individual actions of an iteration step.

do

start_job process_job finish_job

(14)

14

A printer mechanism (cont’d)

feature {NONE}

setup is doend start_job is doend process_job is doend finish_job is doend

(15)

OOSC - Summer Semester 2004

15

Chair of Sof tware Engineering

Other possible features

print_diagnostics

prepare_for_maintenance restart_job

(16)

16

The basic triangle of computation

 Computing consists of applying operations to

objects; to do so requires the appropriate

mechanisms – processors.

Action Object

(17)

OOSC - Summer Semester 2004

17

Chair of Sof tware Engineering

Separate entities

 A call of the form x.f (a) has different semantics when handled by the same or different

processors.

 Need to declare whether client processor is the

same as supplier processor or another.

x: separate A

 Contrast with the usual

x: A

(18)

18

Consistency rule

 In assignment

x := y

 If the source y is separate, the target x must be

separate too.

(19)

OOSC - Summer Semester 2004

19

Chair of Sof tware Engineering

Separate entities and classes

b: separate BOUNDED_QUEUE [SOME_TYPE] or:

separate class BOUNDED_BUFFER [G]

inherit

BOUNDED_QUEUE [G]

end

(20)

20

Creation

 If x is separate, then the creation instruction

create

x

 grabs a new processor, physical or virtual, and

assigns it to handle the object.

 Also: it is possible to obtain a separate object as

the result of a function. So processors can be allocated outside of Eiffel text proper.

(21)

OOSC - Summer Semester 2004

21

Chair of Sof tware Engineering

Generality

 “Separate” declaration does not specify the

processor.

 Semantic difference between sequential and

concurrent computation narrowed down to difference for separate calls:

 Precondition semantics

 Argument passing semantics

(22)

22

Two-level architecture

 General-purpose top layer (SCOOP).

 Several architecture-specific variants at the

bottom layer (SCOOP handles).

 Initial handles: .NET remoting; POSIX threads;

SCOOP

HANDLE n

(23)

OOSC - Summer Semester 2004

23

Chair of Sof tware Engineering

Two-level architecture

SCOOP

(24)

24

Predefined constructs and libraries

 Define specific details (how many processors...)

(25)

OOSC - Summer Semester 2004

25

Chair of Sof tware Engineering

Processor assignment

 The assignment of actual physical resources to

(virtual) processors) is entirely dynamic and

external to the software text.

 Simple notation: Concurrency Control File (CCF)

creation

proc1: sales.microsoft.com (2), coffees.whitehouse.gov (5), ... proc2: 89.9.200.151 (1), ...

 Physical resources may be Internet nodes,

(26)

26

References

Related documents

Keywords: Medium-frequency radar techniques; High-frequency radar techniques; Partial reflection radar; Spaced antenna technique; Full correlation analysis; Mesosphere

This document is further intended to clearly define a set of best practices as it relates to “attributes” of effective and usable banner ads (web banner formats, resolution

The numerical study of the stability of the plasma jet allows us to gain insight into the sensibility of the jet at the dierent frequencies of the instability. The coecient of

Place Matters: An Evolutionary Approach to Annie Proulx’s “The Half-Skinned Steer” and “Wamsutter Wolf”..

In December 2004, the Public Health Agency of Canada (PHAC) convened a special meeting of the Advisory Committee on Infection Prevention and Control for Creutzfeldt- Jakob Disease,

The Aerospace Industries Association represents the nation's leading manufacturers and suppliers of civil, military, and business aircraft, helicopters, UAVs, space systems,

Model-based Software Engineering, Generative Software Engineering, Object Oriented Software Construction, Software Architectures, Safety and Reliability of Software-controlled

In The Genera of Vascular Plants of Korea, Flora of Korea Editorial Committee (ed.), pp. Academy