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




Loading

configUSE_TIME_SLICING and task mutual exclusion

Posted by dragonflight1 on February 14, 2015

A year ago I tried to understand configUSETIMESLICING with the goal of having the scheduler guarantee mutual exclusion rather than use semaphores/mutexes/notifications to share common resources (non-reentrant sprintf, I2C, DSP ...) among a set of tasks ( https://sourceforge.net/p/freertos/discussion/382005/thread/278999da ).

I recently came across https://sourceforge.net/p/freertos/discussion/382005/thread/c5bc7c5e in which RTE suggests that a change made for V8.0.0

+ Previously, when a task left the Blocked state, a context switch was
  performed if the priority of the unblocked task was greater than or equal
  to the priority of the Running task.  Now a context switch is only
  performed if the priority of the unblocked task is greater than the
  priority of the Running task.

made this possible.

Unfortunately this doesn't help as a task becoming unblocked as a result of a timeout and a priority >= current priority will cause a yield and the ready queue to rotate. (Note: the >= is not the problem, but rather that a task switch calls listGETOWNEROFNEXTENTRY which rotates the ready queue.)

I'm not sure configUSETIMESLICING is the right config parameter to use (Richard suggested it had particular meaning in some documentation), but what would be really nice is to use a per priority level flag to control "mutual exclusivity/time slicing within a priority level". A second flag could be used to force a rotation if a task relinquished control through a portYield() or a vTaskDelay(0).

This would allow the user to user normal preemptive time slicing except in the few cases where it would be beneficial to use cooperative instead.

I believe this would be useful to even non-expert users.

mike


configUSE_TIME_SLICING and task mutual exclusion

Posted by rtel on February 14, 2015

Thanks for the suggestion. You could add this to a feature request tracker in SourceForge so it doesn't get lost as an idea - although I have to be honest and say that, with everything else we have going on at the moment, it would be some time before such a change was considered.

Regards.


configUSE_TIME_SLICING and task mutual exclusion

Posted by dragonflight1 on February 14, 2015

I will add it, but I hope you consider it. The implementation is trivial and all changes restricted to the actual use of the new feature.


[ 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