[linux-audio-dev] malloc() in RT code considered not-so-harmful?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] malloc() in RT code considered not-so-harmful?
From: Joshua Haberman (joshua_AT_reverberate.org)
Date: Tue Jul 13 2004 - 08:15:05 EEST


Maged Michael from IBM, who is publishing lots of practical lock-free
algorithms these days, has just published a paper describing a
lock-free memory allocation algorithm:

http://www.research.ibm.com/people/m/michael/pldi-2004.pdf

It seems plausible that you could use this to safely allocate memory
from RT threads. The only questions I have about its practicality are:

1. how easy/possible is it to use two malloc() implementations in the
same program? My brief research suggests that mixing system malloc(3)
and sbrk(2) (the latter is the underlying mechanism for obtaining more
memory from the OS) is not guaranteed to be safe. A possible solution
I have encountered is to obtain memory from the OS by mmap(/dev/zero)
instead of using sbrk(2).

2. When your lock-free malloc needs more memory from the OS it will
still take a system call to do it. I believe I have heard it said in
the past that system calls of any sort are unacceptable in RT code, but
isn't this a bit a of a hard-line position?

Josh


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Jul 13 2004 - 08:18:58 EEST