Altera_Forum
Honored Contributor
20 years agoCost of Creating threads at run-time
In an embedded system running uClinux, is it inefficient to be creating new threads all the time? (i.e. the overhead for creating threads)
In my application, I want to create a thread whenever I need to do a blocking DMA call. Once the DMA is finished, the thread exits. My friend said that it's "better" to create all the threads I need to at the initialization, then use semaphore to signal it to run. Is it really better? I think that kind of complicates things up because then I need to use global variables and mutex to pass data between threads? Lastly, is there a better way to share data between threads by not using global variable?