Q1. What is Real time system? Explain the basic model of Real time system. (8)

Size: px
Start display at page:

Download "Q1. What is Real time system? Explain the basic model of Real time system. (8)"

Transcription

1 B. TECH VIII SEM I MID TERM EXAMINATION BRANCH: CSE SUB. CODE: 8CS4.2A SUBJECT: REAL TIME SYSTEM TIME ALLOWED: 2 Hours MAX. MARKS: 40 Q1. What is Real time system? Explain the basic model of Real time system. (8) Ans. Real time system: Real-time systems have been defined as: "those systems in which the correctness of the system depends not only on the logical result of the computation, but also on the time at which the results are produced"; Real-time systems are used when there are rigid time requirements on the operation of a processor or the flow of data and real-time systems can be used as a control device in a dedicated application. A real-time operating system must have well-defined, fixed time constraints, otherwise the system will fail. Example, Scientific experiments, medical imaging systems, industrial control systems, weapon systems, robots, air traffic control systems, etc. Real-Time Characteristics Event-driven, reactive. High cost of failure. Concurrency/multiprogramming. Stand-alone/continuous operation. Reliability/fault-tolerance requirements. Predictable behavior. Radar System: The RADAR system generally consists of a transmitter which produces an electromagnetic signal which is radiated into space by an antenna. When this signal strikes any object, it gets reflected or reradiated in many directions. This reflected or echo signal is received by the radar antenna which delivers it to the receiver, where it is processed to determine the geographical statistics of the object..

2 Radar system The range is determined by the calculating the time taken by the signal to travel from the RADAR to the target and back. The target s location is measured in angle, from the direction of maximum amplitude echo signal, the antenna points to. To measure range and location of moving objects, Doppler Effect is used Q.1 Explain the difference between soft real time system and hard real time system? (8) Ans. Soft real time system: The soft real-time definition allows for frequently missed deadlines, and as long as tasks are timely executed their results continue to have value. Completed tasks may have increasing value up to the deadline and decreasing value past it. A Soft Real Time System where a critical real-time task gets priority over other tasks and retains that priority until it completes. As in hard real time systems kernel delays need to be bounded. video transmission, each picture frame and audio must be transferred at fixed rate. In soft real time system, the meeting of deadline is not compulsory for every time for every task but process should get processed and give the result. Even the soft real time systems cannot miss the deadline for every task or process according to the priority it should meet the deadline or can miss the deadline. If system is missing the deadline for every time the performance of the system will be worse and cannot be used by the users. Example for soft real time system is personal computer, audio and video systems, etc.

3 Hard real time system: The hard real-time definition considers any missed deadline to be a system failure. This scheduling is used extensively in mission critical systems where failure to conform to timing constraints results in a loss o f life or property. A Hard Real-Time System guarantees that critical tasks complete on time. This goal requires that all delays in the system be bounded from the retrieval of the stored data to the time that it takes the operating system to finish any request made of it. Hard real time means strict about adherence to each task deadline. When an event occurs, it should be serviced within the predictable time at all times in a given hard real time system. A hard RT RTOS is one, which has predictable performance with no deadline miss, even in case of sporadic tasks (sudden bursts of occurrence of events requiring attention). Automobile engine control system and anti lock brake are the examples of hard real time systems Example : video transmission, each picture frame and audio must be transferred at fixed rate Difference between soft real time system and hard real time system Characteristic Hard real time system Soft real time system Response time Hard required Soft required Peak load performance Predictable Degraded Control of pace Environment Computer Safety Critical Non-critical Size of data files Small/medium Large Data integrity Short term Long term Error detection Autonomous User assigned Q.2 Explain the following terms: (i) Jobs (ii) Release time (iii) Response time (iv) Deadline (8) Ans. Job (J ij ): Jobs are define schedulable unit of work. it allocated processor time and other resources and Unit of work, scheduled and executed by system. characterized by the following parameters: Temporal parameters: timing constraints and behavior Functional parameters: intrinsic properties of the job. Resource parameters: resource requirements. Interconnection parameters: how it depends on other jobs and how other jobs depend on it. Release Time: Instant of time job becomes available for execution. If all jobs are released when the system begins execution, then there is said to be no release time. The time instant the job becomes ready to execute.

4 Deadline: Instant of time a job's execution is required to be completed. If deadline is infinity, then job has no deadline. Absolute deadline is equal to release time plus relative deadline. The time instant by which the job must complete execution. Response time: Length of time from release time to instant job completes. Response time: =Completion time - Release time. Example Job is released at time 3. It s deadline is at time 10. It s response time is 6 Q.2 Explain the differences between: (i)tardiness v/s usefulness (ii) Absolute deadline v/s relative deadline (8) Ans. Tardiness :-In scheduling, tardiness is a measure of a delay in executing certain operations and earliness is a measure of finishing operations before due time. The operations may depend on each other and on the availability of equipment to perform them. Typical examples include job scheduling in manufacturing and data delivery scheduling in data processing networks. In manufacturing environment, inventory management considers both tardiness and earliness undesirable. Tardiness involves backlog issues such as customer compensation for delays and loss of goodwill.

5 Usefulness:- Usefulness reverse of tardiness. we will draw the graph between usefulness and tardiness,it describe gradually. Relation between tardiness and usefulness

6 Q.3 What do you mean by Temporal parameters of real time workload? Explain (8) Ans. Hard real-time: number and parameters of tasks are known at all time. for Job J i : r i - release time, may know range [r -, r + ] (jitter). For aperiodic/sporadic release or interrelease time is a random variable. d i - absolute deadline D i - relative deadline (r i, d i ] - feasible interval e i - Execution time. May know range [e -, e + ]. Most deterministic models use e +. Resource parameter

7 We can describe configuration of resource of resource graph. Q.3 Describe clock driven and weighted round robin approach with example. (8) Ans. clock driven :Decisions about what jobs execute at what times are made at specific time instants These instants are chosen before the system begins execution Usually regularly spaced, implemented using a periodic timer interrupt Scheduler awakes after each interrupt, schedules the job to execute for the next period, then blocks itself until the next interrupt Typically in clock-driven systems: All parameters of the real-time jobs are fixed and known A schedule of the jobs is computed off-line and is stored for use at runtime; as a result, scheduling overhead at run-time can be minimized Simple and straight-forward, not flexible weighted round robin: Regular round-robin scheduling is commonly used for scheduling time-shared applications Every job joins a FIFO queue when it is ready for execution When the scheduler runs, it schedules the job at the head of the queue to execute for at most one time slice Sometimes called a quantum typically O(tens of ms) If the job has not completed by the end of its quantum, it is preempted and placed at the end of

8 the queue Roll No. When there are n ready jobs in the queue, each job gets one slice every n time slices (n time slices is called a round) Only limited use in real-time systems By giving each job a fixed fraction of the processor time, a round- robin scheduler may delay the completion of every job A precedence constrained job may be assigned processor time, even while it waits for its predecessor to complete; a job can t take the time assigned to its successor to finish earlier Not an issue for jobs that can incrementally consume output from their predecessor, since they execute concurrently in a pipelined fashion E.g. Jobs communicating using Unix pipes E.g. Wormhole switching networks, where message transmission is carried out in a pipeline fashion and a downstream switch can begin to transmit an earlier portion of a message, without having to wait for the arrival of the later portio Q.4 Differentiate online and offline scheduling. What do you understand by scheduler and schedules? (8) Ans. Offline Scheduling It IS time triggered approach, contrasting some properties already here to those of event triggered.initiating activities in the sys- tem with the progression of time requires thorough, complete understanding of the system and the environment it will operate in. Scheduling for TT is usually carried out via a scheduling table, which lists tasks and their activation times. An offline algorithm takes complete information about the system activities, which reflect the knowledge about anticipated environmental situations and requirements, and cre- ates a single table, representing a feasible solution to the given requirements. As the algorithm is performed offline, fairly complex task sets can be handled, e.g., prece- dence constraints, distribution and communication over networks, task allocation, mutual exclusion, separation of tasks, etc. Should a feasible solution not be found, retries are possible, e.g., by changing the parameterization of the algorithm or the properties of the task set. At runtime, a very simple runtime dispatcher executes the decisions represented in the table, i.e., which (portion of a) task to execute next. Typically, a minimum granularity of time is assumed for the invocations of the runtime scheduler, so called slots. Online Scheduling In event triggered systems, events invoke an online sched- uler, which takes a decision based on a set of pre defined rules, e.g., represented as priorities. An offline schedulability test can be used to show that, if a set of rules is applied to a given task set at runtime, all tasks will meet their deadlines. Major representative lines of such algorithms are based on fixed priorities, e.g, rate monotonic or dynamic priorities.

9 Jobs scheduled and allocated resources based on a set of scheduling algorithms and access control protocols. Scheduler: Module implementing scheduling algorithms Schedule: assignment of all jobs to available processors, produced by scheduler. Valid schedule: a. every processor assigned to at most one job at a time b. every job assigned to at most one processor at a time c. no job scheduled before its release time d. Total amount of processor time assigned to every job is equal to its maximum or actual execution time Q.4 In the given fig. 1, the number next to the name of each job is its execution time.j 5 is released at time 4 and all other jobs are released at time 0.We want to schedule and execute the jobs on two processor P 1 and P 2. The priority list is according to: J i has a higher priority than J k if i<k. Find the priority driven schedule of all jobs when jobs are (i) Preemptive (ii) Non-preemptive J 1, 3 J 2,1 J 3,2 J 4, 2 J 5, 2 J 6, 4 J 7, 4 J 8, 1 Figure: 1 (8)

10 Ans. here J i > j k if i<k R i =0 except j5 r 3 =4 Two process p1 and p2 communicate through shared memory P1 J1 J4 J7 J P2 J2 J3 J7 J5 Processor ideal J Non preemptive P1 J1 J4 J5 J P2 J2 J3 J7 J

11 Q.5 Explain Fixed, jittered, and sporadic release time. (8) Ans.sporadic release time Release jitter

12 Fixed release time: The time instant the job becomes ready to execute. Q.5 what do you mean by precedence constraints Graph? Explain dependencies among them. (8) Ans. precedence constraints Graph - A resource precedence graph is a directed graph that can be associated with a resource and whose nodes are the resource constraints posted on the resource.on a resource precedence graph, an edge between two resource constraints (rct1, rct2) means that the activity of rct1 is constrained to execute before the activity of rct2, provided that both resource constraints rct1 and rct2 definitely affect the availability of the resource (processing time and required capacity strictly greater than zero). A resource precedence graph constraint is a constraint that creates a precedence graph structure for the resource with which it is associated and allows propagation of the precedence information contained in this graph on the variables of the resource constraints (start and end time, processing time, required capacity). Data and control dependencies among jobs may 1. constrain the order in which they can execute. 2. Jobs have precedence constraints if they are constrained to execute in some order. 3. Jobs are independent if they can execute in any order. Precedence Constraints and DataDependency 1. J i < J k, J i is a predecessor of job j k, j k is a successor of J i 2. Immediate predecessor / immediate successor 3. J i and J k are independent if neither J i < J k nor J k < J i 4. A job with predecessors is ready for execution when the time is at or after its release time and all of its predecessors is completed. Precedence Graph and Task Graph 1. Precedence Graph represents the precedence constraints among jobs in a set J. 2. Each vertex represents a job in J. 3. A directed edge from vertex J i to J k when the job J i is an immediate predecessor of J k. 4. A task graph is an extended precedence graph.a task graph may contain different types of edges representing different types of dependencies. Data Dependency 1. Data dependency can not be captured by a precedence graph.

13 2. In a task graph, data dependencies among jobs are represented explicitly by data-dependency edges among jobs. 3. There is a data-dependency edge from J i to J k if the job J k consumes data generated by J i or the job J i sends messages to J k. 4. Edge parameters: e.g. Volume of data from J i to J k.