Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved multiprocess c/c++ linux

    General and Desktop
    5
    9
    1161
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      s002wjh last edited by

      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?

      JonB 1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Out of curiosity, why do you want to do that ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        S 1 Reply Last reply Reply Quote 1
        • JonB
          JonB @s002wjh last edited by

          @s002wjh
          I doubt fork() will be a suitable approach, unless you really know what you are doing!

          1 Reply Last reply Reply Quote 0
          • Pablo J. Rogina
            Pablo J. Rogina last edited by

            @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.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            S 1 Reply Last reply Reply Quote 1
            • S
              s002wjh @SGaist last edited by

              @SGaist

              its an assignment, so..

              1 Reply Last reply Reply Quote 0
              • S
                s002wjh @Pablo J. Rogina last edited by

                @Pablo-J.-Rogina

                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.

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by SGaist

                  Multiple threads don't guarantee that your application will go faster. It all depends on what it must do.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  S 1 Reply Last reply Reply Quote 1
                  • S
                    s002wjh @SGaist last edited by

                    @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.

                    mrjj 1 Reply Last reply Reply Quote 0
                    • mrjj
                      mrjj Lifetime Qt Champion @s002wjh last edited by

                      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.

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post