Design Patterns for DistributedRealTime Systems ::Active Object:: ::Monitor Object:: - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Design Patterns for DistributedRealTime Systems ::Active Object:: ::Monitor Object::

Description:

A Design Pattern is a general reusable solution to a commonly ... Waiter - Proxy. Active Object Design Pattern Example - Restaurant. Manager - Scheduler ... – PowerPoint PPT presentation

Number of Views:120
Avg rating:3.0/5.0
Slides: 24
Provided by: sandeep45
Category:

less

Transcript and Presenter's Notes

Title: Design Patterns for DistributedRealTime Systems ::Active Object:: ::Monitor Object::


1
Design Patterns forDistributed/Real-TimeSystems
Active ObjectMonitor Object
  • Group 5
  • Eric Au
  • Sandeep Mistry
  • Amirsam Khataei
  • Ravisangar Sathiyaseelan

2
Introduction
  • A Design Pattern is a general reusable solution
    to a commonly occurring problem in software
    design.1
  • A Distributed Computing System is a method of
    computer processing in which different parts of a
    program run simultaneously on two or more
    computers that are communicating with each other
    over a network. 2
  • A Real-Time Computing System is the study of
    hardware and software systems which are subject
    to a "real-time constraint.3

3
Distributed/ Real-Time SystemDesign Pattern
  • Its a reusable solution that can be applied
    either
  • A Distributed System
  • or
  • A Real-Time System

4
Active Object
  • Intent
  • Decouples method execution from method
    invocation to enhance concurrency and simplify
    synchronized access to an object that resides in
    its own thread of control. 4
  • This design pattern may also be referred to as
    Concurrent Object and Actor

5
Structure of an Active Object Design Pattern
6
Active Object Sequence Diagram
7
Active Object Design Pattern Example - Restaurant
  • Customer -gt Client
  • Waiter -gt Proxy

8
Active Object Design Pattern Example - Restaurant
  • Manager -gt Scheduler
  • Order Queue -gt Activation Queue

9
Active Object Design Pattern Example - Restaurant
  • Order -gt Method Request
  • Servant -gt Chef

10
Active Object Design Pattern Consequences
  • Pros
  • Enhances concurrency
  • Simplifies synchronization
  • Method execution order can differ from invocation
    order
  • Cons
  • Performance overhead
  • Hard to debug

11
Active Object Design Pattern Known Uses
  • CORBA ORBs
  • ACE Framework
  • Siemens MedCom
  • Siemens Call Center management system
  • Actors

12
Monitor Object
  • Intent
  • The Monitor Object pattern synchronizes method
    execution to ensure only one method runs within
    an object at a time. It also allows an objects
    methods to cooperatively schedule their execution
    sequences. 5
  • This design pattern may also be referred to as
    Thread-safe Passive Object.

13
Structure of a Monitor Object Design Pattern

14
Monitor Object Design Pattern Sequence Diagram
15
Monitor Object Design Pattern Example
  • Free toilet

A monitor is an approach to synchronize two or
more computer tasks that use a shared resource.
Separation of toilet and lock
16
Monitor Object Design Pattern Example
  • Next people waiting in order of arrival

17
Monitor Object Design Pattern Pitfalls
  • Calling wait() in unstable state
  • Forget to release lock when an exception occurs
  • Not making the method synchronized when needed

18
Monitor Object Design Pattern Another Example
monitor account int balance 0
function withdraw(int amount) if amount lt 0
then error "Amount may not be negative" else if
balance lt amount then error "Insufficient funds"
else balance balance - amount
function deposit(int amount) if amount lt 0
then error "Amount may not be negative" else
balance balance amount
19
Monitor Object Design Pattern Consequences
  • Pros
  • Simplification of concurrency control
    implementation
  • Simplify synchronization of methods invoked
    concurrently on an object
  • Synchronized methods can cooperatively schedule
    their order of execution
  • Cons
  • Concurrency remains complicated
  • Tightly coupling between object functionality and
    synchronization mechanisms
  • Nested monitor lockout
  • New problems, deadlocks and starvation

20
Monitor Object Design Pattern Known Uses
  • Java Objects
  • ACE Gateway

21
Conclusion
  • Active Object
  • Separates method invocation from method
    execution.
  • Monitor Object
  • Synchronizes method execution to ensure only one
    method runs within an object at a time.

22
References
  • 1 Wikipedia Design Patterns
  • http//en.wikipedia.org/wiki/Design_pattern_(compu
    ter_science)
  • 2 Wikipedia Distributed Computing
  • http//en.wikipedia.org/wiki/Distributed_computing
  • 3 Wikipedia Real-Time Computing
  • http//en.wikipedia.org/wiki/Real-time_system
  • 4 Active Object
  • http//www.cs.wustl.edu/7Eschmidt/PDF/Act-Obj.pdf
  • 5 Active Object Pattern
  • http//www.cs.uu.nl/docs/vakken/no/active_object_p
    attern.pdf
  • 6 Monitor Object
  • http//www.cs.wustl.edu/schmidt/PDF/monitor.pdf
  • 7 Monitor Object Concurrency Pattern
  • http//www.cs.uu.nl/docs/vakken/no/monitor20objec
    t.pdf

23
Thank You
  • Questions?
Write a Comment
User Comments (0)
About PowerShow.com