Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Operation of RTOS

Posted by Nobody/Anonymous on April 28, 2006
I'm studing your rtos code for Atmel AVR.

But I've some question about priority and task execution time.

This is my problem :

suppose we have 3 task (A, B, C)

I want to be sure that each task is executed every 1 mSec independently from their time of elaboration.

But the important thing is that the scheduler must stops task A , task B or task C and start the other tasks independently from their work.

I explain : if task A (in reponse to an user input...a stupid example...an user has entered to calc the sqr from 1 to 25000000) needs about 10 mSec for his work, I want that the kernel stops task A and executes task B.

Same thing for the other task. Task B must be stopped (if not finished) after max 1 msec because another task needs starting

Is it possible with freertos ???

Another question:

In the article about context switching you write "TaskB has a higher priority than TaskA so vTaskSwitchContext() selects TaskB as the task to be given processing time when the ISR completes" (http://www.techonline.com/static/feature_articles/barry/step4.html)

But if I have only two task (A and B) in my program and the task B has low priority then task A, the context switch will never happens ???

Excuse me, but I'm a primer with rtos.

Thank you

Best regards

RE: Operation of RTOS

Posted by Richard on April 28, 2006
I'm not sure I follow your questions fully, but I think they are both referring to the scheduling policy.

FreeRTOS is a preemptive priority based kernel. A task will never execute if there is a task of higher priority that is ready to execute (not blocked). In other words, the scheduler will always choose to run the highest priority task that is able to run at the expense of any lower priority tasks.

If the preemptive scheduler is being used then task can be given the same priority. When there are more than one task of the same priority a context switch will occur each kernel tick. So I think the answer to your first question is that if each of the three tasks are given the same priority they will share the processing time, provided there are no tasks of higher priority that are able to run.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner