380 likes | 390 Vues
Chapter 11. Implementation Design. Contents. What is implementation design? Difference between real systems and SDL systems Implementation descriptions Design considerations. 11.1: Implementation Design.
E N D
Chapter 11 Implementation Design SEG2101 Chapter 11
Contents • What is implementation design? • Difference between real systems and SDL systems • Implementation descriptions • Design considerations SEG2101 Chapter 11
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. SEG2101 Chapter 11
The Scope of Implementation Design SEG2101 Chapter 11
Example: Implementation alternatives SEG2101 Chapter 11
The Forward Aspect • Select among implementation alternatives being functionally equivalent to the SDL system. SEG2101 Chapter 11
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. SEG2101 Chapter 11
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. SEG2101 Chapter 11
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. SEG2101 Chapter 11
A Typical Realization SEG2101 Chapter 11
Fundamental Differences • Processing time • CPU power • Errors and noise • Physical distribution • Finite resources SEG2101 Chapter 11
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. SEG2101 Chapter 11
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? • … SEG2101 Chapter 11
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. SEG2101 Chapter 11
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. SEG2101 Chapter 11
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 SEG2101 Chapter 11
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 SEG2101 Chapter 11
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 SEG2101 Chapter 11
11.3: Design Considerations • Trade-off between hardware and software • Define hardware architecture • Define software architecture • Restructure and refine the functional design SEG2101 Chapter 11
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 SEG2101 Chapter 11
Example SEG2101 Chapter 11
Physical Distribution and Physical Interface • Distribute processes in a way that minimizes the bandwidth needed over physical channels. SEG2101 Chapter 11
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). SEG2101 Chapter 11
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 SEG2101 Chapter 11
11.4 Software Design for RT Systems SEG2101 Chapter 11
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. SEG2101 Chapter 11
Context of Software Design SEG2101 Chapter 11
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 SEG2101 Chapter 11
Implementation of Process Communication • Waiting for events • Active waiting • Semi-active waiting • Passive waiting • Message passing • Buffered communication SEG2101 Chapter 11
Active Waiting DO FOREVER BEGIN newstate := input(channel); IF newstate NEQ laststate THEN process_event; laststate := newstate; END; SEG2101 Chapter 11
Semi-Active Waiting DO FOREVER BEGIN newstate := input(channel); IF newstate NEQ laststate THEN process_event; laststate := newstate; DO “something_else”; /* wait(suspend,time) */ END; SEG2101 Chapter 11
Passive Waiting DO FOREVER BEGIN waitint(channelevent,max_time); process_event; END; SEG2101 Chapter 11
Message Passing – Procedure Call • Procedure calls provide the most straightforward way of communication among software modules. SEG2101 Chapter 11
Buffered Communication SEG2101 Chapter 11
Shared Variable SEG2101 Chapter 11
Implementation of SDL Process Behavior • State-oriented SEG2101 Chapter 11
Implementation of SDL Process Behavior • Action-oriented SEG2101 Chapter 11
Implementation of SDL Process Behavior • Table-driven SEG2101 Chapter 11