Windows 10 and Visual Studio 2017.
I would like to build a wxWidgets app as a proof of concept in a Multi-process Architecture similar to modern browsers like Chrome, Edge and Firefox.
No, I am not interested in building a browser, for that I can simply to use the available wrappers like wxWebViewChromium for example.
I want to know how, in general, you go about solving a problem of having windows in each tab that are connected to separate processes. How do these windows communicate with the respective processes? I have looked into wxWidgets IPC examples but I am thinking browsers must be passing around complex data structures than simple strings.
Looking for ideas on where to begin.
Using wxWidgets in a Multi-process Architecture
Re: Using wxWidgets in a Multi-process Architecture
Hi,
Are you looking for "multi-processing" or "multi-threading"?
Thank you.
Are you looking for "multi-processing" or "multi-threading"?
Thank you.
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: Using wxWidgets in a Multi-process Architecture
As far as i understand you, i would think i had the same question some weeks ago. I found two possible solutions:
You may use wxThread to program some explizit multithreading (seem quiet complicated without some multithreading-experience, so i did not try it).
Alternatively there is OpenMP, which seems to be quiet simple (i tried a bit, but no sophisticated things). It mainly can be used to split loops and functions into threads, which is (more or less automatically) done by the compiler and controlled by just using "#pragma omp ..." preprocessor-directives. Also, OpenMP should be part of your c-compiler and has not to be downloaded, but it is no full multithreading of that kind, that your whole application is splitted into threads.
You may use wxThread to program some explizit multithreading (seem quiet complicated without some multithreading-experience, so i did not try it).
Alternatively there is OpenMP, which seems to be quiet simple (i tried a bit, but no sophisticated things). It mainly can be used to split loops and functions into threads, which is (more or less automatically) done by the compiler and controlled by just using "#pragma omp ..." preprocessor-directives. Also, OpenMP should be part of your c-compiler and has not to be downloaded, but it is no full multithreading of that kind, that your whole application is splitted into threads.
Re: Using wxWidgets in a Multi-process Architecture
katuday is actually talking about multi-process like Chrome uses it:
https://www.chromium.org/developers/des ... chitecture
It looks quite complicated and i think you need very good reasons to even consider an architecture like this.
I have no experience with this and don't even have a general idea how i'd approach this, but for IPC i would probably look into shared memory:
https://www.boost.org/doc/libs/1_69_0/d ... esses.html
https://www.chromium.org/developers/des ... chitecture
It looks quite complicated and i think you need very good reasons to even consider an architecture like this.
I have no experience with this and don't even have a general idea how i'd approach this, but for IPC i would probably look into shared memory:
https://www.boost.org/doc/libs/1_69_0/d ... esses.html
Use the source, Luke!
Re: Using wxWidgets in a Multi-process Architecture
I want "multi-processing" NOT "multi-threading".ONEEYEMAN wrote:Hi,
Are you looking for "multi-processing" or "multi-threading"?
Thank you.
I want independent processes so that in case once process crashes does not bring down the entire app.
Re: Using wxWidgets in a Multi-process Architecture
I have looked into MPI too.art-ganseforth wrote:As far as i understand you, i would think i had the same question some weeks ago. I found two possible solutions:
You may use wxThread to program some explizit multithreading (seem quiet complicated without some multithreading-experience, so i did not try it).
Alternatively there is OpenMP, which seems to be quiet simple (i tried a bit, but no sophisticated things). It mainly can be used to split loops and functions into threads, which is (more or less automatically) done by the compiler and controlled by just using "#pragma omp ..." preprocessor-directives. Also, OpenMP should be part of your c-compiler and has not to be downloaded, but it is no full multithreading of that kind, that your whole application is splitted into threads.
Specifically boost::mpi https://www.boost.org/doc/libs/1_64_0/doc/html/mpi.html.
What scared me is it may be necessary to deal with complicated marshalling of objects that are not PODs which mpi does not handle natively
Re: Using wxWidgets in a Multi-process Architecture
wxWidgets has wxProcess
You can show your windows in tabs or whatever, created all of them in the main thread, which is the GUI for your app.
The task to do in a particular window (e.g. reacting to some user action) can be done in a separate process. This process can be created by wxProcess or is a [likekly no-GUI] executable on your own.
This process is launched by wxExecute().
Once you have the process executing, you can do IPC between the app (server) and that process (client). Or use a temp file updated frequently, one process write, the other reads. This is only true if the process is launched asynchronously, otherwise the server waits (see wxExecute docs).
If the execution of the process is synchronous, a return code from wxExecute different of {0, -1} means that the launched process crashed. For asynchronous, I can't tell.
You can show your windows in tabs or whatever, created all of them in the main thread, which is the GUI for your app.
The task to do in a particular window (e.g. reacting to some user action) can be done in a separate process. This process can be created by wxProcess or is a [likekly no-GUI] executable on your own.
This process is launched by wxExecute().
Once you have the process executing, you can do IPC between the app (server) and that process (client). Or use a temp file updated frequently, one process write, the other reads. This is only true if the process is launched asynchronously, otherwise the server waits (see wxExecute docs).
If the execution of the process is synchronous, a return code from wxExecute different of {0, -1} means that the launched process crashed. For asynchronous, I can't tell.
Re: Using wxWidgets in a Multi-process Architecture
This sounds practical and it seems browsers like Chrome use some variation of IPC. What type of IPC would you recommend that would work well with wxProcess? I want to be able to pass around class objects between server and client so probably I will need some kind of serializationManolo wrote:wxWidgets has wxProcess
Once you have the process executing, you can do IPC between the app (server) and that process (client). Or use a temp file updated frequently, one process write, the other reads. This is only true if the process is launched asynchronously, otherwise the server waits (see wxExecute docs).
One more thing. Is it possible to pass a message from server to a client process that is already started and running?
I can't think of any means to do this.
Last edited by katuday on Fri Feb 01, 2019 10:08 pm, edited 1 time in total.
Re: Using wxWidgets in a Multi-process Architecture
Have you read wx IPC docs?