SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
1
Processes, Threads and Tasks
Inter-Process Communication and
Synchronization:
Lesson-2: Task and Task States
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
2
Concepts of Tasks
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
3
Task
 A task is like a process or thread in an
OS.
 An application program can also be
said to be a program consisting of the
tasks
 Task has various states that are
controlled by OS.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
4
Task…
 Task─ term used for the process in the
RTOSes for the embedded systems.
 For example, VxWorks and COS-II
are the RTOSes, which use the term
task.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
5
• Runs when it is scheduled to run by the
OS (kernel)
• A task request a (system call) or
receives or sends messages through OS
functions
• Runs by executing the instructions and
the continuous changes of its state takes
place as the program counter (PC)
changes
Task….
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
6
• Task is that executing unit of computation,
which is controlled by (i) OS process
scheduling mechanism, which lets it
execute on the CPU
• and (ii) OS process resource-management
mechanism that lets it use the system-
memory and other system-resources such
as network, file, display or printer
Task …
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
7
Task…
 A task─ an independent process.
 No task can call another task. [It is
unlike a C (or C++) function, which
can call another function.]
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
8
Tasks
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
9
Task…
 The task─ can send signal (s) or
message(s) that can let another task
run.
 The OS can only block a running task
and let another task gain access of
CPU to run the servicing codes
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
10
Application program can be said to
consist of number of tasks
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
11
Example ─ Automatic Chocolate
Vending Machine
 Software highly complex.
 RTOS schedules to run the application
embedded software as consisting of the
number of Tasks
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
12
Example ─ Automatic Chocolate
Vending Machine
 Number of functions, ISRs, interrupt-
service-threads, tasks, multiple physical
and virtual device drivers, and several
program objects that must be
concurrently processed on a single
processor
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
13
 Task User Keypad Input ─ keypad task
to get the user input
 Task Read-Amount ─ for reading the
inserted coins amount,
 Chocolate delivery task ─ delivers the
chocolate and signals the machine for
readying for next input of the coins,
Exemplary tasks at the ACVM
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
14
 Display Task,
 GUI_Task ─for graphic user interfaces,
 Communication task ─ for
provisioning the AVCM owner access
the machine Information and
information.
Exemplary tasks at the ACVM
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
15
Task States
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
16
States of a Task in a system
(i) Idle state [Not attached or not
registered]
(ii) Ready State [Attached or registered]
(iii) Running state
(iv) Blocked (waiting) state
(v) Delayed for a preset period
Number of possible states depends on the
RTOS.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
17
Task States
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
18
Idle (created) state
 The task has been created and memory
allotted to its structure
 However, it is not ready and is not
schedulable by kernel.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
19
Ready (Active) State
 The created task is ready and is
schedulable by the kernel but not
running at present as another higher
priority task is scheduled to run and
gets the system resources at this
instance.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
20
Running state
 Executing the codes and getting the
system resources at this instance. It
will run till it needs some IPC (input)
or wait for an event or till it gets
preempted by another higher priority
task than this one.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
21
Blocked (waiting) state
 Execution of task codes suspends after
saving the needed parameters into its
context.
 It needs some IPC (input) or it needs to
wait for an event or wait for higher
priority task to block to enable running
after blocking.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
22
Blocked (waiting) state example
 A task is pending while it waits for an
input from the keyboard or a file. The
scheduler then puts it in the blocked
state
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
23
Deleted (finished) state
Deleted Task─
 The created task has memory de-
allotted to its structure.
 It frees the memory.
 Task has to be re-created.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
24
Created and Activated Task States
During Processing
one of three states─
 ready,
 running and
 blocked.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
25
OS Functions for the tasks and Task
states at Smart Card
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
26
 Let the main program first run an RTOS
function OS_initiate ( )
 This enables use of the RTOS functions
 The main program runs an RTOS function
OS_Task_Create ( ) to create a task,
Task_Send_Card_Info..
Exemplary Steps
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
27
OS Functions
 OS_Task_Create ( ) runs twice to create
two other tasks, Task_Send_Port_Output
and Task_Read_Port_Input and both of
them are also in idle state. Let these tasks
be of middle and low priorities,
respectively.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
28
OS Functions
 OS_Start ( )─ for starting and
 OS_Ticks_Per_Sec ()─ for initiating n
system clock interrupts per s.
 After initiation, the system switches
