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 8266505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:11:07+00:00 2026-06-08T05:11:07+00:00

1) I have read that if I import the threading module in python, CPU

  • 0

1) I have read that if I import the threading module in python, CPU bound loads won’t see much benefit from using this library because the GIL forces threads to run 1 at a time even if I run code on a multi-core machine. If this is the case what sort of code would benefit from using Python’s threading library?

2) If that’s the case for the threading library, then to perform CPU intensive tasks in parallel, such as cross-correlations of two signals, is the multiprocessing module the best module to use?

To make this more concrete, let’s say the task I’d like to parallelize is the for loop in the following code, and my machine has only 12 cores. Suppose my template has a length of ~1000, my image has a length of ~2000 and I have ~1000 signals to sort through:

import numpy as np

###2-D array of shape (points, signals)
signals = np.load('signals.npy')

###1-D template array for cross correlation
templateSignal = np.load('template.npy')

for s in range(signals.shape[2]):
    xcorr = np.correlate(templateSignal, signal[:,s])
  • 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-08T05:11:09+00:00Added an answer on June 8, 2026 at 5:11 am

    Even with the GIL, threading in Python is useful because input/output operations don’t block the program. You can perform operations while waiting for the completion of a disk operation or while waiting for a network event.

    Threads also play a role in GUI applications, where a program can stay responsive to user input while performing calculations in the backgrounds (thanks @FogleBird)

    As for 2), you are correct in your assumption that you can spread CPU-intensive programs to multiple cores with the multiprocessing module. Be aware of the costs of communication between processes.

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

Sidebar

Related Questions

I have an application that imports data read from text files from a directory
I have read two recent posts that discuss Depends and Imports Upcoming NAMESPACE, Depends,
I have read that GLSL (specifically v1.0.17: my application is running under WebGL) compilers
I have read that in Java interfaces can't be instantiated ( in the documentation,
I have read that you should keep the number of connections in your database
I have read that for enabling the auto return I have to enable this
I have read that you can do it, but would this really improve performance
I have read that gwt-ext is slow and it seems too bulky. How does
I have read that 'Normal' ARM instructions are fixed length - 32 bits. And
I have read that LinkedHashMap has faster iteration speed than HashMap because its elements

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.