Real time software design

 

              A real time system is a software system where correct functioning of system depends on the results produced by the system and the time at which these results are produced.

              A soft real time system is a system whose operation is degraded if results are not produced according to specific timing requirements.

               A hard real time system is a system whose operation is incorrect if results are not produced according to timing specification.

               The behavior of real time system are defined by listing stimuli that are received by system and associate responses and the time at which response must be produced.

                Stimuli fall into two categories:

1-     Periodic stimuli: these occur at predictable time intervals. For e.g. system may examine a sensor every 50 millisecond & take action depending upon sensor value.

2-     Aperiodic stimuli: these occur irregularly. They are usually signaled using computer interrupts mechanism. An example of such stimulus would be an interrupt indicating that i/o transfer was complete and the data was available in buffer.

 

            Periodic stimuli in a real system are usually generated by sensors associated with system. They provide information about the state of the systems environment. The responses are directed to set of actuators that control some h/w unit that influence the system environment.

 

            Aperiodic stimuli may generate either by actuators or by sensors. They often indicate some exceptional condition either by actuators or by sensors.

 

 

 

 

 


     

 

 

 

 

 

 

 

 

 

 

        

                                            General model of Real time system

 

System design: System design process involves deciding which system capabilities are to be implemented in s/w and which in h/w. 

                          Timing constraint or other requirement may mean same system function such as signal processing have to be implemented using special design h/w. The design process for real time system differ from other time processes because system response time must early in the process. Events (stimuli) rather than objects or functions should be central to design process.

     There are several stages in the design process.

1-     Identify the stimuli that system must process and associate responses.

2-     For each stimulus and associated response, identify the timing constraints which apply to both stimulus and response processing.

3-     Aggregate the stimulus and response processing into number of concurrent processes. A good general model for system architecture is to associate process with each class of stimulus and response.

4-      For each stimulus and response, design algorithm to carry out the required computation. Algorithm design offers often have to be developed relatively early in design process to give an indication of the amount of processing required and timing required for complete that processing.

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

6-     Integrate the system under control of real time executives.

 

Real time programming

 

             Programming language used for implement a real time system also influence the design. In designing of real time system, assembly language used. We can use C language for efficiency.

             

             The initial version of Java called oak designed for writing small scale embedded system such as those in domestic appliance controller.

 

             Java designer includes some support for current processes in form of concurrent objects (threads) and synchronized methods. However as these systems do not have time constraints. Java does not include facilities to control the scheduling of threads or to specify that threads should run at particular times.

 

             The fundamental problem with java as a real time programming language is:

1-     It is not possible to specify the time at which threads should executes.

2-     Garbage collection is uncontrollable. It may be started at any time. Therefore the timing behavior of thread is unpredictable.

3-     It is not possible to discover the size of queue associated with shared resources.

4-     The implementation of java virtual machine varies from one computer to another, so some program can have different timing behavior.

5-     The language does not allow for detailed runtime space or processor analysis.

 

 

Real time executives

 

           A real time executive is analogous to an o.s. in general purpose computer. It manages processes and response allocation in a real time system. The component of an executives depend on size and complexity of real time system are

 

1-     Real time clock: These provide information to schedule processes periodically.

2-      An Interrupt handler: this manages aperiodic request for services.

3-     A scheduler: this component is responsible for examining the processes which can be executed and choosing one of execution.

4-     A resource manager: given a process which is scheduled for execution, the resource manager allocates appropriate memory and processor resources.

5-     A dispatcher: the component is responsible for starting the execution process.

 

               Executive’s for real system has to able to manage at least two priority levels.

1-     Interrupt level: this is highest priority level. It is allow to process which need a very fast response.

2-     Clock level: the level of priority is allocated to periodic processes.

 

Process management

 

Process management in a real time executive is concerned with managing the set of concurrent processes that are part of real time system. The process manager has to choose for execution, allocate memory and processor resources to that process and start its execution on a processor.

 

1-     Non pre-emptive scheduling: Once a process has been scheduled for execution, it runs to completion or until it is blocked for some reason such as waiting input. This causes problem when there are processes with different priorities and a high priority process has to wait for low priority process to finish.

2-     Preemptive scheduling: the execution of an executing process may be stopped if a higher priority process requires service. The higher priority process preempts the execution of low priority process and is allocated to processor.

 

Data acquisition system

 

Data acquisition system is usually organized according to a product consumer model. The producer process puts the data into circular buffer where it is consumed by consumer process. The buffer is as implemented as a process so that conflicts between the producer and consumer are eliminated.