1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 <2011> 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 <2011> 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: epicsMessageQueue Linux PREEMPT_RT |
From: | Till Straumann <[email protected]> |
To: | [email protected] |
Date: | Fri, 28 Jan 2011 12:28:42 -0600 |
On 01/28/2011 10:37 AM, Eric Norum wrote:
Hmm... I see that my name is on the code in osi/os/default/osdMessageQueue.cpp but I don't think that I actually wrote it. I would have expected that all allocation would be done at message queue initialization -- I agree that allocating at run-time is a poor idea.
Sure but pre-allocation of the 'event nodes' is not possible since. There is one such node per thread that is blocking on the queue. Unless you know how many threads may block you can't pre-allocate. However, I'm not sure these 'event nodes' are really necessary. They are only used to notify blocked threads in a FIFO manner. One could have just two 'epicsEvent's (one for TX, one for RX) and let all receivers simply block on the single RX 'epicsEvent'. The 'epicsEvent' itself should ensure that just one thread wakes up. However, it may be that the wake-up is not strictly FIFO but governed by whatever policy 'epicsEvent' uses. - Till
On Jan 28, 2011, at 8:16 AM, <[email protected] <mailto:[email protected]>> wrote:
Hi Andrew The PREEMPT_RT patch makes the kernel fully pre-emptive (leading to improved maximum latency) and adds support for priority inheritance mutexes. There are no user space API changes, the code to use _POSIX_THREAD_PRIORITY_SCHEDULING and _POSIX_THREAD_PRIO_INHERIT is already in libCom (if disabled by default). I'd like to use the epicsMessageQueue from a high priority thread but the send and receive functions may calloc an eventNode, and that might cause a page fault or block my thread on the malloc lock. I'd like to be able to pre-allocate the eventNodes because I know the maximum number of threads that may wait on the queue in advance. James-- Eric Norum [email protected] <mailto:[email protected]>