Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. multiprocess c/c++ linux
Forum Updated to NodeBB v4.3 + New Features

multiprocess c/c++ linux

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 1.8k Views 3 Watching
  • 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 Offline
    S Offline
    s002wjh
    wrote on last edited by
    #1

    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?

    JonBJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      1
      • S s002wjh

        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?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @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
          1
          • SGaistS SGaist

            Hi,

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

            S Offline
            S Offline
            s002wjh
            wrote on last edited by
            #5

            @SGaist

            its an assignment, so..

            1 Reply Last reply
            0
            • Pablo J. RoginaP Pablo J. Rogina

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

              S Offline
              S Offline
              s002wjh
              wrote on last edited by
              #6

              @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
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by SGaist
                #7

                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
                1
                • SGaistS SGaist

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

                  S Offline
                  S Offline
                  s002wjh
                  wrote on last edited by
                  #8

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

                  mrjjM 1 Reply Last reply
                  0
                  • S s002wjh

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

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    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
                    2

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved