EMBEDDED SYSTEM (NOTES AS PER BPUT SYLLABUS) BY-SHUBHAM KUMAR Module –III Real Time Operating System(RTOS): - Real-Time Task Scheduling: *Some important concepts * Types of real-time tasks and their characteristics * Task scheduling * Clock- Driven scheduling * Hybrid schedulers * Event-Driven scheduling * Earliest Deadline First(EDF) scheduling * Rate monotonic algorithm (RMA) Module –IV - Modelling Techniques: o Software and programming concept: ▪ Processor selection for an embedded system, ▪ State chart, ▪ SDL, ▪ Petri-Nets, ▪ Unified Modeling Language (UML). - Hardware software co-design. - Hardware and software partitioning: K-L partitioning, - Partitioning using genetic algorithm,
MODULE-3 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“ Correct function at correct time Usually embedded Deadlines Hard real-time systems Soft real-time systems Soft RTS: meet timing constraints most of the time, it is not necessary that every time constraint be met. Some deadline miss is tolerated. Hard RTS: meet all time constraints exactly, Every resource management system must work in the correct order to meet time constraints. No deadline miss is allowed. Why we need scheduling ?! each computation (task) we want to execute needs resources resources: processor, memory segments, communication, I/O devices etc.) the computation must be executed in particular order (relative to each other and/or relative to time) the possible ordering is either completely or statistically a priori known (described) scheduling: assignment of processor to computations; allocation: assignment of other resources to computations; - - Real-time task scheduling essentially refers to determining the order in which the various tasks are to be taken up for execution by the operating system. Every operating system relies on one or more task schedulers to prepare the schedule of execution of various tasks it needs to run. Real-time tasks get generated in response to some events that may either be external or internal to the system. Every real-time system usually consists of a number of realtime tasks. The time bounds on different tasks may be different Selection of appropriate task scheduling algorithm is central to the proper functioning of a real time system(to meet the time constraint of the task). Important concepts . Task instance . Relative deadline Vs Absolute deadline . Response time . Task precedence . Data sharing
Task instance: . A task is generated when some specific event occurs. . Real time tasks normally recur a large number of times at different instants of time depending on event occurrence time. . Most real-time tasks recurs with certain fixed periods. .E.g. : A temperature sensing task in chemical plant might recur indefinitely with a certain period because the temperature is sampled periodically, whereas a task handling a device interrupt might recur at random instants. . Each time a task recurs, it is called an instance of the task. The first time a task occurs, it is called the first instance of the task. . The next occurrence of the task is called its second instance, and so on.. . The jth instance of a task Ti would be denoted as Ti(j). . Each instance of a real-time task is associated with a deadline by which it needs to complete and produce results. Relative Deadline Vs Absolute Deadline: Absolute Deadline: . The absolute deadline of a task is the ab-solute time value (counted from time 0) by which the results from the task are expected. . Thus , absolute deadline is equal to the interval of time between the time 0 and the actual instant at which the deadline occurs as measured by some physical clock. Relative Deadline .Relative deadline is the time in-terval between the start of the task and the instant at which the deadline occurs. . In other words, relative deadline is the time interval between the arrival of a task and the corresponding dead-line. .the relative deadline of the task Ti(1) is d, whereas its absolute deadline Φ+d. Relative Deadline and Absolute Deadline of a task
Response Time: . The response time of a task is the time it takes (as measured from the task arrival time) for the task to produce its results. .As already remarked, task instances get generated due to occurrence of events. .These events may be internal to the system, such as clock interrupts, or external to the system such as a robot encountering an obstacle Task Precedence: . A task is said to precede another task,if the first task must complete before the second task can start. .When a task Ti precedes Tj , then each instance of Ti precedes corresponding instance of Tj . . A precedence order defines a partial order among tasks. Data Sharing: . Tasks often need to share their results among each other when one task needs to share the results produced by another task; clearly, the second task must precede the first task. . In fact, precedence relation between two tasks sometimes implies data sharing between the two tasks (e.g., first task passing some results to the second task). However, this is not always true. . A task may be required to precede another even when there is no data sharing. .E.g. in a chemical plant it may be required that the reaction chamber must be filled with water before chemicals are introduced . In this case, the task handling filling up the reaction chamber with water must complete, before the task handling introduction of the chemicals is activated. . It is, therefore, not appropriate to represent data sharing using precedence relation. . Data sharing among the tasks does not necessarily impose any particular ordering among the tasks. . Here, T2 uses the results of T3.T2 may even start executing first , after sometimes it may receive some data from T3, and continues its execution. TYPES OF REAL-TIME TASKS & THEIR CHARACTERISTICS: - Based on the way real-time tasks recur over a period of time, it is possible to classify them into three main categories: .Periodic tasks . Sporadic tasks . Aperiodic tasks. Periodic Tasks: .A periodic task is one that repeats after a certain fixed time interval. .Periodic tasks are sometimes referred to as clock-driven tasks. .The fixed time interval after which a task repeats is called the period of the task.