Unsolved multiprocess c/c++ linux
-
anyone know a guide/tutorial on how to multiprocess programming in linux?
for example I have a main qwidget that has 2 button(date, time). When "date" button is click, it open a new qwidget window that display date but instead running on same process, this widget will run on child process.
should i use something like fork() to run this "date qwidget" any example how this is done?
-
Hi,
Out of curiosity, why do you want to do that ?
-
@s002wjh
I doubtfork()
will be a suitable approach, unless you really know what you are doing! -
@s002wjh said in multiprocess c/c++ linux:
"date qwidget"
Is this widget going to do some heavy processing on its own? If so, I'd say it shouldn't and you would need to consider such calculations into threads.
Most of the Qt apps keep all the GUI components in just one thread, the GUI thread. -
its an assignment, so..
-
well i try tread, and it got slower, not sure its the mutex or sync operation behind it. also its assignment so i need use multi process.
-
Multiple threads don't guarantee that your application will go faster. It all depends on what it must do.
-
@SGaist said in multiprocess c/c++ linux:
Multiple threads don't guarantee that your application will go faster. It all depends on it must do.
i know which is way i'm try to figure out if i run in multporcess mode will it be faster.
-
Hi
It will only be faster if the tasks that is heavy can be split between threads.
so data can be calculated in parallel.
Else it will make little difference besides not locking up the gui while it processes.
Since you are showing zero code, all we can do it give general suggestions.Also note , its NOT possible to move QWidgets to other threads. They must live in main thread.