Introduction
Real-Time Systems
- the notion of a "system" is central to software engineering
- a system for engineers is an assembly of things interacting together according to a precise relationship for transforming a set of functions called inputs into a set of functions called outputs
- there is no system without interactions, and there is no system with outputs happening before the inputs are manifested
- every real world entity, whether organic or synthetic, can be modeled as a system the condition of transforming inputs in outputs
- in computing systems, the inputs represent digital data collected from hardware devices called sensors
- the application has modules which acquire and process the data produced by the input hardware, and deliver it to output devices called actuators
- the actuators deliver the output to the process
Example:
- The objective: building a controlled Robot
- requires the design of a computer application whose server, runs on a multi threaded CPU under an RTOS (Linux);
- collects data from the robot sensors and stores it (some apps use a database), and at the same time calculates the next step to be made (by the Robot).
- Sensors:
- two rotation speed sensors,
- a GPS sensor
- two collision sensors (one in the front and one at the back of the robot)
- a real-time streaming camera which sends images to the CPU of the robot
Block Diagrams and Basic Blocks
A block diagram, and the block itself is a conventional representation of a system, system components, and system elements.
Every real world entity can be modeled as a system.
Basic Functional Blocks of RTS
Input and Output Data: Devices
Example sensors
- Temperature
- RFID
- Barcode
- Proximity
- Vision
- Gyroscope
- Compass
- Tilt/Acceleration
Input and Output Devices
Input/Output (I/O) devices usually have some analog or non-electronic component.
Digital logic is used to interact with the CPU.
Devices have different registers to store information.
- Status register: read-only register holding information about current state of the I/O device
- Data register: Read/write register with most recent data passed between CPU and I/O device
Busy-Wait I/O
It may be necessary to interact with a device frequently to retrieve or send information.
Most basic ways to use devices is busy-wait I/O.
- continuously accessing the I/O device until certain conditions have been met
- continuously checking status register is polling
This is necessary when devices are slower than CPU. To avoid inefficient use of processor time, interrupts are used as an alternative.
Stimuli to Real-Time Systems
Periodic Stimuli
- inputs which occur at periodic time intervals
- ex. timed events and synchronous communication, a temp. sensor may be polled 10 times per second, consequence: the computer or the OS has to trigger time events in order to poll the transducers
Aperiodic Stimuli
- inputs which occur at unpredictable times
- ex. asynchronous communication, interrupts and exceptions. A system power failure may trigger an interrupt which must be processed by the system, consequence: the computer or the OS has to react to event and trigger tasks for processing these events.
Events
- atomic, non-incorruptible occurrence
- based on communication, time, change of attribute
Interrupts
- Signal (or event) used to get immediate attention of processor
- Handled by an interrupt service handler implemented for the specific event that occurred (and potentially others)
Exceptions
- occurrence of an error
- exceptions are raised when errors occur and handled by the system accordingly
- e.g. exception handlers (Java)
Architecture of RTS software
- consists of an operator (human or machine), computer system, and an external object (plant) being controlled
- instrumentation interface: mechanisms used by the system to control the plant
- man machine interface: mechanisms used by the user to interact with the system
Definition of Real-Time Systems
Many different definitions with similar descriptions
A computer (or processor) based information processing system with the following attributes
- Must respond to externally generated input within a finite and specified period of time
- Responses are computer generated signals or actions which commands the external device(s) connected to the computer
- The correctness of a response depends on the logical result and the time it was delivered a time constraint which not fulfilled leads to severe consequences, including failure.
- Failure for a real-time system to respond on time is as bad as not responding at all
Definition of Embedded Systems
- Special purpose computer system
- Completely encapsulated by the device it controls
- Specific requirements and performs pre-defined tasks (unlike general purpose PC)
- Programmed hardware device
- Combination of hardware and software
- Facilitates mass production and variety of applications
- Significant growth market
Domain of Real-Time and Embedded Systems
- discipline where computers are used to control external processes
- RTS automate processes using computer systems
- Processes controlled in timely manner
- Computers act as control devices instead of humans
- Controlling an external process is the feature which distinguished a general computer from a Real-Time or Embedded Processors
Control and Real-Time Systems
- Real-time systems are used to control external processes (also called a plant or controlled object)
- Closed-loop (feedback) operation is common with real-time systems
- The system has to keep a response (output) signal as close as possible to a desired value (input or prescribed value)
- the system output is brought back to the input, compared with the input and the result (the error signal or simple the error) is used to make a decision about the next appropriate action. This action is called the feedback operation
- The control system will often use the error signal to make a decision about how to manipulate the output
- the error signal is a measure of the difference between the system response as determined by a sensor or transducer (the feedback signal) and the desired response