from user mode to supervisory mode
every 1/60 s if n = 60. All three task-
states will be made in ready state by an
OS function
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
29
Task_Send_Card_Info States
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
30
Task_Send_Card_Info
 Task is for sending card information to the
host.
 Has an allocated memory for the stack.
 Has a TCB using which OS controls the
task.
 Task state is idle state at the brginning.
 Let Task_Send_Card_Info be of high
priority
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
31
 The OS runs a function, which makes the
Task_Send_Card_Info state as running.
 Task_Send_Card_Info runs an OS function
mailbox_post (authentication_request),
which sends the server identification request
through IO port to the host using the task
Task_Send_Port_Output
Task_Send_Card_Info
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
32
 The Task_Send_Card_Info runs a
function mailbox_wait ( ), which
makes the task state as blocked and OS
switches context to another task
Task_Send_Port_Output and then to
Task_Read_Port_Input for reading the
IO port input data,
Task_Send_Card_Info
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
33
 The OS when mailbox gets the
authentication message from server,
switches context to
Task_Send_Card_Info and the task
becomes in running state again
Task_Send_Card_Info
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
34
Summary
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
35
We learnt
 Application program can be said to
consist of number of tasks
 Task defined as a executing
computational unit that processes on a
CPU and state of which is under the
control of kernel of an operating
system.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
36
We learnt
 Task state at an instance defines by
task-Information (running, blocked, or
finished), task-structure—its data,
objects and resources and task- control
block.
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
37
We learnt
• OS lets a task execute on the CPU
• OS resource-management mechanism
lets the task use the system-memory
and other system-resources such as
network, file, display or printer
2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming
and Design", Raj Kamal, Publs.: McGraw-Hill Education
38
End of Lesson 2 of Chapter 9
on
“Task and its States

Más contenido relacionado

Similar a Chap_9Lesson02Emsys3ETaskandTaskStates.pdf

Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019
Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019
Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019VMware Tanzu
 
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}Mumbai B.Sc.IT Study
 
software design principles
software design principlessoftware design principles
software design principlesCristal Ngo
 
Notes on Deploying Machine-learning Models at Scale
Notes on Deploying Machine-learning Models at ScaleNotes on Deploying Machine-learning Models at Scale
Notes on Deploying Machine-learning Models at ScaleDeep Kayal
 
MATLAB Assignment Help
MATLAB Assignment HelpMATLAB Assignment Help
MATLAB Assignment HelpEssay Corp
 
VIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENT
VIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENTVIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENT
VIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENTijmpict
 
Deploying Apache Kylin on AWS and designing a task scheduler for it
Deploying Apache Kylin on AWS and designing a task scheduler for itDeploying Apache Kylin on AWS and designing a task scheduler for it
Deploying Apache Kylin on AWS and designing a task scheduler for itChase Zhang
 
Java programming concept
Java programming conceptJava programming concept
Java programming conceptSanjay Gunjal
 
SQLUG MSBUILD SSRS Deployments
SQLUG MSBUILD SSRS DeploymentsSQLUG MSBUILD SSRS Deployments
SQLUG MSBUILD SSRS DeploymentsKoenVerbeeck
 
Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...
Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...
Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...onlinetraining24
 
A simulation-based approach for straggler tasks detection in Hadoop MapReduce
A simulation-based approach for straggler tasks detection in Hadoop MapReduceA simulation-based approach for straggler tasks detection in Hadoop MapReduce
A simulation-based approach for straggler tasks detection in Hadoop MapReduceIRJET Journal
 
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...Jitendra Bafna
 
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...Embarcados
 
In-Depth Model/View with QML
In-Depth Model/View with QMLIn-Depth Model/View with QML
In-Depth Model/View with QMLICS
 
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdfcNguyn506241
 
Resume_embedded_systems_Onkar_Gulavani_01-05-2017
Resume_embedded_systems_Onkar_Gulavani_01-05-2017Resume_embedded_systems_Onkar_Gulavani_01-05-2017
Resume_embedded_systems_Onkar_Gulavani_01-05-2017Onkar Gulavani
 
Chap 6 lesson5emsysnewstatemachinefsm
Chap 6 lesson5emsysnewstatemachinefsmChap 6 lesson5emsysnewstatemachinefsm
Chap 6 lesson5emsysnewstatemachinefsmchandrika
 

Similar a Chap_9Lesson02Emsys3ETaskandTaskStates.pdf (20)

Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019
Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019
Operationalizing AI at scale using MADlib Flow - Greenplum Summit 2019
 
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
Project Management (October - 2016) [CBSGS - Paper Solution] {Mumbai University}
 
