1 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-time Software Design IS301.

Slides:



Advertisements
Similar presentations
Symantec 2010 Windows 7 Migration Global Results.
Advertisements

1 A B C
Process Description and Control
AP STUDY SESSION 2.
1
Distributed Systems Architectures
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 13Slide 1 Chapter 13 Real-time Software Design.
1 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Software Testing IS301 – Software.
IS301 – Software Engineering Dept of Computer Information Systems
IS301 – Software Engineering V:
1 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Application Architectures IS301.
Distributed Systems Architectures
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 4 Computing Platforms.
Sequential Logic Design
Processes and Operating Systems
Copyright © 2013 Elsevier Inc. All rights reserved.
David Burdett May 11, 2004 Package Binding for WS CDL.
Create an Application Title 1Y - Youth Chapter 5.
CALENDAR.
The 5S numbers game..
Real-time Software Design
Real-time software Sommerville, Hfst. 13. Sommerville, Ch. 132 Real-time systems A real-time system is a software system where the correct functioning.
Chapter 20- Embedded Systems
Break Time Remaining 10:00.
I/O Management and Disk Scheduling
Turing Machines.
PP Test Review Sections 6-1 to 6-6
Operating Systems Operating Systems - Winter 2012 Chapter 2 - Processes Vrije Universiteit Amsterdam.
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Adding Up In Chunks.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Chapter 2 Real-time software design
Artificial Intelligence
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Types of selection structures
1 Titre de la diapositive SDMO Industries – Training Département MICS KERYS 09- MICS KERYS – WEBSITE.
Converting a Fraction to %
Clock will move after 1 minute
Chapter 20- Embedded Systems Lecture 1. Topics covered  Embedded systems design  Architectural patterns  Timing analysis  Real-time operating systems.
Physics for Scientists & Engineers, 3rd Edition
Select a time to count down from the clock above
Copyright Tim Morris/St Stephen's School
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 2.
Real-time Software Design
EMBEDDED SOFTWARE Team victorious Team Victorious.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
1 Embedded Systems Development. 2 Topics covered  Embedded systems design  Architectural patterns  Timing analysis  Real-time operating systems.
Real-Time Software Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
 Dr. Syed Noman Hasany 1.  Review of known methodologies  Analysis of software requirements  Real-time software  Software cost, quality, testing.
1 소프트웨어공학 강좌 Chap 11. Real-time software Design - Designing embedded software systems whose behaviour is subject to time constraints -
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Slide 1 Chapter 11 Real –time Software Designs. Slide 2 Real-time systems l Systems which monitor and control their environment l Inevitably associated.
©Ian Sommerville, Robin Abraham 2004CS 361, Summer 2004 Slide 1 Real-time Software Design.
Real-time Software Design King Saud University College of Computer and Information Sciences Department of Computer Science Dr. S. HAMMAMI.
Real-time Software Design Chapter 15 of Ian Sommerville’s Book on Software Engineering.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Software Design.
Real-time System Definition A real-time system is a software system where the correct functioning of the system depends on the results produced by the.
Embedded software / Real-time Software Engineering 1.
Real-time Software Design. Objectives l To explain the concept of a real-time system and why these systems are usually implemented as concurrent processes.
Real-time Software Design
Real-time Software Design
Real-time Software Design
Real-time Software Design
Real-time Software Design
Real-time Software Design
Presentation transcript:

1 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-time Software Design IS301 – Software Engineering Lecture # 19 – M. E. Kabay, PhD, CISSP Assoc. Prof. Information Assurance Division of Business & Management, Norwich University V:

2 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Objectives To explain the concept of a real-time system and why these systems are usually implemented as concurrent processes To describe a design process for real-time systems To explain the role of a real-time operating system To introduce generic process architectures for monitoring and control and data acquisition systems

3 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

4 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-Time Systems Systems which monitor and control their environment Inevitably associated with hardware devices Sensors: Collect data from system environment Actuators: Change (in some way) system's environment Time critical. Real-time systems MUST respond within specified times

5 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Definition Real-time system: Correct functioning of system depends on results produced by system and time at which these results produced Soft real-time system: Operation degraded if results not produced according to specified timing requirements Hard real-time system Operation incorrect if results not produced according to timing specification

6 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Stimulus/Response Systems Given stimulus, system must produce response within specified time Periodic stimuli Occur at predictable time intervals E.g., T° sensor polled 10 times/second Aperiodic stimuli Occur unpredictably E.g., system power failure

7 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Architectural Considerations Allow fast switching between stimulus handlers Different stimuli have different timing demands E.g., weather station – T° vs light intensity Thus simple sequential loop not usually adequate Real-time systems Usually designed as cooperating processes With real-time executive controlling these processes

8 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-Time System Model

9 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. System Elements Sensors control processes Collect information from sensors. May buffer data Data processor Carries out processing of collected information Computes system response Actuator control Generates control signals for actuator

10 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Sensor/Actuator Processes

11 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. System Elements Sensor control processes Collect information from sensors. May buffer information collected in response to a sensor stimulus. Data processor Carries out processing of collected information and computes the system response. Actuator control processes Generates control signals for the actuators.

12 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

13 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. System Design Design both hardware and software associated with system Partition functions to either hardware or software Design decisions should be made on basis on non-functional system requirements Hardware delivers better performance But potentially longer development Less scope for change

14 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Hardware and Software Design

15 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. R-T Systems Design Process (1) Identify stimuli to be processed Required responses to these stimuli For each stimulus and response, Identify timing constraints Aggregate stimulus and response processing into concurrent processes Process may be associated with each class of stimulus and response

16 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. R-T systems Design Process (2) Design algorithms to process each class of stimulus and response. Meet given timing requirements Design scheduling system Ensure processes started in time to meet deadlines (during execution) Integrate using real-time executive or operating system

17 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Timing Constraints Difficult to predict Extensive simulation and experiment to ensure that these met by system May mean that certain design strategies such as object-oriented design cannot be used Too much overhead involved May mean that low-level programming language features have to be used For performance reasons

18 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. State Machine Modeling Effect of stimulus in real-time system may trigger transition from one state to another. Finite state machines (FSM) can be used for modeling real-time systems However, FSM models lack structure. Even simple systems can have complex model. UML includes notations for defining state machine models See also Chapter 7

19 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. State Machine Modeling Effect of stimulus in real-time system may trigger transition from one state to another. Finite state machines can be used for modeling real-time systems. However, FSM models lack structure. Even simple systems can have complex model. UML includes notations for defining state machine models See also Chapter 7.

20 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Microwave Oven State Machine (As Shown Before)

21 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Petrol pump State Model

22 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-Time Programming Hard real-time systems Often in assembly language to ensure that timing requirements met High-level languages such as C Allow efficient programs to be written But do not have constructs to support concurrency or shared resource management Ada Designed to support real-time systems design Includes general purpose concurrency mechanism

23 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Java as Real-Time Language Java Supports lightweight concurrency threads and synchronized methods Can be used for some soft real-time systems

24 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Java (2) Java 2.0 not suitable for hard RT programming or programming where precise control of timing required Not possible to specify thread execution time Uncontrollable garbage collection Not possible to discover queue sizes for shared resources Variable virtual machine implementation Not possible to do space or timing analysis

25 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

26 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-Time Executives Real-time executives Specialized operating systems Manage processes in RTS Standard RTE kernel Used as-is; or Can be modified for particular application Limited No file management facilities 14

27 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Executive Components Real-time clock Info for process scheduling Interrupt handler Manages aperiodic requests for service. Scheduler Chooses next process to be run Resource manager Allocates memory and processor resources Dispatcher Starts process execution

28 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Non-Stop System Components Configuration manager Dynamic reconfiguration of system SW, HW without stopping systems Replace HW modules Upgrade SW Fault manager Detect SW & HW faults Take appropriate actions E.g. switch to backup disks Ensure that system continues operation

29 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-Time Executive Components

30 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Process Priority Processing some types of stimuli must sometimes take priority Interrupt level priority Highest priority allocated to processes requiring very fast response Clock level priority Allocated to periodic processes Further levels of priority may be assigned within these levels

31 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Interrupt Servicing Control transferred automatically to pre-determined memory location Contains instruction to jump to interrupt service routine Further interrupts disabled, Interrupt serviced Control returned to interrupted process Interrupt service routines MUST be short, simple and fast

32 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Periodic Process Servicing Several classes of periodic process Different periods (time between executions) Different execution times Different deadlines (time by which processing must be completed) Real-time clock ticks periodically Each tick causes interrupt which schedules process manager for periodic processes Process manager selects process among those ready for execution

33 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. RTE Process Management

34 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Process Switching Scheduler Chooses next process to be executed by processor Depends on scheduling strategy May take process priority into account Resource manager Allocates memory and processor Dispatcher Takes process from ready list, Loads it onto processor Starts execution

35 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Scheduling Strategies Non pre-emptive scheduling Process runs to completion Or until blocked (e.g. pending I/O) Pre-emptive scheduling Execution of executing processes may be stopped If higher-priority process requires service Scheduling algorithms Round-robin Rate monotonic Shortest deadline first

36 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

37 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Monitoring and Control Systems Important class of real-time systems Continuously check sensors and take actions depending on sensor values Monitoring systems examine sensors and report their results Control systems take sensor values and control hardware actuators

38 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Generic architecture

39 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Burglar Alarm System Monitor sensors on doors and windows Detect presence of intruders in building When sensor indicates break-in Switches on lights around area Calls police automatically Provision for operation even when external power fails / cut

40 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Burglar Alarm System Sensors Movement detectors, window sensors, door sensors. 50 window sensors, 30 door sensors and 200 movement detectors Voltage-drop sensor Actions When intruder detected, police called automatically Lights switched on in rooms with active sensors Audible alarm switched on System switches automatically to backup power when voltage drop detected

41 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. R-T System Design Process Identify stimuli and associated responses Define timing constraints associated with each stimulus and response Allocate system functions to concurrent processes Design algorithms for stimulus processing and response generation Design scheduling system which ensures that processes will always be scheduled to meet their deadlines

42 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Stimuli To Be Processed Power failure Generated aperiodically by circuit monitor Switch to backup power within 50 ms Intruder alarm Stimulus generated by system sensors Response Call police Switch on building lights Audible alarm

43 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Timing Requirements

44 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Process Architecture 50 2/sec

45 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Control Systems Burglar alarm system Primarily monitoring Collects data from sensors No real-time actuator control Control systems System sends control signals to actuators E.g., temperature-control system Monitors T° Switches heaters on and off

46 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Temperature Control System

47 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

48 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Data Acquisition Systems Collect data from sensors for subsequent processing and analysis. Data collection processes and processing processes may have different periods and deadlines Data collection may be faster than processing E.g. collecting information about explosion Circular or ring buffers Mechanism for smoothing speed differences File where new data added at bottom displace old data at top

49 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Data acquisition architecture

50 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Reactor Data Collection System collects data Sensors monitoring neutron flux From nuclear reactor Flux data placed in ring buffer For later processing Ring buffer Implemented as concurrent process Collection and processing processes may be synchronized Size of buffer must be set to account for discrepancy of filling (sensors) and emptying (processing) speeds

51 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Reactor Flux Monitoring

52 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Ring Buffer

53 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Mutual Exclusion (Locking) Producer processes collect data and add it to buffer Consumer processes take data from buffer and make elements available Producer and consumer processes must be mutually excluded from accessing same element Buffer must stop producer processes adding information to full buffer and consumer processes trying to take information from empty buffer

54 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Key points Real-time system correctness depends not just on what the system does but also on how fast it reacts. A general RT system model involves associating processes with sensors and actuators. Real-time systems architectures are usually designed as a number of concurrent processes.

55 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Key points Real-time operating systems are responsible for process and resource management. Monitoring and control systems poll sensors and send control signal to actuators. Data acquisition systems are usually organized according to a producer consumer model.

56 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Homework Required By Wed 20 Oct 2004 For 35 points, Optional By Wed 27 Oct 2004 For a maximum of 15 points, answer either or both of

57 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. DISCUSSION

58 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.

59 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.

60 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.

61 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.

62 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.

63 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.

64 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved.