News for hackers. Stuff that matters.
Re:Show HN: A thread hierarchy management library in C by mancini0 on Monday July 13, 2020 @12:09PM (#23822309)
Stupid question because I am very new to embedded programming and C (I started my journey this weekend), but could one use freertos's tasks library in a regular x86 desktop application to accomplish something similar?
Re:Show HN: A thread hierarchy management library in C by anitil on Monday July 13, 2020 @10:35PM (#23827922)
Not stupid at all. Like many early questions in programming, it's actually a fairly deep.

Because FreeRTOS is unlikely to play nice with your host OS, typically you'd need to emulate a target (say, arm) using an emulator like qemu. Once you're at that point, you could run it like any other program. There's probably more complexity to it like building an image but there'd be a bunch of tutorials for this.

When would you typically do this? For testing your FreeRTOS (or other bare metal) code without actually loading it on to your device and power cycling it. Maybe as part of a regression test

Re:Show HN: A thread hierarchy management library in C by iTokio on Monday July 13, 2020 @10:42AM (#23821268)
Re:Show HN: A thread hierarchy management library in C by rurban on Tuesday July 14, 2020 @08:54AM (#23831294)
Me not. Dill is to call coros with a native C ABI, whilst this is to orchestrate native threads, calls into the threads are setup via pipes, not function calls.

both are doing the most natural thing for proper concurrency. nthm with true concurrency (native threads). dill with fake concurrency, coros only, aka green threads.

Re:Show HN: A thread hierarchy management library in C by Koshkin on Monday July 13, 2020 @10:02AM (#23820867)
And for those of us who write C++ there's always Intel's Threading Building Blocks. (Not sure if any other language has something equal in power and convenience.)
Re:Show HN: A thread hierarchy management library in C by mratsim on Tuesday July 14, 2020 @06:15AM (#23830223)
I've written Weave for the Nim programming language:

- https://github.com/mratsim/weave

- RFC that describes the goals: https://github.com/nim-lang/RFCs/issues/160

Re:Show HN: A thread hierarchy management library in C by dman on Monday July 13, 2020 @10:58AM (#23821439)
Would openmp fit in with how you use TBB? In the past I have used them to solve similar problems.
Re:Show HN: A thread hierarchy management library in C by Koshkin on Monday July 13, 2020 @12:07PM (#23822294)
TBB is based on the use of nested threads. We rely on much of what TBB has to offer, which includes concurrent containers and flowgraphs. Here's a nice overview by Mike Voss of what makes TBB different from OpenMP and C++ standard threading: https://software.intel.com/content/www/us/en/develop/article....