I've got an application which needs to do some rather funky process scheduling. This is definitely not what TBB is designed for, but it seems a rather close match. Posting here partially to see if TBB could adapt to this application, and partially to glean some interesting ideas! Let me explain...
We've got a large application framework running under Linux on multi-Xeon workstations using TBB. I've been asked to spec-up an enhancement to this application which is essentially to emulate some low-speed embedded systems, running RTOS. The use of traditional emulators/VM's is probably out the question as they need to integrate into the current framework. Luckily all the embedded applications are written in c-code, so a direct recompile is possible (first frigging the h/w accesses into our framework).
My immediate thought was to do a direct recompile of the RTOS applications onto Linux, sort the hardware I/O out, then slug'em. Code-wise its possible as the underlying O/S is posix compliant. The big problem is that we're taking 17MHZ single-cpu applications and running them on a 12-core 2.4ghz cpu - the race conditions would be horrendous as all applications start executing in parallel.
The only viable alternative would be to execute all RTOS applications as threads/tasks under a single linux application, with some kind of scheduler/CPU management going on to enforce linear operation. This is where TBB comes in. My initial thought was to allocate each application into a TBB pipeline, adding slug/delay tasks in between.
The real gotcha with this idea is that these applications are designed to be suspended by the underlying O/S, which won't happen if they're turned into tasks - I'd have to insert manual break-points into their code to allow fair scheduling.
Ultimately, taking this idea one step forward: is there any way in TBB to automatically break and re-schedule tasks? For example if we had a tasks with infinite duration, asking TBB to automatically suspend operation and move onto the next task, with operation to be picked up later. Essentially replicating the feature of a basic kernel scheduler, but at a much higher application level?
As I said, I know this is definitely not what TBB has been designed for: I'm actually trying to use it to enforce single-core, slow operation!!!
Any thoughts/comments/answers/suggestions welcome!