Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-3: Task and Task States

Similar documents
Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-1: PROCESS

2008 Chapter-8 L1: "Embedded Systems - Architecture, Programming and Design", Raj Kamal, Publs.: McGraw-Hill, Inc.

Inter-Process Communication and Synchronization of Processes, Threads and Tasks:

Lesson 5: Software for embedding in System- Part 2

REAL TIME OPERATING SYSTEM PROGRAMMING-I: VxWorks

IT2A4 EMBEDDED SYSTEMS

Part B Questions. Unit I

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EE6602- EMBEDDED SYSTEMS QUESTION BANK UNIT I - INTRODUCTION TO EMBEDDED SYSTEMS PART A

Real Time Operating System

آنستیتیوت تکنالوجی معلوماتی و مخابراتی ICTI


Chapter 07: Instruction Level Parallelism VLIW, Vector, Array and Multithreaded Processors. Lesson 06: Multithreaded Processors

MLR INSTITUTE OF TECHNOLOGY DUNDIGAL , HYDERABAD QUESTION BANK

Lab 8 Real-time OS - 1

Mobile Operating Systems Lesson 01 Operating System

Embedded Systems. 6. Real-Time Operating Systems

Embedded Systems: OS. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Embedded Systems: OS

Real Time Operating System

3.1 Introduction. Computers perform operations concurrently

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

VALLIAMMAI ENGINEERING COLLEGE

Processes and Threads

GLOSSARY. VisualDSP++ Kernel (VDK) User s Guide B-1

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

Lesson-1: PROGRAM MODELS

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Chapter 13: I/O Systems

Embedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory

Process Description and Control. Chapter 3

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Int tmytask() { while(1){ .. } }

Process Management Rab Nawaz Jadoon

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation

EE458 - Embedded Systems Exceptions and Interrupts

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Embedded System Design Case Study-Part I Module No: CS/ES/39 Quadrant 1 e-text

Input Output (IO) Management

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

Task Based Programming Revisited Real Time Operating Systems

Chapter 6 PROGRAMMING THE TIMERS

Introduction. CS3026 Operating Systems Lecture 01

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

SMD149 - Operating Systems

Chapter 3 Process Description and Control

4. Concurrency via Threads

RT extensions/applications of general-purpose OSs

Micrium µc/os II RTOS Introduction EE J. E. Lumpp

UNIT:2. Process Management

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

CIS233J Java Programming II. Threads

Operating Systems Process description and control

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

Lecture 3: Concurrency & Tasking

REAL TIME OPERATING SYSTEMS: A COMPLETE OVERVIEW

Introduction to Real-Time Operating Systems

Page Replacement. 3/9/07 CSE 30341: Operating Systems Principles

Process Description and Control. Chapter 3

Processes. Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively.

Chapter 13: I/O Systems

Threads, SMP, and Microkernels. Chapter 4

Real-time operating systems and scheduling

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Process Description and Control

Process Description and Control

Process. Discussion session 3 1/30/2016

Real Time Operating System

Module 12: I/O Systems

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #10: More on Scheduling and Introduction of Real-Time OS

Module 1. Introduction:

Chapter 13: I/O Systems

CSC227: Operating Systems Fall Chapter 1 INTERRUPTS. Dr. Soha S. Zaghloul

[08] IO SUBSYSTEM 1. 1

Processes and Threads. From Processes to Threads. The Case for Threads. The Case for Threads. Process abstraction combines two concepts.

Short Term Courses (Including Project Work)

Embedded System Curriculum

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document C28X CCS

CSCE Introduction to Computer Systems Spring 2019

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

A New Real-time Kernel development on an embedded platform

Announcements Processes: Part II. Operating Systems. Autumn CS4023

EMBEDDED SYSTEMS PART A UNIT-1

Processes. Process Concept

Process Description and Control. Chapter 3

Concurrent programming: Introduction II. Anna Lina Ruscelli Scuola Superiore Sant Anna

Threads Chapter 5 1 Chapter 5

Systemy RT i embedded Wykład 11 Systemy RTOS

Chapter 13: I/O Systems

IT 540 Operating Systems ECE519 Advanced Operating Systems

EMERALDS: a small-memory real-time microkernel

Introduction to Real-Time Systems and Multitasking. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM

Enriching Enea OSE for Better Predictability Support

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Frequently asked questions from the previous class survey

Transcription:

Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-3: Task and Task States 1

Task Concepts 2

Task An application program can also be said to be a program consisting of the tasks and task behaviors in various states that are controlled by OS. A task is like a process or thread in an OS. 3

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. 4

Task A task consists of executable program (codes), state of which is controlled by OS, The state during running of a task represented by information of processstatus (running, blocked, or finished), process-structure its data, objects and resources, and task control block (PCB). 5

Runs when it is scheduled to run by the OS (kernel), which gives the control of the CPU on a task request (system call) or a message. Runs by executing the instructions and the continuous changes of its state takes place as the program counter (PC) changes Task. 6

Task Task is that executing unit of computation, which is controlled by some process at the OS scheduling mechanism, which lets it execute on the CPU and by some process at OS for a resource-management mechanism that lets it use the systemmemory and other system-resources such as network, file, display or printer 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

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 9

Application program can be said to consist of number of tasks 10

Example Automatic Chocolate Vending Machine Software highly complex. RTOS schedules to run the application embedded software as consisting of the number of Tasks 11

Example Automatic Chocolate Vending Machine Number of functions, ISRs, interruptservice-threads, tasks, multiple physical and virtual device drivers, and several program objects that must be concurrently processed on a single processor 12

Tasks in Embedded Program 13

Exemplary tasks at the ACVM 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, 14

Exemplary tasks at the ACVM Display Task, GUI_Task for graphic user interfaces, Communication task for provisioning the AVCM owner access the machine Information and information. 15

Task States 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

Task States 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

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

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

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

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

Deleted Task Deleted (finished) state The created task has memory deallotted to its structure. It frees the memory. Task has to be re-created. 24

Created and Activated Task States one of three states ready, running and blocked. During Processing 25

OS Functions for the tasks and Task states at Smart Card 26

Exemplary Steps 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.. 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

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 taskstates will be made in ready state by an OS function 29

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 30

Task_Send_Card_Info 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 31

Task_Send_Card_Info 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, 32

Task_Send_Card_Info 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 33

Task_Send_Card_Info States 34

Summary 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

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

We learnt OS lets a task execute on the CPU Some process at OS for a resourcemanagement mechanism lets the task use the system-memory and other system-resources such as network, file, display or printer 38

End of Lesson 3 of Chapter 7 39