IS ZC424-L12
description
Transcript of IS ZC424-L12
Software for Embedded Systems
IS ZC424 / ESLT ZC424
Lecture 12
Object Behavioral Analysis (contd…)
Architectural Design
September 29, 2014 1 ISZC424/ESLTZC424(Software for Embedded Systems)
Scenarios
• Statecharts vs. Scenarios
— Statecharts are constructive
– can be used to fully generate code as the entire state space of a system is provided
— Scenarios are semi-constructive
– They provide typical paths through the state space as the system is used
– They can add operations and event handling to a state model
• Diagrams for scenarios
— Sequence diagrams
— Timing diagrams
September 29, 2014 2 ISZC424/ESLTZC424(Software for Embedded Systems)
Calculator scenario 2*(3+4)
September 29, 2014 3 ISZC424/ESLTZC424(Software for Embedded Systems)
Calculator scenario 2*(3+4)
September 29, 2014 4 ISZC424/ESLTZC424(Software for Embedded Systems)
Calculator scenario 2*(3+4)
September 29, 2014 5 ISZC424/ESLTZC424(Software for Embedded Systems)
Calculator scenario 2*(3+4)
September 29, 2014 6 ISZC424/ESLTZC424(Software for Embedded Systems)
Calculator scenario 2*(3+4)
September 29, 2014 7 ISZC424/ESLTZC424(Software for Embedded Systems)
Simpler ones:
• Clock driven scheduling
— Cyclic scheduler
• Priority driven scheduling
— Rate Monotonic (RM)
— Deadline Monotonic (DM)
Scheduling in RT systems
September 29, 2014 8 ISZC424/ESLTZC424(Software for Embedded Systems)
• Store pre-computed schedule as table
• Each entry (tk , T(tk)) in table gives a decision time tk at which a scheduling decision is made
• T(tk) can either be a task whose jobs should start at tk, or I (idle, no periodic task scheduled)
• Idle time can be used for aperiodic jobs
Cyclic Scheduler
September 29, 2014 9 ISZC424/ESLTZC424(Software for Embedded Systems)
T1 = (4,1), T2 = (5, 1.8), T3 = (20, 1), T4 = (20, 2)
Cyclic Scheduler
September 29, 2014 10 ISZC424/ESLTZC424(Software for Embedded Systems)
Input: Stored schedule (tk, T(tk)) for k = 0, 1, … N-1.
Task SCHEDULER:
set the next decision point i and table entry k to 0;
set the timer to expire at tk;
DO forever;
accept timer interrupt;
if an aperiodic job is executing, preempt the job;
current task T = T(tk); increment i by 1;
compute the next table entry k = i mod N;
set the timer to expire at ⌊i/N⌋*H + tk ;
if the current task T is I
let the job at the head of the aperiodic job queue to run;
else, let the task T execute;
sleep;
end DO
End SCHEDULER
Cyclic Scheduler - Algorithm
September 29, 2014 11 ISZC424/ESLTZC424(Software for Embedded Systems)
• Most used and studied fixed-priority algorithm
• Priority of tasks is assigned based on their periods
— The shorter the period the higher the priority
— Rate is inverse of period
• Algorithm is called Rate-Monotonic (RM) algorithm and a schedule produced by the algorithm is Rate-Monotonic schedule
Rate Monotonic (RM) Algorithm
September 29, 2014 12 ISZC424/ESLTZC424(Software for Embedded Systems)
• Three tasks T1 = (4, 1), T2 = (5, 2), T3 = (20, 5)
• Priorities: T1 > T2 > T3
• Hyperperiod: 20
Example – RM Algorithm
September 29, 2014 13 ISZC424/ESLTZC424(Software for Embedded Systems)
• Another well-known fixed-priority algorithm
• Tasks are assigned priorities according to their relative deadline
—Shortest relative deadline has highest priority
Deadline Monotonic (DM) Algorithm
September 29, 2014 14 ISZC424/ESLTZC424(Software for Embedded Systems)
• Three tasks where Ti = (i, pi, ei, Di)
T1 = (50, 50, 25, 100)
T2 = (0, 62.5, 10, 20)
T3 = (0, 125, 25, 50)
• Priorities: T2 > T3 > T1 (Relative Deadline)
• LCM of periods is 250 (= Hyperperiod)
Example - DM Algorithm
September 29, 2014 15 ISZC424/ESLTZC424(Software for Embedded Systems)
T1 = (50, 50, 25, 100)
T2 = (0, 62.5, 10, 20)
T3 = (0, 125, 25, 50)
Priorities: T2 > T3 > T1 (Relative Deadline)
Example - DM Algorithm
September 29, 2014 16 ISZC424/ESLTZC424(Software for Embedded Systems)
T1 = (50, 50, 25, 100) T2 = (0, 62.5, 10, 20) T3 = (0, 125, 25, 50) Priorities: T1 > T2 > T3 (inverse of Period)
Example - RM Algorithm
September 29, 2014 17 ISZC424/ESLTZC424(Software for Embedded Systems)
• If relative deadline of every task is proportional to its period, RM and DM algorithm are identical
• When relative deadlines are arbitrary, DM may produce a feasible schedule when RM fails, but not vice versa
RM vs. DM
September 29, 2014 18 ISZC424/ESLTZC424(Software for Embedded Systems)
Architectural Design
September 29, 2014 19 ISZC424/ESLTZC424(Software for Embedded Systems)
• Analysis looks at key concepts and structures in the system
Design
September 29, 2014 20 ISZC424/ESLTZC424(Software for Embedded Systems)
• Analysis looks at key concepts and structures in the system
• Analysis is independent of how the solution is implemented
Design
September 29, 2014 21 ISZC424/ESLTZC424(Software for Embedded Systems)
• Analysis looks at key concepts and structures in the system
• Analysis is independent of how the solution is implemented
• Design specifies a particular solution
Design
September 29, 2014 22 ISZC424/ESLTZC424(Software for Embedded Systems)
• Analysis looks at key concepts and structures in the system
• Analysis is independent of how the solution is implemented
• Design specifies a particular solution
• Based on the analysis model in a way that optimizes the system
Design
September 29, 2014 23 ISZC424/ESLTZC424(Software for Embedded Systems)
• Three main categories of design
— Architectural
— Mechanistic
— Detailed
Design
September 29, 2014 24 ISZC424/ESLTZC424(Software for Embedded Systems)
Three levels of design
September 29, 2014 25 ISZC424/ESLTZC424(Software for Embedded Systems)
Design phases
Process Step Purpose Generated Artifacts
Architectural Design
Details the largest software structures, such as subsystems, packages, and tasks.
•Subsystem model
•Concurrency model •Distribution model •Safety/reliability model •Deployment model
Mechanistic Design
Includes classes working together to achieve common goals.
Collaboration model
Detailed Design Specifies the internal primitive data structures and algorithms within individual classes.
Class details
September 29, 2014 26 ISZC424/ESLTZC424(Software for Embedded Systems)
• What is architectural design?
Architectural Design
September 29, 2014 27 ISZC424/ESLTZC424(Software for Embedded Systems)
• What is architectural design?
— Architectural design identifies the key
strategies for the large-scale organization of
the system under development
Architectural Design
September 29, 2014 28 ISZC424/ESLTZC424(Software for Embedded Systems)
• Two fundamental kinds of architecture:
— Logical: organization of things that exist only
at design time i.e. the organization of classes
and data types
— Physical: organization of the system at
runtime
Architectural Design
September 29, 2014 29 ISZC424/ESLTZC424(Software for Embedded Systems)
Architectural Design
September 29, 2014 30 ISZC424/ESLTZC424(Software for Embedded Systems)
• Logical architecture can be organized based on the concept of domains
• A domain is an independent subject area that generally has its own vocabulary
— Domains provide a means by which model can be organized or partitioned into its various subjects, such as User Interface, Alarm Management, Communications, Guidance and Navigation, etc.
Logical Architecture
September 29, 2014 31 ISZC424/ESLTZC424(Software for Embedded Systems)
• A domain is represented as a «domain» stereotyped package that includes a mission, specifically "hold classes and types around the common subject matter”
• Domain does not dictate how objects will be organized and deployed at runtime
Logical Architecture
September 29, 2014 32 ISZC424/ESLTZC424(Software for Embedded Systems)
Domain diagram example
September 29, 2014 33 ISZC424/ESLTZC424(Software for Embedded Systems)
• Is concerned with the organization of things that exist at runtime
• Typical elements are subsystems, components, channels, etc.
• Domain structure usually does not completely reflect the physical architecture
Physical architecture
September 29, 2014 34 ISZC424/ESLTZC424(Software for Embedded Systems)
• Domain structure usually does not completely reflect the physical architecture. Example: Power Subsystem is constructed from instances of the classes defined in different domains
Physical architecture
September 29, 2014 35 ISZC424/ESLTZC424(Software for Embedded Systems)
• Physical architecture refers to the large-scale organization elements
Physical architecture
September 29, 2014 36 ISZC424/ESLTZC424(Software for Embedded Systems)
• Physical architecture refers to the large-scale organization elements
• These large-scale organizational elements don't do much, in and of themselves
Physical architecture
September 29, 2014 37 ISZC424/ESLTZC424(Software for Embedded Systems)
• Physical architecture refers to the large-scale organization elements
• These large-scale organizational elements don't do much, in and of themselves
• They organize the more primitive instances that do the real work
Physical architecture
September 29, 2014 38 ISZC424/ESLTZC424(Software for Embedded Systems)
• Physical architecture refers to the large-scale organization elements
• These large-scale organizational elements don't do much, in and of themselves
• They organize the more primitive instances that do the real work
• They provide delegation of requests and messages to the appropriate objects
Physical architecture
September 29, 2014 39 ISZC424/ESLTZC424(Software for Embedded Systems)
• Physical architecture refers to the large-scale organization elements
• These large-scale organizational elements don't do much, in and of themselves
• They organize the more primitive instances that do the real work
• They provide delegation of requests and messages to the appropriate objects
• They allow us to view and understand the system at different levels of abstraction — crucial for the construction and understanding of large
complex systems
Physical architecture
September 29, 2014 40 ISZC424/ESLTZC424(Software for Embedded Systems)
Thank You!