Вы находитесь на странице: 1из 4

1. What is real-time system and what are its characteristics.

A real-time system is any information processing system which has to respond to externally generated input stimuli within a finite and specified period.

Characteristics are: - Guaranteed response times we need to be able to predict with confidence the worst case response times for systems; efficiency is important but predictability is essential. - Concurrent control of separate system components devices operate in parallel in the real-world; better to model this parallelism by concurrent entities in the program. - Facilities to interact with special purpose hardware need to be able to program devices in a reliable and abstract way. - Support for numerical computation be able to support the discrete/continuous computation necessary for control system feed-back and feed-forward algorithms - Large and complex vary from a few hundred lines of assembler or C to 20 million lines of Ada, also variety as well as size is an issue - Extreme reliability and safety embedded systems typically control the environment in which they operate; failure to control can result in loss of life, damage to environment or economic loss 2. Discuss briefly about those terms and give four examples for each a. Hard real-time: systems where it is absolutely imperative that responses occur within the required deadline. Examples of hard real-time systems include components of pacemakers, anti-lock brakes and aircraft control systems. b. Soft real-time: systems where deadlines are important but which will still function correctly if deadlines are occasionally missed. Example: Data Collection 3. Discuss in detail about Reliability, Failure, Dependability and Nversion programming Reliability: a measure of the success with which a system conforms to some authoritative specification of its behavior. So, the system consistently performs its intended or required mission or function, on demand and without degradation or failure. Failure: Occurs when a system does not meet its requirement. Failures result from unexpected problems internal to the system that eventually manifest themselves in the system's external behaviour Dependability: is a measure of system availability, reliability, and its maintenance support. This may also encompass mechanisms designated to increase and maintain the dependability of a system. Dependability for a system incorporates the following attributes or unfunctional requirements: Availability: readiness for correct service Reliability: Continuity of Service delivery

Safety: Non-occurrence of catastrophic consequences

Confidentiality: non-occurrence of unauthorized disclosure of information when addressing security. Security includes: confidentiality, integrity, and availability. repairs. Integrity: absence of improper system alteration Maintainability: ability for a process to undergo modifications and

N-version programming : Design diversity: The independent generation of N (N > 2) functionally equivalent programs from the same initial specification. No interactions between groups. The programs execute concurrently with the same inputs and their results are compared by a driver process. The results (VOTES) should be identical, if different the consensus result, assuming there is one, is taken to be correct. N-version programming depends on: Initial specification: the majority of software faults stem from inadequate specification. This will manifest itself in all N versions of the implementation Independence of effort: Experiments produce conflicting results

Complex parts of a specification lead to a lack of understanding of the requirements. If these also refer to rarely occurring input data, common design errors may not be caught during system testing Adequate budget: the predominant cost is software.

A 3-version system will triple the budget requirement and cause problems of maintenance. Would a more reliable system be produced if the resources potentially available for constructing N-versions were instead used to produce a single version? 4. How can exception are handled in RTS using JAVA. Explain by a concrete example. The following example declares a new subclass of Exception and then uses that subclass to signal an error condition in a method. It overrides the toString( ) method, allowing the description of the exception to be displayed using println( ). class MyException extends Exception { private int detail; MyException(int a) { detail = a; } @Override public String toString() { return "MyException[" + detail + "]"; } }

class ExceptionDemo extends Exception { static void compute(int a) throws MyException { System.out.println ("Called compute (" + a + ")"); if(a > 10) { throw new MyException(a); } System.out.println ("Normal exit"); } public static void main(String args[]) { try { compute (1); compute (20); } catch (MyException e) { System.out.println ("Caught + e); } } } This example defines a subclass of Exception called MyException. This subclass is quite simple: it has only a constructor plus an overloaded toString( ) method that displays the value of the exception. The ExceptionDemo class defines a method named compute( ) that throws a MyException object. The exception is thrown when compute( )s integer parameter is greater than 10. The main( ) method sets up an exception handler for MyException, then calls compute( ) with a legal value (less than 10) and an illegal one to show both paths through the code. 5. Discuss about concurrent programming in real time system. A real-time system usually needs to respond to several independent events within very short and strict time bounds. Objects provide a way to divide a program into independent sections. Often, you also need to turn a program into separate, independently running subtasks. Java supports concurrency at language level rather than through run time libraries (like POSIX threads for C/C++). It employs a preemptive model If time-slicing is available (implementation dependent), Java ensures equal priority threads execute in round-robin fashion otherwise they runs to completion Priority is handled differently according to the specific implementation. The simplest way to create a thread is to inherit from java.lang.Thread, which has all the wiring necessary to create and run threads. The most important method for Thread is run().You can use the alternative approach of implementing the Runnable interface. Runnable specifies only that there be a run() method implemented, and Thread also implements Runnable 6. Using Java, write and implement a Robot arm to apply features of concurrent programming in real time system. public class Arm { public static void move(int dim, int pos){

} public class Control extends Thread{ private int dim; UserInterface UI = new UserInterface(); public Control(int Dimension) { super(); dim = Dimension; } @Override public void run(){ int position = 0; int setting; while(true){ Arm.move(dim, position); setting = UI.newSetting(dim); position = position + setting; } } } public class ThreadRobot { public static void main(String[] args){ final int xPlane = 0; // final indicates a constant final int yPlane = 1; final int zPlane = 2; Control C1 = new Control(xPlane); Control C2 = new Control(yPlane); Control C3 = new Control(zPlane); C1.start(); C2.start(); C3.start(); } } public class UserInterface { public int newSetting(int dim){ return dim; } }

Вам также может понравиться