Quality RTOS & Embedded Software

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


Loading

Some basic Questions

Posted by jimmjimm on March 31, 2014

Hi, I'm new for RTOS. I got some very basic Questions for FreeRTOS: 1.I got 2 tasks, A need run 10ms a loop and B need 100ms per loop. they got same priority, how the system will run this 2 tasks? Did it run A 10ms then B 100ms a loop or run A 10ms then B 10ms?

2.Same as 1. but A is higher priority than B, how the system go?

3.still A and B same priority if i want to run each task 5ms then switch to another task 5ms as a loop what should i did?


Some basic Questions

Posted by richard_damon on March 31, 2014

The system will run the highest task that is available to run, and when that task blocks the system will switch to the next task (that is now the highest ready to run). If two tasks are the same priority, then FreeRTOS will switch between them (if you allow preemption) every timer tick, or on a call to vTaskYield.

You talk about a task running x ms "a loop", if by that you mean that it computes for x ms to get a result, and then would naturally immediately start a new computation again (without blocking), THIS IS BAD. Such a task will monopolize the system and any tasks of lower priority will never run.

Tasks of this sort really, if you really need them, should only exist at the idle priority, so there can be no tasks of lower priority, and then let freeRTOS switch between them with preemption, or have Yields in the loop.

Generally, tasks "do their thing" in response to something, be it a semaphore being set or data being put in a queue, either from another task or an interrupt. Sometime it might just be on a periodic basis based on timer ticks, and the task will block when done waiting for the conditions to arise when it should do its thing again.


Some basic Questions

Posted by rtel on March 31, 2014

Here are a few links in addition to Richard's answer:

vTaskDelayUntil() - used for creating periodic tasks: http://www.freertos.org/vtaskdelayuntil.html

configUSETIMERSLICING: http://www.freertos.org/a00110.html#configUSETIMESLICING

Regards.


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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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