Chapter 5 Time Management use clock tick to provide a periodic interrupt to keep track of time delays and timeouts The frequency of the clock tick depends.

Slides:



Advertisements
Similar presentations
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Advertisements

Real-Time Library: RTX
Mike Holenderski, Synchronization 2IN60: Real-time Architectures (for automotive systems)
Chapter 12 Memory Management. The dynamic memory allocation can be achieved by using malloc() and free() function Using malloc() and free(0 in an embedded.
Embedded System Presentation Nguyễn Trần Quang Nguyễn Công Vũ 1µC/OS-II.
Chapter 14 80x86, Large Model Port Porting to real mode and for the large model –Real mode: 1Mb memory space (pointers in this model require 32 bits) –In.
Lecture 2. Real-time Systems Concept Prof. Taeweon Suh Computer Science Education Korea University COM609 Topics in Embedded Systems.
Department of Mathematics and Computer Science μC/OS-II 2IN60: Real-time Architectures (for automotive systems)
IN2305-II Embedded Programming Lecture 7: More OS Services.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
10 minute Activity Be ready to report back in ten minutes.
Embedded Systems More Operating System Services C.-Z. Yang Sept.-Dec
MicroC/OS-II Embedded Systems Design and Implementation.
ΜC/OS-III Tasks Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Real Time Operating System
國立台灣大學 資訊工程學系 Introduction to uC/OS-II
Kernel structure & Task management © P.J.Fondse April 2010.
The  C/OS-II Real-Time Operating System.  C/OS-II Real-time kernel –Portable, scalable, preemptive RTOS –Ported to over 90 processors Pronounced “microC.
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.
Scheduling in µC/OS-III Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Real Time Operating Systems
Overview Task State Diagram Task Priority Idle Hook AND Co-Routines
1 G53SRP: Clocks and Time in Java Chris Greenhalgh School of Computer Science.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
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.
ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 3 Sharing Nicely Week 3 - Sharing Nicely 1.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
uC/OS-II Real-Time Systems Concepts Kernel Structure Task Management
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 – μC/OS 2015/10/13/ 13 1.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
1 J.O. KLEIN Institut Universitaire de Technologie de CACHAN Université PARIS SUD - FRANCE An Introduction to Real Time Operating System.
Parts of the Clock Click on the minute hand. Click on the clock’s face.
1 Round Robin Non-Preemptive Scheduler Lecture 12.
Ch6. Flow of Time Ch7. Getting Hold of Memory 홍원의.
Chapter 7: Semaphore Management Seulki Lee 1. Semaphore?  A protocol mechanism offered by most multitasking kernels  Control access to a shared resource.
2-1 Chapter 2 Real-Time Systems Concepts. 2-2 Foreground/Background Systems BackgroundForeground ISR Time Code execution application consists of an infinite.
Chapter 3: Kernel Structure 1. Objectives To understand what a task is. To learn how μ C/OS-II manages tasks. To know how an interrupt service routine.
Real Time Operating Systems Johan Dams
Chapter 13: Porting μC/OS-II 1. Outline Requirements Hardware Software Tasks of Porting µC/OS-II OS_CPU_C.H OS_CPU_C.C OS_CPU_A.ASM Testing a port 2.
Chapter 3: Kernel Structure 1. Objectives To understand what a task is. To learn how μ C/OS-II manages tasks. To know how an interrupt service routine.
Chapter 1: Getting Started with μC/OS-II 1. kernel Introduction 2 LinuxμC/OS-II Task (process) kernel Device driver User mode (0-3G) (Kernel mode) 3G-4G.
Chapter 5: Time Management 1. Time Management OSTimeDly() OSTimeDlyHMSM() OSTimeDlyResume() OSTimeGet() OSTimeSet() 2.
Outlines  Introduction  Kernel Structure  Porting.
Timers and Time Management Ok-Kyun Ha
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – μC/OS 2016/5/31/ 13 1.
1.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 1: Introduction What Operating Systems Do √ Computer-System Organization.
Chapter 2: Operating System Concepts 1. Objectives To know essential topics on the design of (embedded) operating systems 2 1.Task & resources 2.Kernel.
Introduction In this lab , we will learn
Chapter 3: Kernel Structure
Chapter 13: Porting μC/OS-II
Chapter 4: Task Management
Chapter 2: Operating System Concepts
Unit-1 Introduction to Java
Presented by Kristen Carlson Accardi
Interrupt and Time Management in µC/OS-III
Round Robin Non-Preemptive Scheduler
CS4101 嵌入式系統概論 Tasks and Scheduling
Writing and Testing Your First RTOS Project with MQX
Interrupts, Tasks and Timers
Scheduling in µC/OS-III
Multithreading.
Introduction to uC/OS-II
Multithreaded Programming
امتحانات میں شامل سوالات کے برے ،اچھے اور بہترین نمونے
It’s Time for a Break!!!.
Computer System Laboratory
Chapter 6: Event Control Block (ECB)
Akos Ledeczi EECE 6354, Fall 2017 Vanderbilt University
Presentation transcript:

Chapter 5 Time Management use clock tick to provide a periodic interrupt to keep track of time delays and timeouts The frequency of the clock tick depends on the desired tick resolution of your application Higher frequency of the ticker, the higher overhead

Delaying a Task –Call OSTimeDly() –Suspend the task and cause context switch –Once the time expire or another task cancels the delay by calling OSTimeDlyResume(), the task is made ready to run void OSTimeDly (INT16U ticks) { if (ticks > 0) { (1) OS_ENTER_CRITICAL(); if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) { (2) OSRdyGrp &= ~OSTCBCur->OSTCBBitY; } OSTCBCur->OSTCBDly = ticks; (3) OS_EXIT_CRITICAL(); OSSched(); (4) }

Figure 5.1 Delay resolution

Delaying a Task, OSTimeDlyHMSM() –Can specify time in hours, minutes, seconds, and milliseconds –Can not resume by OSTimeDlyResume, if task calls OSTimeDlyHMSM() with a combined time that exceeds clock ticks INT8U OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U milli) { INT32U ticks; INT16U loops; if (hours > 0 || minutes > 0 || seconds > 0 || milli > 0) { (1) if (minutes > 59) { return (OS_TIME_INVALID_MINUTES); } if (seconds > 59) { return (OS_TIME_INVALID_SECONDS); } if (milli > 999) { return (OS_TIME_INVALID_MILLI); } ticks = (INT32U)hours * 3600L * OS_TICKS_PER_SEC (2) + (INT32U)minutes * 60L * OS_TICKS_PER_SEC + (INT32U)seconds) * OS_TICKS_PER_SEC + OS_TICKS_PER_SEC * ((INT32U)milli + 500L/OS_TICKS_PER_SEC) / 1000L;(3) loops = ticks / 65536L; (4) ticks = ticks % 65536L; (5) OSTimeDly(ticks); (6) while (loops > 0) { (7) OSTimeDly(32768); (8) OSTimeDly(32768); loops--; } return (OS_NO_ERR); } else { return (OS_TIME_ZERO_DLY); (9) }

Resuming a Delayed Task, OSTimeDlyResume() INT8U OSTimeDlyResume (INT8U prio) { OS_TCB *ptcb; if (prio >= OS_LOWEST_PRIO) { (1) return (OS_PRIO_INVALID); } OS_ENTER_CRITICAL(); ptcb = (OS_TCB *)OSTCBPrioTbl[prio]; if (ptcb != (OS_TCB *)0) { (2) if (ptcb->OSTCBDly != 0) { (3) ptcb->OSTCBDly = 0; (4) if (!(ptcb->OSTCBStat & OS_STAT_SUSPEND)) { (5) OSRdyGrp |= ptcb->OSTCBBitY; (6) OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX; OS_EXIT_CRITICAL(); OSSched(); (7) } else { OS_EXIT_CRITICAL(); } return (OS_NO_ERR); } else { OS_EXIT_CRITICAL(); return (OS_TIME_NOT_DLY); } } else { OS_EXIT_CRITICAL(); return (OS_TASK_NOT_EXIST); }