Upload
amice-copeland
View
217
Download
0
Embed Size (px)
Citation preview
Winter 2007 SEG2101 Chapter 11 1
Chapter 11
Implementation Design
Winter 2007 SEG2101 Chapter 11 2
Contents
• What is implementation design?
• Difference between real systems and SDL systems
• Implementation descriptions
• Design considerations
Winter 2007 SEG2101 Chapter 11 3
11.1: Implementation Design
• Goal: to define the mapping from the abstract system defined in functional design to a concrete system made up of hardware and software components.
• Task: to make all necessary decisions and to document the concrete system in sufficient detail to make implementation well defined.
• Result: an implementation design description, which explains how the abstract functions are realized.
Winter 2007 SEG2101 Chapter 11 4
The Scope of Implementation Design
Winter 2007 SEG2101 Chapter 11 5
Example: Implementation alternatives
Winter 2007 SEG2101 Chapter 11 6
The Forward Aspect
• Select among implementation alternatives being functionally equivalent to the SDL system.
Winter 2007 SEG2101 Chapter 11 7
The Feedback Aspect
• Adapt the SDL description in the case when the selected implementation is not functionally equivalent.
• There are important differences between the abstract world of SDL and the real world.
Winter 2007 SEG2101 Chapter 11 8
The Role of Design Constraints
• Although the realization alternatives for a given functional design are functionally equivalent, the choice of the designer is normally restricted by the non-functional requirements or design constraints.
• If no constraints exist or all solutions are equivalent, the designer is free to choose among solutions.
Winter 2007 SEG2101 Chapter 11 9
11.2: Differences between Real Systems and SDL Systems
• Fundamental differences– Physical components are rather imperfect compared to
the more ideal properties of SDL components.
– They develop errors over time, they are subject to noise and they need time to perform their processing tasks.
• Conceptual differences– In both worlds there are concepts for concurrency,
communication, sequential behavior and data, but they are not necessarily the same.
Winter 2007 SEG2101 Chapter 11 10
A Typical Realization
Winter 2007 SEG2101 Chapter 11 11
Fundamental Differences
• Processing time– CPU power
• Errors and noise
• Physical distribution
• Finite resources
Winter 2007 SEG2101 Chapter 11 12
Processing Time
• An SDL system is not limited by processing resources. The real world is different.
• One major issue is to balance the processing capacity of the implementation against the traffic load.
• When one knows the speed required, the next task is to find hardware-software solutions that will be fast enough.
• The hardware-software interfaces need special consideration.
• The receiver has to be fast enough to catch all relevant signal information at the speed it is passed over the channel.
Winter 2007 SEG2101 Chapter 11 13
Errors and Noise
• In the real world, errors will manifest themselves as faults in the operation of channels and processes.
• Hardware errors, physical damages and noise are caused by physical phenomena entirely outside the realm of SDL.
• The effect of errors and noise will often need to be handled explicitly in SDL description.
• How it can be detected, and damages may be limited?
• What a process should do if it never gets a response to a request or if it gets erroneous response?
• …
Winter 2007 SEG2101 Chapter 11 14
Physical Distribution
• Physically separated processes and channels may fail independently.
• Channels covering long physical distances are subject to more noise and errors than channels implemented in software within one computer.
• Transmission equipment and protocols are needed to implement the channel reliably. Physical distance may introduce new functions needed to support the implementation of channels.
• A positive effect of physical separation is that errors are isolated.
Winter 2007 SEG2101 Chapter 11 15
Finite Resources
• All resources in a real system are finite.
• There may be a maximum number of processes the operating system can handle or a maximum number of buffers for sending messages. Memory space…
• The designer must find ways to implement potentially infinite SDL system using finite resources.– Restrict the use of SDL so that all values are certain to be
bounded.
– Deal with resource limitations in the implementation.
Winter 2007 SEG2101 Chapter 11 16
Conceptual Differences - Concurrency
• SDL: independent and asynchronous• Real: truly in parallel, the operations of parallel
objects are synchronous or asynchronous• A “natural” implementation is to map each SDL
process to a separate physical object, which is not always cost-effective.
• An alternative is to implement many process in software sharing the same computer hardware.– Quasi-parallel– Scheduling and multiplexing
Winter 2007 SEG2101 Chapter 11 17
Conceptual Differences - Communication
• There are two different categories of information: events and states
• There are two ways to communicate: signal units and continuous signals
• There are two kinds of communication media: unit-oriented and continuous
• SDL signal: signal units implemented by unit-oriented medium such as message queue
• Real signal: sometimes, continuous signals
Winter 2007 SEG2101 Chapter 11 18
Conceptual Differences - Synchronization
• The act of aligning the operations of different concurrent processes in relation to each other
• In SDL synchronization is achieved by means of the signal queues of processes
• SDL: time-independent, using an asynchronous medium with infinite buffer capacity, the sender can send infinitely many signals ahead of the receiver, the synchronization of SDL rests on a basic synchronization mechanism – mutual exclusion
• Real: time-dependent, time-independent, queue will be finite
Winter 2007 SEG2101 Chapter 11 19
11.3: Design Considerations
• Trade-off between hardware and software
• Define hardware architecture
• Define software architecture
• Restructure and refine the functional design
Winter 2007 SEG2101 Chapter 11 20
Trade-off between Hardware and Software
• Physical distribution and physical interfaces• Time constraints versus process capacity• Error handling• Security against unauthorized access to
information• Operation and maintenance of the hardware• Cost to develop, produce, modify and maintain• (Re)use of existing components
Winter 2007 SEG2101 Chapter 11 21
Example
Winter 2007 SEG2101 Chapter 11 22
Physical Distribution and Physical Interface
• Distribute processes in a way that minimizes the bandwidth needed over physical channels.
Winter 2007 SEG2101 Chapter 11 23
Time Constraints versus Processing Capacity
• For each SDL process P, estimate a mean transition time tp=ip*op*S
• Calculate the mean number of transition np, that each SDL process will perform per second at peak load.
• Calculate the normalized mean peak load for each process: lp=np*tp
• Calculate corresponding load for each channel C and signal route R: lC=nC*tC lR=nR*tR
• Calculate the mean peak load of the system by adding together the channel, signal route, and process load. If the sum is higher than one, the mean load is higher than the processing capacity of a single computer. As a rule of thumb, the mean peak load on a single computer should not exceed 0.3 (typically 0.2-0.3).
Winter 2007 SEG2101 Chapter 11 24
Error Handling
• Fault tolerance means redundancy. At least two hardware units and facilities for error detection, diagnostics and switch-over are needed to implement fault tolerance.
• Fault sectioning means distributing the functions over separate hardware units in a way that limits the number of SDL processes that may be blocked by a single hardware error.
• Fail-safeness means that the system must always fail to a safe state where it does no harm to its environment. Some sort of supervisory hardware will normally be needed.
• RAID, watch-dog, voting
Winter 2007 SEG2101 Chapter 11 25
11.4
Software Design for RT Systems
Winter 2007 SEG2101 Chapter 11 26
Three Interrelated Problems
• Input-output: how to handle the communication with the environment across the hardware-software interface.
• Application: how to implement the functionality of SDL system within the software system of each computer.
• Concurrency: how to handle the concurrence required by the input-output and application. In short, how to handle time, priorities, scheduling, and synchronization.
Winter 2007 SEG2101 Chapter 11 27
Context of Software Design
Winter 2007 SEG2101 Chapter 11 28
Principles for Priority Assignments
• External priority: give time-critical external events priority over internal processing
• Internal processing priority: give the processing of internal signals priority over the processing of external signals
• Load control: when overload occurs, give priority to service requests already in progress and delay fresh requests
Winter 2007 SEG2101 Chapter 11 29
Implementation of Process Communication
• Waiting for events– Active waiting– Semi-active waiting– Passive waiting
• Message passing
• Buffered communication
Winter 2007 SEG2101 Chapter 11 30
Active Waiting
DO FOREVER
BEGIN
newstate := input(channel);
IF newstate NEQ laststate
THEN process_event;
laststate := newstate;
END;
Winter 2007 SEG2101 Chapter 11 31
Semi-Active Waiting
DO FOREVERBEGIN newstate := input(channel); IF newstate NEQ laststate THEN process_event; laststate := newstate; DO “something_else”; /* wait(suspend,time) */
END;
Winter 2007 SEG2101 Chapter 11 32
Passive Waiting
DO FOREVER
BEGIN
waitint(channelevent,max_time);
process_event;
END;
Winter 2007 SEG2101 Chapter 11 33
Message Passing – Procedure Call
• Procedure calls provide the most straightforward way of
communication among software modules.
Winter 2007 SEG2101 Chapter 11 34
Buffered Communication
Winter 2007 SEG2101 Chapter 11 35
Shared Variable
Winter 2007 SEG2101 Chapter 11 36
Implementation of SDL Process Behavior
• State-oriented
Winter 2007 SEG2101 Chapter 11 37
• Action-oriented
Implementation of SDL Process Behavior
Winter 2007 SEG2101 Chapter 11 38
• Table-driven
Implementation of SDL Process Behavior