Real Time Systems - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Real Time Systems

Description:

an independent computation running within the address and execution space of an ... Download and unzip the model contained within 'ThreadsExercise.zip' ... – PowerPoint PPT presentation

Number of Views:107
Avg rating:3.0/5.0
Slides: 24
Provided by: phil7
Category:
Tags: real | systems | time | unzip

less

Transcript and Presenter's Notes

Title: Real Time Systems


1
Real Time Systems
  • Optional Capsules and
  • Threads

2
Review
3
Outline
  • Modeling Concurrency
  • Types of Concurrency
  • When to Use Each
  • Modeling Dynamic Structure
  • Dynamic Internal Structural
  • Static versus Dynamic Capsule Roles
  • Frame Services
  • Example

4
Concurrency Types
  • Process
  • heavy weight concurrency
  • a unique address space and execution environment
  • may be divided into a number of threads
  • Thread
  • light-weight concurrency
  • an independent computation running within the
    address and execution space of an enclosing
    process
  • Capsule
  • an even lighter form of concurrency
  • run in the context of an enclosing thread
  • logically concurrent with run-to completion
    semantics

5
When to Use Each
  • Capsules
  • most concurrency requirements can be handled
    simply by using light weight concurrent capsules
  • Threads
  • if performing a blocking system call
  • such as reading from a socket
  • for processor intensive operations
  • if the code section is critical and you wish to
    elevate its priority with respect to other
    capsules
  • Processes
  • required to run on a separate processor
    (client/server)
  • to gain memory protection / fault tolerance

6
Single-Threaded Model
7
Multi-Threaded Model
8
Dynamic Internal Structure
  • A common source of complexity in a real-time
    system is the need for reconfiguration of the
    system as it is running, based on dynamic changes
    in the external environment 1
  • one approach is to design a fixed (static) system
    based upon the worst case scenario
  • this will likely lead to a costly, inefficient
    solution
  • another approach is to employ some form of
    resource management, the most difficult being the
    dynamic creation and destruction of system
    components and relationships

9
Static vs Dynamic Capsule Roles
  • Fixed Capsule Roles
  • created and destroyed simultaneously when the
    containing capsule is created
  • basically, all capsule roles weve seen so far
  • Optional Capsule Roles
  • not created at the time of their containing
    capsules, but dynamically created / destroyed
  • Some of the Rules
  • an instantiated optional capsule must be a
    compatible subclass of the capsule role
    classifier
  • an optional capsule role can only be destroyed by
    its immediate container

10
Optional Capsules
11
RoseRT Frame Services
  • provide the mechanisms for creating and
    destroying optional capsules
  • provide the mechanisms for creating threads
  • Implementation Classes
  • Frame class type of a Frame service port
  • incarnate( ), incarnationAt( ), destroy( ),
    classIsKindOf( ) , classOf( ), className( )
  • RTActorID handle to a capsule instance
  • isValid( )
  • RTActorRef contains common info for each
    capsule role
  • size( )

12
dynamically create a capsule role
  • framePort.incarnate(
  • capsule_role,
  • capsule_class,
  • initialization_data,
  • type_descriptor,
  • logical_thread,
  • index )

denotes optional arguments
13
dynamically create a capsule role (2)
  • Example
  • RTActorID capsuleID
  • PrinterData myPrintData(14, printJob05)
  • capsuleID anotherFramePort.incarnate(
  • myDeviceRole, // capsule role
  • Printer, // capsule class (or use
    EmptyActorClass)
  • myPrintData, // initialization data
  • RTType_PrinterData, // type descriptor
  • printerThread, // logical thread name
  • -1 // next available index
  • )

14
(No Transcript)
15
dynamically destroy a capsule role
  • Framedestroy(RTActorRef) //capsuleRoleName
  • and
  • Framedestroy(RtActorID) //capsuleID
  • Examples
  • framePort.destroy(myDeviceRole) // myDeviceRole
    was created by the framework by the aggregation
    relatonship
  • or
  • RTActorID myDeviceID framePort.
    incarnationAt(capsuleRole, index) //then later
  • framePort.destroy(myDeviceID)

16
Example a Jam Controller
static capsule role name
17
Example Structure Diagram
three potentially instantiated capsule instances
18
Optional Capsules/Threads Exercise (see the
ThreadsExercise Model)
  • Download and unzip the model contained within
    ThreadsExercise.zip
  • Load and execute the model and observe its
    behaviour
  • Study the code contained within the model
  • Answer the following 4 questions

19
Threads Exercise Class Diagram
20
Threads Exercise - Questions
  • How are jammers created and destroyed? Explain.
  • a. What is the maximum number of possible
    jammers?
  • b. What is the maximum number ever active? which
    bands?
  • c. Why does there seem to be twice as many
    messages for G band jamming?
  • a. On what thread does the SysController execute?
    on what thread do jammers execute? where is this
    last thread defined?
  • b. When the JamController blocks (faked), what
    do the active jammers do? and why?
  • c. This may be perceived to be an undesirable
    behaviour, what design change could be made?

21
Threads Exercise - Questions (contd)
  • Delete the dependency (not just on the diagram)
    between the JamController and one of the specific
    Band Jammers. Recompile and observe the
    behaviour.
  • a. In what statement are you now getting a
    compile error? and why?
  • b. What would happen if the band provided by the
    SysController was C? which type of jammer would
    be created, if any?

22
References
  • 1 Selic, Gullekson, Ward, Real-Time Object
    Oriented Modeling, Chapters 6 10 Wiley, 1994
  • 2 RoseRT On-Line Help C Language Guide / C
    Services Library
  • 3 RoseRT On-Line Help C Language Guide /
    Services Library Class Reference

23
Questions
Write a Comment
User Comments (0)
About PowerShow.com