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. concurrent run time problem
Forum Updated to NodeBB v4.3 + New Features

concurrent run time problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 423 Views 1 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.
  • C Offline
    C Offline
    caner
    wrote on last edited by
    #1

    Hi everyone,
    İ created 8 threads using qtconcurrent run. Everything seems okey, threads are working parallely but there is not time improvement. Single call to function lasts about 80 msec but 8 thread lasts around 900 msecs.
    There are no global variables etc used. In thread function, there are lots of for loops, big array operations (array sizes are around250000 byte). What can be the problem..
    regards

    jsulmJ JonBJ 2 Replies Last reply
    0
    • C caner

      Hi everyone,
      İ created 8 threads using qtconcurrent run. Everything seems okey, threads are working parallely but there is not time improvement. Single call to function lasts about 80 msec but 8 thread lasts around 900 msecs.
      There are no global variables etc used. In thread function, there are lots of for loops, big array operations (array sizes are around250000 byte). What can be the problem..
      regards

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @caner Without any code hard to say what is wrong

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C caner

        Hi everyone,
        İ created 8 threads using qtconcurrent run. Everything seems okey, threads are working parallely but there is not time improvement. Single call to function lasts about 80 msec but 8 thread lasts around 900 msecs.
        There are no global variables etc used. In thread function, there are lots of for loops, big array operations (array sizes are around250000 byte). What can be the problem..
        regards

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

        @caner
        As @jsulm says. And additionally without any knowledge about hardware, as well as OS resources etc., why should running multiple threads be any faster than single thread?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SimonSchroeder
          wrote on last edited by
          #4

          QtConcurrent::run does not create 8 threads. It puts 8 tasks in a queue to be run in parallel. Underlying this is a thread pool which correlates with the number of cores. If you have only 4 (logical) cores, only 4 threads will run in parallel.

          Two general problems immediately come to mind. 1) You are using the future and wait for the result immediately after each call of QtConcurrent::run. 2) You are doing some synchronization, e.g. using mutexes. If you want help, you need to show your code.

          1 Reply Last reply
          1
          • Ketan__Patel__0011K Offline
            Ketan__Patel__0011K Offline
            Ketan__Patel__0011
            wrote on last edited by
            #5

            You can see the following youtube Videos which is related to Qt Concurrent Moudle And Qt Threading Functionality.

            https://www.youtube.com/playlist?list=PLh0cogPqXcJN-VKY6M6beid92rBHgIN1u

            1 Reply Last reply
            0

            • Login

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