Download Providing Real-Time Services for COTS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Distributed operating system wikipedia , lookup

Green Dam Youth Escort wikipedia , lookup

Transcript
Chapter 15
Specification of Software Components
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 1
Overview
 Introduction
 Windows NT as a real-time OS
 Real-time features of windows NT
 Observations and recommendations
 Windows NT in a real-time setting
 Summary
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 2
Introduction
 Windows NT is presented from the perspective of realtime constraints.
 Address the following questions:

What type of applications can use Windows NT, as is?

Can the unpredictable parts of NT be “masked”?
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 3
Windows NT as a Real-Time OS
 The original design of NT was based on a micro-kernel,
common to many real-time operating systems.
 During the evolution a limited number of real-time
features have been incorporated:

IDLE, NORMAL, HIGH and REALTIME.

The REALTIME priority class is available as a support
for real-time applications.

The base priority for the REALTIME class includes
levels 16 to 31. Levels 17 to 21 and 27 to 30 are
currently not used by the scheduler.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 4
Windows NT Priority Structure
Interrupts
Deferred Procedure Calls (DPC)
31
26
25
24
23
22
Decreasing Priority
16
15
Time Critical
Normal Foreground
Normal Background
Below Normal
0
Idle
Idle Thread
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Real-Time Priority Class Dynamic-Time Priority
Classes
Time Critical
NA
Highest
Above Normal
Normal
Below Normal
Lowest
NA
Idle
Page 5
Scheduling
 Priority based preemptive scheduling:

The highest priority active task is chosen for execution
possibly interrupting the execution of another task.
 Base priority
 REALTIME: non-degradable priorities
 NORMAL/HIGH can be delayed

For this reason the latter priority classes are commonly
referred to as dynamic classes.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 6
Deferred Procedure Call
 Interrupt service routine (ISR)
 Deferred procedure call (DPC)

DPCs are queued in the system DPC queue, in a first in
first out (FIFO) manner.
 Separation of ISR and DPC

Allows quick response to any further interrupts,

The priority structure at the interrupt level is not
maintained in the DPC queues.
 A DPC is not preemptable by another DPC,
 A DPC be preempted by an (unimportant) interrupt.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 7
Real-Time Features of Windows NT
 Empirical Characterization of NT’s Features which affect
Real-Time Activities

The first set of experiments was targeted toward the
behavior of threads at REALTIME priority class and their
effect on the I/O Subsystem, and visa versa.

To this end, we used two threads with the same thread
priority in the REALTIME class, one performing I/O and
another, a CPU-intensive thread, performing a
continuous “for loop”.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 8
Experiment 1
 To study the effect on keyboard and mouse I/O, the I/O
thread was made to read from the keyboard/mouse.

When the CPU-intensive thread was running, no I/O
activity was observed.

After the CPU-intensive thread completed, all the
keyboard inputs were processed.

This showed that the CPU-intensive real-time thread
essentially shuts out keyboard/mouse I/O even when
this I/O is from/to a real-time thread.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 9
Experiment 2
 To study the effect on disk I/O, the I/O thread was made
to write a file with 40,000 64-bit values.

The time-stamps for the I/O and CPU-intensive activities
were found to be interleaved, this indicating time-sharing
between the two threads.

This showed that a CPU-intensive real-time thread did
not shut out disk I/O.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 10
Experiment 3
 To study the effect on network I/O, the I/O thread was
made to read data from a remote server using Windows
Sockets API.

The time-stamps for the two activities were found to be
interleaved, this indicating time-sharing between the two
threads.

This showed that a CPU-intensive real-time thread has
no adverse impact on network I/O.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 11
Explaining the Observations
 The I/O manager sends the request in the form of an I/O
request packet (IRP) to the device driver. The driver
starts the I/O operation.
 The device completes the I/O operation and interrupts.
The device driver then services the interrupt. (This
involves execution of ISR and queuing of a DPC.)
 The I/O manager completes the I/O request.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 12
Time Taken for System Operations
Win32API Function Name
CreateProcess()
Time
(msecs)
2600
SetPriorityClass() - from normal to real-time priority
class
240
SetPriorityClass() - for all others combinations
125
SetThreadPriority() - for a thread to set its own priority
9
SetThreadPriority() - for a thread to set priority of
another thread of the same process
10
QueryPerformanceCounter() - to obtain the current
time-stamp
6
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 13
Observations and Recommendations
 Potential blocking time
 If processes or threads are performing network or disk
I/O, the effect of system-wide FIFO DPC queues may
lead to unbounded response times.
 If the duration of I/O activity in a given period can be
characterized, it may be possible to compute the
response times conservatively.
 One should not depend on the Windows NT scheduler
to achieve correct “fair sharing” behavior in cases
where screen, keyboard and mouse interactions are at
the same level of priority as the other real-time CPUintensive tasks.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 14
Windows NT in a Real-Time Setting
 Operator input
 Incoming sensor data
 Incoming video streams
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 15
Design of the Real-Time Application
 Efficiency through threads
 Achieving periodicity
Heart beat is a highest prio process
 Periodically enables user-level threads
 User-level threads can execute for 1 time unit only
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 16
Software Architecture of Industrial Control Prototype
Receiver
Buffer
Consumer
Producer
Heartbeat Ti
Heartbeat Ti
Operator input
Acknowledgement
Operator ack
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Real
Video
Page 17
Software Architecture of Industrial Control Prototype
 Besides the Heartbeat timer at each node, the main
entities at the remote server are:

Producer

Acknowledgment
 The main entities at the operator workstation are:

Receiver

Consumer

Operator input

Operator ack
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 18
Summary
 Using HIGH or REAL_TIME priority alone significantly
reduces the variability in response times, without any
observable degradation in system performance, so:

IF the application tasks do not monopolize the CPU for
long durations,

AND there is sufficient CPU capacity,

THEN using these priority assignments may be sufficient
to meet the performance requirements of these
processes – even when I/O is involved.
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 19
Summary Continued
 However:

IF the periodic workload per process is high,

IF a process is a COTS application whose workload
varies,

THEN it will be necessary to impose some additional
controls on the amount of time allocated to a task.
or
Our findings indicate that a scheduling approach
combined with an admission
Building Reliable Component-based Systems
Chapter 15 - Specification of Software Components
Page 20