Professional Documents
Culture Documents
Real-Time Operating Systems: Read Chapter 6 (David E. Simon, An Embedded Software Primer)
Real-Time Operating Systems: Read Chapter 6 (David E. Simon, An Embedded Software Primer)
Read Chapter 6
(David E. Simon, An Embedded Software Primer)
An Operating System:
• What: It is a program (software) that acts as
an intermediary between a user of a computer
and the computer hardware.
• Why: Make the use of a computer
CONVENIENT and EFFICIENT.
RTOS Architecture Revision
• The real time operating system can suspend one
task code subroutine in the middle of its processing
in order to run another.
(02/24/2022) 3
What Is an Operating System?
For an Embedded System
• Convenient :
– Simplicity of use
– Messy or complicated details are hidden
– User is unaware that he is using an OS
• Efficient
– Resources are optimally used
Desktop OS Vs RTOS
• In desktop computer, the • Here, application gets control
OS takes control of first and it then starts RTOS.
machine as soon as it is
turned on and lets start
your applications. • Application and RTOS are much
• Compile and link more tightly tied to one another.
applications separately • Passing a bad pointer into the
from the OS. system, make the whole system
• Desktop protect rebooted.
themselves as carefully
from your application. • To save memory RTOS typically
• Use more memory include just the services that you
need for your embedded system
and no more.
Commercially Available RTOS:
VxWorks,VRTX,pSOS,Nucleus,C
Executive,LynxOS,QNX,Multi-Task!,AMX, and
dozens more.
The commercial RTOS come already debugged with a
good collection of features and tools.
Process/Task Concept
• Preemptive RTOS:
vbuttontask
Vbuttontask does
everything it needs to do
to respond to the
button.
Time
Task and Data
RTOS data
structures RTOS
Task 1
Task 3
Task 2
Task3 registers
Task2 registers
Task3 stack
Task2 stack
>Shared Data Problem…again……!!!
Void task1 (void)
{
Task ……….
……..
Vcounterrors(9);
can ……..
……..
Void task2 (void)
Share {
…………….
…………….
Data Vcounterrors(11)
……….
……..
}
Static int cerrors;
Void vcounterrors (int cnewerrors)
{
cerrors+=cnewerrors;
}
Y this code fails???
;Assembly code for vcounterrors
;{
;cerrors+=cnewerrors;
Move R1,(cerrors)
ADD R1,(cnewerrors)
Move (cerrors),R1
RETURN
;}
Y this code fails???
R1 for cerrors
TASK1 R1 for
TASK1 calls vcounterrors(9) TASK2 5
Move R1,(cerrors) 5
ADD R1,(cnewerrors) 14
2. A reentrant function may not call any other functions that are
not themselves reentrant.