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

Queues and Semaphores

Posted by Bonanza35 on January 7, 2009

We're in a severe RAM crunch on a project, and are looking for ways to free up some RAM. There are some places where queues are used where they aren't really needed, and semaphores would work just as well. So, I started looking at the effects of replacing a few queues with semaphores.

Then I discovered that a semaphore is just another kind of queue, and the memory overhead is the same (76 bytes, IIRC).

Isn't there a better way to implement semaphores that won't use up quite as much memory?

RE: Queues and Semaphores

Posted by MEdwards on January 7, 2009
There it is just a trade off between ROM and RAM. Semaphores are implemented so they add nothing to the code size by reusing the queue. Semaphores are free as far as ROM is concerned.

Most of the RAM overhead is part of the event control. That is how the tasks are blocked and unblocked. Some RTOS use separate semaphore and event control structures, but add the two together and there is the same usage.

RE: Queues and Semaphores

Posted by Dmitriy A. Cherepanov on January 8, 2009
Year ago I had such question too. And I had try to write a binary semaphore.
You can see it on http://freertos.narod.ru/.

It use less ram. Actually it consist only from one List. This mean that xList == xMySemaphoreImplementationStructure.

It is a pity but I did not test it very well, but this variant of semaphores worked in PC demo tests instead of original variant. So you can try to use it. May be Richard or somebody else will do some attention to this sources.


[ 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