Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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


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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists