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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:54:53+00:00 2026-05-16T13:54:53+00:00

Does python threading expose issues of memory visibility and statement reordering as Java does?

  • 0

Does python threading expose issues of memory visibility and statement reordering as Java does? Since I can’t find any reference to a “Python Memory Model” or anything like that, despite the fact that lots of people are writing multithreaded Python code, I’m guessing that these gotchas don’t exist here. No volatile keyword, for instance. But it doesn’t seem to be stated explicitly anywhere that, for instance, a change in a variable in one thread is immediately visible to all other threads.

Maybe this stuff is all very obvious to Python programmers, but as a fearful Java programmer, I require a little extra reassurance 🙂

  • 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-05-16T13:54:54+00:00Added an answer on May 16, 2026 at 1:54 pm

    There is no formal model for Python’s threading (hey, after all, there wasn’t one for Java’s for years… hopefully, one will also eventually be written for Python).

    In practice, no Python implementation performs any advanced optimization such as statement reordering or temporarily treating shared variables as thread-local ones — and you can count on these semantics constraints even though they are not formally assured.

    CPython in particular, as @Rawheiser’s mention, uses a global interpreter lock; other implementations (PyPy, IronPython, Jython, …) do not (so they can use multiple cores effectively with a threading model, while CPython requires multi-processing for the same purpose), so you should not count on that if you want to write code that’s portable throughout Python implementations. (So, you shouldn’t count on the “atomicity” of operations that only happen to be atomic in CPython because of the GIL, such as dictionary accesses — in other Python implementations, multiple threads might be modifying a dict at once and cause errors unless you protect the dict with a lock or the like).

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

Sidebar

Related Questions

Does the presence of python GIL imply that in python multi threading the same
Does python support random json serialization? I get this error: Traceback (most recent call
Does python have immutable lists? Suppose I wish to have the functionality of an
Does python create a completely new string (copying the contents) when you do a
Does Python have a built-in, simple way of encoding/decoding strings using a password? Something
Does Python have a pool of all strings and are they (strings) singletons there?
Does Python offer a way to iterate over all consecutive sublists of a given
Does Python support short-circuiting in boolean expressions?
(I'm sure this is a FAQ, but also hard to google) Why does Python
EPD python does not know to look for the Ubuntu repository python so installing

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.