Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2465 Discussions

thingking about packet processing pipeline example

softarts
Beginner
218 Views
the TBB book shows us an example "packet processing pipeline" which implement with TBB pipeline.
if I understand correctly, the pipeline need to create a new obj(filter) frequently with C++ new primitive, so if the filter has complex data member,it might take a huge time to do that?
0 Kudos
4 Replies
robert-reed
Valued Contributor II
218 Views
Quoting - softarts
the TBB book shows us an example "packet processing pipeline" which implement with TBB pipeline.
if I understand correctly, the pipeline need to create a new obj(filter) frequently with C++ new primitive, so if the filter has complex data member,it might take a huge time to do that?

Typically you'd build the pipeline dynamically as a setup operation and then run that pipeline with enough work to amortize the cost of the pipeline creation. If there are gaps in packet processing that lead to the termination of the pipeline (a null pointer passed along the filter chain), the pipeline should be restartable without having to recreate it.
0 Kudos
RafSchietekat
Valued Contributor III
218 Views
If the question is about filter objects specifically: the pipeline does not create, copy or delete them.
0 Kudos
softarts
Beginner
218 Views
Quoting - Raf Schietekat
If the question is about filter objects specifically: the pipeline does not create, copy or delete them.

just check the code, should be the 'stage_task ' is created again,
but seems it is related with the task scheduler,not pipeline?
0 Kudos
RafSchietekat
Valued Contributor III
218 Views
"just check the code, should be the 'stage_task ' is created again,
but seems it is related with the task scheduler,not pipeline?"
I presume that you meant to write that you "just checked the code", not that I should? In a pipeline you bring your own filter/stage objects, but TBB provides the tasks, and you have no say in what they look like or how they are operated. I would have chosen the name pipeline_task myself (a task stays with an item, not with a filter/stage), but that wouldn't mean that any pipeline objects are being created. :-) A pipeline could also be made to recycle its tasks, as I proposed a while ago in some experimental code, but I didn't measure its outcome.
0 Kudos
Reply