10
CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Embed Size (px)

Citation preview

Page 1: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

CHAPTER 2REAL-TIME SOFTWARE DESIGN

Lab 02 (Software Engineering 8th Ed. Chapter 15)

Page 2: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

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

Page 3: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Real-time systems

Systems which monitor and control their environment Real-time system Software system where the correct functioning of the system depends on the

results produced by the system and the time at which these results are produced Soft real-time system Operation is degraded if results are not produced according to the specified

timing requirements Hard real-time system Operation is incorrect if results are not produced according to the timing

specification Inevitably associated with hardware devices

Sensors Collect data from the system environment

Actuators Change (in some way) the system’s environment

Time is critical Real-time systems MUST respond within specified times.

Page 4: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Question 1

Explain why an object-oriented approach to software development may not be suitable for real-time systems.

Page 5: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Design process of real-time systems Process

Identify the stimuli to be processed and the required responses to these stimuli

For each stimulus and response, identify the timing constraints Aggregate the stimulus and response processing into

concurrent processes A process may be associated with each class of stimulus and

response Design algorithms to process each class of stimulus and

response These must meet the given timing requirements

Design a scheduling system which will ensure that processes are started in time to meet their deadlines

Integrate using a real-time operating system

Page 6: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Real-time operating systems (real-time executives)

Real-time clock. Provides information for process scheduling.

Interrupt handler. Manages aperiodic requests for service.

Scheduler. Chooses the next process to be run.

Resource manager. Allocates memory and processor resources.

Despatcher. Starts process execution.

Process resourcerequirements

Scheduler

Schedulinginformation

Resourcemanager

Despatcher

Real-timeclock

Processesawaiting

resources

Readylist

Interrupthandler

Availableresource

list

Processorlist

Executing process

Readyprocesses

Releasedresources

Figure 15.4 Components of a real-time operating system

Page 7: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Monitoring and control and data acquisition systems

Monitoring systems examine sensors and report their results

Control systems take sensor values and control hardware actuators

Acquisition systems collect data from sensors for subsequent processing and analysis

Page 8: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Question 2

Draw a state machine model of the control software of a compact disk player. States include: Idle Ready Door close Door open Ready to play Disk playing Track selecting

Page 9: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Question 3

A train protection system automatically applies the brakes of a train if the speed limit for a segment of track is exceeded or if the train enters a track segment that is currently signalled with a red light (i.e., the segment should not be entered). Details are shown in Figure 15.15. Identify the stimuli that must be processed by the on-board train control system and the associated responses to these stimuli.

If a periodic process in the on-board train protection system is used to collect data from the trackside transmitter, how often must it be scheduled to ensure that the system is guaranteed to collect information from the transmitter? Explain how you arrived at your answer.

Page 10: CHAPTER 2 REAL-TIME SOFTWARE DESIGN Lab 02 (Software Engineering 8 th Ed. Chapter 15)

Question 3 (cont’d)

The system acquires information on the speed limit of a segment from a trackside transmitter, which continually broadcasts the segment identifier and its speed limit. The same transmitter also broadcasts information on the status of the signal controlling that track segment. The time required to broadcast track segment and status information is 50ms.

The train can receive information from the trackside transmitter when it is within 10m of a transmitter.

The maximum train speed is 180kph. Sensors on the train provide information about the current train speed (updated every

250ms) and the train brake status (updated every 100ms). If the train speed exceeds the current segment limit by more than 5kph, a warning is

sounded in the driver’s cabin. If the train speed exceeds the current segment speed limit by more than 10kph, the train’s brakes are automatically applied until the speed falls to the segment speed limit. Train brakes should be applied within 100ms of the time when the excessive train speed has been detected.

If the train enters a train segment that is signalled with a red light, the train protection system applies the train brakes and reduces speed to zero. Train brakes should be applied within 100ms of the time when the red light a signal is received.

The system continually updated a status display in the deriver’s cabin.Figure 15.4 Components of a real-time

operating system