On Jan 28, 2011, at 2:23 PM, Ben H. wrote:
As I understand it, there is code in the GNURadio scheduler stuff that
manages block scheduling, to some degree.
I’m aware of the kernel’s role in switching between the threads
themselves, but I was under the impression that block scheduling, was
at least in some part, influenced by GNU Radio.
If this is incorrect though, someone please correct me!
Yes, this is true, Ben. The OS handles the basics of thread execution,
but the TPB scheduler does handle “when” a block’s “general_work” method
is actually called. See gnuradio-core/src/lib/runtime, files
“gr_tpb_thread_body.cc” (which for the most part is a simple loop
calling the block executor and neighbor blocks when things change) and
“gr_block_executor.cc” (which is where the meat of what you’re looking
for it, I believe). For the latter, you can set ENABLE_LOGGING to 1,
which should give you an idea of what the “decision process” is.
I think the general idea goes roughly like this: When data in a given
buffer changes (whether through generated or consumed items), each block
that is associated with that buffer checks to see if there is “enough”
input data and output buffer space for a “reasonable sized” computation.
If not, then go back and wait for buffers to change; if so, then do the
computation (call “general_work”). You’ll need to look through the code
to determine what “enough” and “reasonable sized” mean – looking at the
debug log might help as well.
It’s been a long time since I’ve thought about these algorithms, so
hopefully the above is reasonably correct. And, I hope this helps! -