Overview Task State Diagram Task Priority Idle Hook AND Co-Routines

Slides:



Advertisements
Similar presentations
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 3 Process Description and Control
Real-Time Library: RTX
FreeRTOS.
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by.
Processes CSCI 444/544 Operating Systems Fall 2008.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
P ORTING F REE RTOS TO MCB2140 BOARD Ashwini Athalye Sravya Kusam Shruti Ponkshe.
Process Description and Control A process is sometimes called a task, it is a program in execution.
BINA RAMAMURTHY UNIVERSITY AT BUFFALO System Structure and Process Model 5/30/2013 Amrita-UB-MSES
FreeRTOS.
Performance Evaluation of Real-Time Operating Systems
ΜC/OS-III Tasks Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Real Time Operating System
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
2-1 The critical section –A piece of code which cannot be interrupted during execution Cases of critical sections –Modifying a block of memory shared by.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
FreeRTOS.
REVIEW OF COMMONLY USED DATA STRUCTURES IN OS. NEEDS FOR EFFICIENT DATA STRUCTURE Storage complexity & Computation complexity matter Consider the problem.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
11/13/20151 Processes ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original.
CS333 Intro to Operating Systems Jonathan Walpole.
2001 Networking Operating Systems (CO32010) 1. Operating Systems 2. Processes and scheduling 4.
1 Review of Process Mechanisms. 2 Scheduling: Policy and Mechanism Scheduling policy answers the question: Which process/thread, among all those ready.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
Real Time Operating Systems Michael Thomas Date: Rev. 1.00Date.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Multi-Tasking The Multi-Tasking service is offered by VxWorks with its real- time kernel “WIND”.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Types of shedulars Process.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
AT91SAM7X256 Board and FreeRTOS Overview Real-Time Systems Lab Dae Don Jeon
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Task Management 김백규. Task states(1/2)  Running  currently utilising the processor.  Ready  tasks are those that are able to execute.  they are not.
Co-routine YoonMo, Yeon. Co-routine generalize subroutines multiple entry points suspending and resuming of execution at certain locations.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
LPC2148's RTOS Bruce Chhuon 4/10/07. What is a Real Time Operating System? ● A Real Time Operating System (RTOS) manages hardware and software resources.
Introduction In this lab , we will learn
REAL-TIME OPERATING SYSTEMS
Processes and threads.
Process concept.
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
CS399 New Beginnings Jonathan Walpole.
CS4101 嵌入式系統概論 Tasks and Scheduling
Threads and Locks.
RTS: Kernel Design and Cyclic Executives
Introduction What is an operating system bootstrap
System Structure and Process Model
Process Description and Control
Process Description and Control
Threads Chapter 5 2/17/2019 B.Ramamurthy.
RTS: Kernel Design and Cyclic Executives
Threads Chapter 5 2/23/2019 B.Ramamurthy.
Process Description and Control
Chapter 3: Process Management
Akos Ledeczi EECE 6354, Fall 2017 Vanderbilt University
Presentation transcript:

Microprocessor Interfacing Tasks and Examples Microprocessor Interfacing

Overview Task State Diagram Task Priority Idle Hook AND Co-Routines Kernel and Trace Utilities Naming Conventions Example Code

Task States Diagram Running – When a task is actually executing it is said to be in the Running state. It is currently utilizing the processor. Ready – Ready tasks are those that are able to execute (they are not blocked or suspended) but are not currently executing because a different task of equal or higher priority is already in the Running state.

Task States Diagram Blocked – A task is said to be in the Blocked state if it is currently waiting for either a temporal or external event. For example, if a task calls vTaskDelay() it will block (be placed into the Blocked state) until the delay period has expired - a temporal event. Tasks can also block waiting for queue and semaphore events. Tasks in the Blocked state always have a 'timeout' period, after which the task will be unblocked. Blocked tasks are not available for scheduling. Suspended – Tasks in the Suspended state are also not available for scheduling. Tasks will only enter or exit the suspended state when explicitly commanded to do so through the vTaskSuspend() and xTaskResume() API calls respectively. A 'timeout' period cannot be specified.

