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


Blocking waits in FreeRTOS? (and 2 other Q's)

Posted by Nobody/Anonymous on November 27, 2004

I'm quite interested in the FreeRTOS project (and thank you for your effort!).

However, I was wondering why the timer tick is not a (signed) long so that a -1 can be used for a forever wait (blocking read)?

At the moment if I want to block forever I cannot. I must pass it ULONG_MAX but expect to wake up in about 42 days with a 1KHz tick (or 420 days with 10ms tick).

At any rate, anyone that can live with blocking for many days (if that's what they want) can also live with "many days"/2 (by using signed).

But for folks where "many days" == forver, I now don't have to put code everywhere to check of my call came back due to a timeout and now I have to call it again!

ALSO (2nd Q):
Is the timer tick over flow handled properly in the kernel? Since even a 10ms tick will result in 400+ days before overflow, if not checked explicitely a problem with it may have gone un-noticed.

ALSO (3rd Q :):
Why no timer functionality in FreeRTOS?



RE: Blocking waits in FreeRTOS? (and 2 other Q's)

Posted by Richard on November 27, 2004
Q1 -

This was a decision I made mainly based on the efficiency of the list implementation (which is fairly fundamental to the kernel). The way the implementation is, a "wait forever" tasks would have to be stored outside of the blocked list - requiring resources for another structure.

All blocking calls return a value that can be used to determine whether the block was successful or not - so I think it is ok to put an if() around the block to see why the call returned with very little overhead.

There cannot be many tasks in real world applications that are going to run less often than "every 400 days". You can always extend the call to have a block forever option if you wish - a benefit of open source.

What is best is obviously a matter of opinion, and what is best of one application will not be for another.

Q2 - This mechanism was tested by initialising the tick to a large value to start with - rather than 0.

Q3 - FreeRTOS is a minimal kernel, but (hopefully) easy to extend should you wish. The building blocks required for the majority of applications are in place. Should you wish to add features then this should be straight forward.

One aim of FreeRTOS is to keep everything as simple as possible. Adding more features increases the code size, necessitating more configuration options and less readability. Having said that it will grow as required over time whatever.

Not all commercial RTOS's have every feature of every other.

All these things are of coarse just "in my opinion".


[ 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