Real-time Software Design

Slides:



Advertisements
Similar presentations
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 13Slide 1 Chapter 13 Real-time Software Design.
Advertisements

1 Note content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. Real-time Software Design IS301.
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
Chapter 2 Real-time software design
Chapter 20- Embedded Systems Lecture 1. Topics covered  Embedded systems design  Architectural patterns  Timing analysis  Real-time operating systems.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 2.
Real-time Software Design
1 / 32 CS 425/625 Software Engineering Real-Time Software Design Based on Chapter 15 of the textbook [SE-8] Ian Sommerville, Software Engineering, 8 th.
CprE 458/558: Real-Time Systems
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
EMBEDDED SOFTWARE Team victorious Team Victorious.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
1 Reference architectures u Reference models are derived from a study of the application domain rather than from existing systems u May be used as a basis.
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 -
Multiprocessor and Real-Time Scheduling Chapter 10.
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.
EKT 424 Real Time System 1.
1 / 30 CS 425/625 Software Engineering Real-Time Software Design Based on Chapter 13 of the textbook [SOMM00] Ian Sommerville, Software Engineering, 6.
©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.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
Chapter 21– Real-time Software Engineering 04/12/2014Chapter 21. Real-time Software Engineering1.
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 Real-Time Systems Processing interrupts Lecturer Department University.
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.
Tutorial 2: Homework 1 and Project 1
Real-time Software Design
Real-time Software Design
Real-time Software Design
REAL-TIME OPERATING SYSTEMS
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 19: Real-Time Systems
Processes and threads.
IS301 – Software Engineering V:
Chapter 2 Memory and process management
Advanced Operating Systems CIS 720
Lesson Objectives Aims Key Words
IS301 – Software Engineering V:
OPERATING SYSTEMS CS3502 Fall 2017
IS301 – Software Engineering V:
Chapter 2.2 : Process Scheduling
Real-time Software Design
Chapter 6: CPU Scheduling
Real-time Software Design
Real-time & distributed Software Design
Critical Systems Validation
Process & its States Lecture 5.
Operating Systems.
TDC 311 Process Scheduling.
CS 501: Software Engineering Fall 1999
Process Description and Control
BIC 10503: COMPUTER ARCHITECTURE
Process Description and Control
Multiprocessor and Real-Time Scheduling
Real-time & distributed Software Design
Chapter 19: Real-Time Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 10 Multiprocessor and Real-Time Scheduling
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Chapter 3: Process Management
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Real-time Software Design IS301 – Software Engineering Lecture # 19 – 2004-10-13 M. E. Kabay, PhD, CISSP Assoc. Prof. Information Assurance Division of Business & Management, Norwich University mailto:mkabay@norwich.edu V: 802.479.7937 M. E. Kabay, PhD, CISSP 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

Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

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 Copyright © 2004 M. E. Kabay. All rights reserved.

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 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 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

Real-Time System Model 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

Sensor/Actuator Processes 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.

Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

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

Hardware and Software Design

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

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

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

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

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.

Microwave Oven State Machine (As Shown Before) Copyright © 2004 M. E. Kabay. All rights reserved.

Petrol pump State Model 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 Copyright © 2004 M. E. Kabay. All rights reserved.

Java as Real-Time Language Supports lightweight concurrency threads and synchronized methods Can be used for some soft real-time systems

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

Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

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 Copyright © 2004 M. E. Kabay. All rights reserved.

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 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 Copyright © 2004 M. E. Kabay. All rights reserved.

Real-Time Executive Components Copyright © 2004 M. E. Kabay. All rights reserved.

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 Copyright © 2004 M. E. Kabay. All rights reserved.

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 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 Copyright © 2004 M. E. Kabay. All rights reserved.

RTE Process Management 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

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

Topics Introduction to R-T Systems Systems Design Real-Time Executives Monitoring and Control Systems Data Acquisition Systems

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 Copyright © 2004 M. E. Kabay. All rights reserved.

Copyright © 2004 M. E. Kabay. All rights reserved. Generic architecture 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

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 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 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 Copyright © 2004 M. E. Kabay. All rights reserved.

Timing Requirements

Copyright © 2004 M. E. Kabay. All rights reserved. 50 sensors @ 2/sec Process Architecture 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

Temperature Control System 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

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 Copyright © 2004 M. E. Kabay. All rights reserved.

Data acquisition architecture

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 Copyright © 2004 M. E. Kabay. All rights reserved.

Reactor Flux Monitoring Copyright © 2004 M. E. Kabay. All rights reserved.

Ring Buffer

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 Copyright © 2004 M. E. Kabay. All rights reserved.

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. 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.

Homework Required By Wed 20 Oct 2004 For 35 points, 15.1 (@5), 15.7 (@10), 15.8 (@20) Optional By Wed 27 Oct 2004 For a maximum of 15 points, answer either or both of 15.4 (@10) 15.10 (@5)

Copyright © 2004 M. E. Kabay. All rights reserved. DISCUSSION Copyright © 2004 M. E. Kabay. All rights reserved.