What is correct (Qt way) multihtread/multiprocess aplication design
-
Hi
For over 10 years I wrote in C++ and Qt applicationos. At the begining they were amateur and for personal purpose, but 4 years ago I start programming commercially Qt based aps.
I am well in single process and single thread apps design and programming. Even I am sikled in plugin architecture. But now we have multi core processors and I want utilise this power. First step for this is correct app architecture. So I have some questions what I can reach that level of competence still programming in C++ and Qt. Questions:- Multithread or multiproces apps?
If multiprocess: - Is Qt Remote able to act as asynchronous message broker between GUI and deamons (esentianl parts of app). I wish to avoid design additional network protocols in order to pass messages between GUI and daemons.
If not: - What else?
- Please tell me is that consultancy level require commercial Qt license? They help solve such dilemmas?
- Are such design skills covered by some commercial courses? I mean multithread and multiproces design architecture skills.
If yes: - Can you recommended any of such courses?
- Multithread or multiproces apps?
-
Hi and welcome to devnet,
First things first: using threads for the sake of using threads is the wrong approach. The first question you should ask yourself before using threads is: do I really need them ? If the answer is yes, go back to the previous question and think some more about it.
Threads are a big foot gun that comes with a great deal of strange and hard to debug problems. Never forget that Qt is asynchronous and that already solved most of the usual cases where people think they need threading.
Now that you have settled for the yes answer for good reasons: threads VS process. The only answer is: it will depend on what your application does. If you build a GUI to pilot some existing tools then QProcess and no need for threading. If you need to offload some work, then it will again depend on the work.
For the communication between daemons and your application, there are some existing tools like DBus that already exists and is widely used in the Unix world. For other possibilities you should check the target you want to reach.
AFAIK, QtRemoteObjects is more geared toward distributed systems however I haven't played much with it so I do not want to mislead you.
For the consultancy, if you have a commercial licence then you should contact the Qt Company directly.
For other courses, beside the Qt Company itself folks at KDAB have lots of them which are high quality and they know what they are talking about.