Task Priority Priority Number ranges from 0 to (configMAX_PRIORITIES - 1) Zero is lowest priority tskIDLE_PRIORITY is zero

Typical Task void vATaskFunction( void *pvParameters ) { // Initialization code goes here for( ;; ) { // Task application code here // in endless loop with preemptive or // cooperative context switching by // scheduler. }

Idle Task Created automatically by scheduler, not the user. Releases heap space when vTaskDelete() is used on task tskIDLE_PRIORITY = 0 Other tasks may have zero priority Never block idle task

Idle Task Hook Implements co-routine in idle task. Example blink LED every pass through idle task via vFlashCoRoutine(…) See FreeRTOS.ORG Web Pages

Co-routine Write co-routine Schedule co-routine by vCoRoutineSchedule( void ); call Create co-routine within main( ) by xCoRoutineCreate( vFlashCoRoutine, PRIORITY_0, 0 ); Start scheduler with in main( ) by vTaskStartScheduler(); See FreeRTOS.ORG web pages for details

RTOS Kernel Utilities Queue implementation Semaphore implementation Idle hook function

Trace Utility Configure system to use trace by configUSE_TRACE_FACILITY Start trace by vTaskStartTrace() Stop trace by ulTaskEndTrace() Automatically closes if buffers overflow. Copy buffer to PC Use tracecon.exe to convert to CSV file Plot using Excel or MatLab

Trace Utility

Naming Conventions Variables Variables of type char are prefixed c Variables of type short are prefixed s Variables of type long are prefixed l Variables of type float are prefixed f Variables of type double are prefixed d Enumerated variables are prefixed e Other types (e.g. structs) are prefixed x Pointers have an additional prefixed p, for example a pointer to a short will have prefix ps Unsigned variables have an additional prefixed u, for example an unsigned short will have prefix us

Naming Conventions Functions File private functions are prefixed with prv API functions are prefixed with their return type, as per the convention defined for variables Function names start with the file in which they are defined. For example vTaskDelete is defined in Task. c

Application Components The timing requirements of the hypothetical system can be split into three categories: Strict timing - the plant control The control function has a very strict timing requirement as it must execute every 10ms. Flexible timing - the LED While the LED outputs have both maximum and minimum time constraints, there is a large timing band within which they can function. Deadline only timing - the human interfaces This includes the keypad, LCD, RS232 and TCP/IP Ethernet communications. The human interface functions have a different type of timing requirement as only a maximum limit is specified. For example, the keypad must be scanned at least every 10ms, but any rate up to 10ms is acceptable.

Example Code Main.c Dynamic.c BlockQ.c ComTest.C CRFlash.c CRHook.c Death.c Flash.c Flop.c Integer.c PollQ.c Print.C SemTest.C Embedded TCP/IP Examples

Main.c Starting/Stopping the kernel Using the trace visualization utility Allocation of priorities

Dynamic.c Passing parameters into a task Dynamically changing priorities Suspending tasks Suspending the scheduler

BlockQ.C Inter-task communications Blocking on queue reads Blocking on queue writes Passing parameters into a task Pre-emption Creating tasks

ComTest.C Serial communications Using queues from an ISR Using semaphores from an ISR Context switching from an ISR Creating tasks

CRFlash.C Creating co-routines Using the index of a co-routine Blocking on a queue from a co-routine Communication between co-routines

CRHook.C Creating co-routines Passing data from an ISR to a co-routine Tick hook function Co-routines blocking on queues

Death.C Dynamic creation of tasks (at run time) Deleting tasks Passing parameters to tasks

Flash.C Delaying Passing parameters to tasks Creating tasks

Flop.C Floating point math Time slicing Creating tasks

Integer.C Time slicing Creating tasks

PollQ.c Inter-task communications Manually yielding processor time Polling a queue for space to write Polling a queue for space to read Pre-emption Creating tasks

Print.C Queue usage

SemTest.C Binary semaphores Mutual exclusion Creating tasks

ACLU #20 When a task is first created, in what state does it start? Running task waits for semaphore. To what state does it transition? Blocked task receives message in queue. To what state does it transition?

Homework Chapter 16