software design principles
software design principlessoftware design principles
software design principles
 
Notes on Deploying Machine-learning Models at Scale
Notes on Deploying Machine-learning Models at ScaleNotes on Deploying Machine-learning Models at Scale
Notes on Deploying Machine-learning Models at Scale
 
MATLAB Assignment Help
MATLAB Assignment HelpMATLAB Assignment Help
MATLAB Assignment Help
 
VIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENT
VIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENTVIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENT
VIRTUAL MACHINE SCHEDULING IN CLOUD COMPUTING ENVIRONMENT
 
Deploying Apache Kylin on AWS and designing a task scheduler for it
Deploying Apache Kylin on AWS and designing a task scheduler for itDeploying Apache Kylin on AWS and designing a task scheduler for it
Deploying Apache Kylin on AWS and designing a task scheduler for it
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
 
SQLUG MSBUILD SSRS Deployments
SQLUG MSBUILD SSRS DeploymentsSQLUG MSBUILD SSRS Deployments
SQLUG MSBUILD SSRS Deployments
 
Online Datastage Training
Online Datastage TrainingOnline Datastage Training
Online Datastage Training
 
Datastage Online Training
Datastage Online TrainingDatastage Online Training
Datastage Online Training
 
Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...
Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...
Datastage Online Training|IBM Infosphere Datastage Training|Datastage 8.7 onl...
 
A simulation-based approach for straggler tasks detection in Hadoop MapReduce
A simulation-based approach for straggler tasks detection in Hadoop MapReduceA simulation-based approach for straggler tasks detection in Hadoop MapReduce
A simulation-based approach for straggler tasks detection in Hadoop MapReduce
 
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
 
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
 
In-Depth Model/View with QML
In-Depth Model/View with QMLIn-Depth Model/View with QML
In-Depth Model/View with QML
 
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
 
DataXDay - Tensors in the sky with CloudML
DataXDay - Tensors in the sky with CloudML DataXDay - Tensors in the sky with CloudML
DataXDay - Tensors in the sky with CloudML
 
Resume_embedded_systems_Onkar_Gulavani_01-05-2017
Resume_embedded_systems_Onkar_Gulavani_01-05-2017Resume_embedded_systems_Onkar_Gulavani_01-05-2017
Resume_embedded_systems_Onkar_Gulavani_01-05-2017
 
Chap 6 lesson5emsysnewstatemachinefsm
Chap 6 lesson5emsysnewstatemachinefsmChap 6 lesson5emsysnewstatemachinefsm
Chap 6 lesson5emsysnewstatemachinefsm
 

Último

