Professional Documents
Culture Documents
Unit 2-Design of Embedded System
Unit 2-Design of Embedded System
▪ Speed of Execution:
▪ Flexibility of making changes:
▪ Size of the System:
▪ Power consumption:
▪ Memory:
▪ Cost:
Hardware Design
It Involves
Selection of Processor
Processor selection is the most critical in hardware design
Processor will be Micro controller, Microprocessor or
Digital Signal Processor (DSP).
▪ Development tools:
▪ Special requirements:
▪ RTOS support:
What is testing?
• Testing is the process to prove that the system
works correctly,
• The Real time OS provides API functions that allow cleaner and smaller
application code.
Fast dispatch latency: It is an interval between the termination of the task that
can be identified by the OS and the actual time taken by the thread, which is in the
ready queue, that has started processing.
• Unpredictable environment
• The Kernel saves the state of the interrupted task and then determines
which task it should run next.
• The Kernel restores the state of the task and passes control of the CPU
for that task.
Factors for selecting an RTOS
Here, are essential factors that you need to consider for selecting RTOS:
It used for desktop PC and laptop. It is only applied to the embedded application.
Interrupt latency is not considered as important as Interrupt lag is minimal, which is measured in a
in RTOS. few microseconds.
No priority inversion mechanism is present in the The priority inversion mechanism is current. So it
system. can not modify by the system.
Kernel's operation may or may not be preempted. Kernel's operation can be preempted.
Task Management
* Real Time Applications the process is called as
Task which takes execution time and occupies
memory.
* Task management is the process of managing
task through its life cycle.
Task
• No of Tasks
• Resource Requirements
• Release Time
• Execution Time
• Deadlines
Resource Allocation
• Weighted Round Robin
• Priority Based
Interrupt
An interrupt is a signal from a device attached to
a computer or from a program with in a computer that
causes the main program that is operating system to
stop and figure out what to do next.
Examples of Real Time System
• Plant control
• Control of production processes / industrial automation
• Railway switching systems
• Automotive applications
• Flight control systems
• Environmental acquisition and monitoring
• Telecommunication systems
• Robotics
• Military systems
• Space missions
• Household appliances.
Architecture of the Kernel
• The embedded software consists of the
Operating System and the application
software.
• The services provided by the operating
system are accessed through Application
Programming Interface(API) to develop
application software.
• The API is a set of function calls using which
you can access the various kernel objects and
the service provided by the kernel.
The Various Kernel Objects are
• Task
• Task Scheduling
• Interrupt Service Routines
• Semaphores
• Mutexes
• Mailboxes
• Message queues
• Pipes
• Event Registers
• Signals
• Timers
The Kernel provides various services through
operations on the kernel objects.
Context Switching:
The state of the CPU registers when a task has to
be preempted is called the context. Saving the
contents of the CPU registers and loading the new
task parameters is called context switching (High
Priority to low priority).
Scheduling Algorithms
• How does the kernel decide which task has to run? Various scheduling
algorithms have been developed to tackle this problem.
• Depending on the requirement of the ES, the scheduling algorithms are
selected.
Real-Time Scheduling Algorithms
Static vs. Dynamic
Static Scheduling:
This algorithm assigns priorities to tasks based on their periods: the
shorter the period, the higher the priority.
• Hence the priority of the task with respect to that of the other tasks
changes as jobs are released and completed.
– All scheduling decisions at run time.
• Based upon set of ready tasks.
• Mutual exclusion and synchronization enforced by clear
synchronization concepts.
– Benefits
• Flexibility.
• Only actually used resources are claimed.
– Disadvantages
• Guarantees difficult to support
• Computational resources required for scheduling
Static Scheduling:
Execution
Process Period
Time
P1 1 8
P2 2 5
P3 2 10
The theoretical limit for processes, under which we can conclude that
the system is schedulable is:
• Earliest deadline first selects a task according to its deadline such that a
task with earliest deadline has higher priority than others.
• A task which has a higher priority due to earliest deadline at one instant it
may have low priority at next instant due to early deadline of another task.
• At t=1 again absolute deadlines are compared and T2 has shorter deadline so it executes and
after that T3 starts execution but at t=4 T1 comes in the system and deadlines are compared, at
this instant both T1 and T3 has same deadlines so ties are broken randomly so we continue to
execute T3.
• At t=6 T2 is released, now deadline of T1 is earliest than T2 so it starts execution and after that T2
begins to execute. At t=8 again T1 and T2 have same deadlines i.e. t=16, so ties are broken
randomly an T2 continues its execution and then T1 completes. Now at t=12 T1 and T2 come in
the system simultaneously so by comparing absolute deadlines, T1 and T2 has same deadlines
therefore ties broken randomly and we continue to execute T3.
• At t=13 T1 begins it execution and ends at t=14. Now T2 is the only task in the system so it
completes it execution.
• At t=16 T1 and T2 are released together, priorities are decided according to absolute deadlines so
T1 execute first as its deadline is t=20 and T3’s deadline is t=24.After T1 completion T3 starts and
reaches at t=17 where T2 comes in the system now by deadline comparison both have same
deadline t=24 so ties broken randomly ant we T continue to execute T3.
• At t=20 both T1 and T2 are in the system and both have same deadline t=24 so again ties broken
randomly and T2 executes. After that T1 completes it execution. In the same way system continue
to run without any problem by following EDF algorithm.
Advantages of EDF over rate monotonic: