2
I’m developing an application that involves three (maybe more) processes that run simultaneously: an HTTP server, a logger and another that will run the main code.
A priori, a simple solution to do this is by using three threads, one for each program task. This is a very simple solution that allows me to exchange information between threads in a very quiet way, if necessary.
However, these three tasks can be performed quite independently and could be done in three different programs, rather than three threads in a single program.
My question then is: what is the difference between these two approaches? Which would be the most recommendable, considering that the third is the main thread?
Considerations: the application will run on a very pure Linux system (only with the essential installed) and the hardware is a Beaglebone Black.
It depends a little on the language used but mine default usually be separate. Use threads only when it does not pay to pass data to another process, where the processing needs a very fast response and the passage between processes will cost a lot. It can help: http://answall.com/questions/1946/%C3%89-always-guaranteed-that-a-applies%C3%A7%C3%A3o-com-m%C3%Baltiplas-threads-spin-plus-r%C3%A1pido-que
– Maniero
@bigown I should use C++11 threads if I’m going to do it with threads. I’ll check the link. Thank you.
– Lucas Lima
Managed to solve your problem?
– durtto
@Eduardoseixas Basically it’s a question of projects. There’s not much difference between approaches. The main different is communication, using threads you share the same context and memory in OS, separate programs not.
– Lucas Lima
Got it. So create an answer and mark it as accepted, so your question is not orphaned and can help other people.
– durtto