Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7964699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:57:13+00:00 2026-06-04T05:57:13+00:00

I wrote a small program to evaluate the state of cellular automata and paint

  • 0

I wrote a small program to evaluate the state of cellular automata and paint it on the screen. I have dual-core PC, so in order to increase efficiency I decided to make calculations in two threads. I made my own implementations of QThread, like so:

clacc MyThread(QThread):
    def run(self):
        ...

Then I’m making two instances of this class and calling them:

thread1 = MyThread()
thread2 = MyThread()

thread1.start()
thread2.start()

When I opened the Task Manager, I found that they’re executing one after another: thread1 first, then thread2, then thread1 again and so on.
Question is: is there a way to invoke them so they will work independently, on different cores and in one moment of time, not one after another?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:57:14+00:00Added an answer on June 4, 2026 at 5:57 am

    If you use threads, you can’t increase efficiency as you wish, because it won’t do paarallelization. You need to do multiprocessing. To do that, you can use the mulltiprocessing module, which works like threading module :

    import multiprocessing
    
    class MyProcess(multiprocessing.Process):
    
        def run(self):
            # new process context
    

    You won’t share the same context so you can’t communicate directly by methods calls. I advise you to use some “message queue” system like : multiprocessing.Queue or zeromq (great great lib !).

    If you look at “Ventillator” zmq design pattern you’ll see it do exactly what you need : paralellize workers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small program wrote in Prolog. At the moment I can print
I have a small python program I wrote for a friend, one of the
I wrote a small program, that creates files at an interval of 1 minute.
I wrote a small program to test accessing a widget parent's slot. Basically, it
I wrote this small C++ program and built it(Release) #include<iostream> int main(){ std::cout<<Hello World;
So I wrote a project-management program for a small business using Microsoft Access 2007.
I wrote a small program using a custom indexOf function but wanted to dismiss
I wrote a small program in VS2005 to test whether C++ global operator new
I wrote a small program that uses Mechanize to traverse a site. I want
I wrote this small program to find all occurrences of a substring in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.