(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 

Último (20)

(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 

Chap_9Lesson02Emsys3ETaskandTaskStates.pdf

  • 1. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 1 Processes, Threads and Tasks Inter-Process Communication and Synchronization: Lesson-2: Task and Task States
  • 2. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 2 Concepts of Tasks
  • 3. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 3 Task  A task is like a process or thread in an OS.  An application program can also be said to be a program consisting of the tasks  Task has various states that are controlled by OS.
  • 4. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 4 Task…  Task─ term used for the process in the RTOSes for the embedded systems.  For example, VxWorks and COS-II are the RTOSes, which use the term task.
  • 5. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 5 • Runs when it is scheduled to run by the OS (kernel) • A task request a (system call) or receives or sends messages through OS functions • Runs by executing the instructions and the continuous changes of its state takes place as the program counter (PC) changes Task….
  • 6. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 6 • Task is that executing unit of computation, which is controlled by (i) OS process scheduling mechanism, which lets it execute on the CPU • and (ii) OS process resource-management mechanism that lets it use the system- memory and other system-resources such as network, file, display or printer Task …
  • 7. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 7 Task…  A task─ an independent process.  No task can call another task. [It is unlike a C (or C++) function, which can call another function.]
  • 8. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 8 Tasks
  • 9. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 9 Task…  The task─ can send signal (s) or message(s) that can let another task run.  The OS can only block a running task and let another task gain access of CPU to run the servicing codes
  • 10. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 10 Application program can be said to consist of number of tasks
  • 11. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 11 Example ─ Automatic Chocolate Vending Machine  Software highly complex.  RTOS schedules to run the application embedded software as consisting of the number of Tasks
  • 12. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 12 Example ─ Automatic Chocolate Vending Machine  Number of functions, ISRs, interrupt- service-threads, tasks, multiple physical and virtual device drivers, and several program objects that must be concurrently processed on a single processor
  • 13. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 13  Task User Keypad Input ─ keypad task to get the user input  Task Read-Amount ─ for reading the inserted coins amount,  Chocolate delivery task ─ delivers the chocolate and signals the machine for readying for next input of the coins, Exemplary tasks at the ACVM
  • 14. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 14  Display Task,  GUI_Task ─for graphic user interfaces,  Communication task ─ for provisioning the AVCM owner access the machine Information and information. Exemplary tasks at the ACVM
  • 15. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 15 Task States
  • 16. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 16 States of a Task in a system (i) Idle state [Not attached or not registered] (ii) Ready State [Attached or registered] (iii) Running state (iv) Blocked (waiting) state (v) Delayed for a preset period Number of possible states depends on the RTOS.
  • 17. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 17 Task States
  • 18. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 18 Idle (created) state  The task has been created and memory allotted to its structure  However, it is not ready and is not schedulable by kernel.
  • 19. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 19 Ready (Active) State  The created task is ready and is schedulable by the kernel but not running at present as another higher priority task is scheduled to run and gets the system resources at this instance.
  • 20. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 20 Running state  Executing the codes and getting the system resources at this instance. It will run till it needs some IPC (input) or wait for an event or till it gets preempted by another higher priority task than this one.
  • 21. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 21 Blocked (waiting) state  Execution of task codes suspends after saving the needed parameters into its context.  It needs some IPC (input) or it needs to wait for an event or wait for higher priority task to block to enable running after blocking.
  • 22. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 22 Blocked (waiting) state example  A task is pending while it waits for an input from the keyboard or a file. The scheduler then puts it in the blocked state
  • 23. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 23 Deleted (finished) state Deleted Task─  The created task has memory de- allotted to its structure.  It frees the memory.  Task has to be re-created.
  • 24. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 24 Created and Activated Task States During Processing one of three states─  ready,  running and  blocked.
  • 25. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 25 OS Functions for the tasks and Task states at Smart Card
  • 26. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 26  Let the main program first run an RTOS function OS_initiate ( )  This enables use of the RTOS functions  The main program runs an RTOS function OS_Task_Create ( ) to create a task, Task_Send_Card_Info.. Exemplary Steps
  • 27. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 27 OS Functions  OS_Task_Create ( ) runs twice to create two other tasks, Task_Send_Port_Output and Task_Read_Port_Input and both of them are also in idle state. Let these tasks be of middle and low priorities, respectively.
  • 28. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 28 OS Functions  OS_Start ( )─ for starting and  OS_Ticks_Per_Sec ()─ for initiating n system clock interrupts per s.  After initiation, the system switches from user mode to supervisory mode every 1/60 s if n = 60. All three task- states will be made in ready state by an OS function
  • 29. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 29 Task_Send_Card_Info States
  • 30. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 30 Task_Send_Card_Info  Task is for sending card information to the host.  Has an allocated memory for the stack.  Has a TCB using which OS controls the task.  Task state is idle state at the brginning.  Let Task_Send_Card_Info be of high priority
  • 31. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 31  The OS runs a function, which makes the Task_Send_Card_Info state as running.  Task_Send_Card_Info runs an OS function mailbox_post (authentication_request), which sends the server identification request through IO port to the host using the task Task_Send_Port_Output Task_Send_Card_Info
  • 32. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 32  The Task_Send_Card_Info runs a function mailbox_wait ( ), which makes the task state as blocked and OS switches context to another task Task_Send_Port_Output and then to Task_Read_Port_Input for reading the IO port input data, Task_Send_Card_Info
  • 33. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 33  The OS when mailbox gets the authentication message from server, switches context to Task_Send_Card_Info and the task becomes in running state again Task_Send_Card_Info
  • 34. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 34 Summary
  • 35. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 35 We learnt  Application program can be said to consist of number of tasks  Task defined as a executing computational unit that processes on a CPU and state of which is under the control of kernel of an operating system.
  • 36. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 36 We learnt  Task state at an instance defines by task-Information (running, blocked, or finished), task-structure—its data, objects and resources and task- control block.
  • 37. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 37 We learnt • OS lets a task execute on the CPU • OS resource-management mechanism lets the task use the system-memory and other system-resources such as network, file, display or printer
  • 38. 2015 Chapter-9 L2: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill Education 38 End of Lesson 2 of Chapter 9 on “Task and its States