than one thread might attempt to update the same variable at the same timethe threads should generally be given exclusive access to the object with locks otherwiseit' not impossible that thread switches will occur in the middle of an update statement' bytecode locks are not strictly required for all shared object accessespecially if single thread updates an object inspected by other threads as rule of thumbthoughyou should generally use locks to synchronize threads whenever update rendezvous are possible instead of relying on artifacts of the current thread implementation the thread switch interval some concurrent updates might work without locks if the thread-switch interval is set high enough to allow each thread to finish without being swapped out the sys setcheckinterval(ncall sets the frequency with which the interpreter checks for things like thread switches and signal handlers this interval defines the number of bytecode instructions before switch it does not need to be reset for most programsbut it can be used to tune thread performance setting higher values means switches happen less oftenthreads incur less overhead but they are less responsive to events setting lower values makes threads more responsive to events but increases thread switch overhead atomic operations because of the way python uses the gil to synchronize threadsaccess to the virtual machinewhole statements are not generally thread-safebut each bytecode instruction is because of this bytecode indivisibilitysome python language operations are threadsafe--also called atomicbecause they run without interruption--and do not require the use of locks or queues to avoid concurrent update issues for instanceas of this writinglist appendfetches and some assignments for variableslist itemsdictionary keysand object attributesand other operations were still atomic in standard pythonotherssuch as + (and any operation in general that reads datamodifies itand writes it backwere not as mentioned earlierthoughrelying on these rules is bit of gamblebecause they require deep understanding of python internals and may vary per release indeedthe set of atomic operations may be radically changed if new free-threaded implementation ever appears as rule of thumbit may be easier to use locks for all access to global and shared objects than to try to remember which types of access may or may not be safe across multiple threads api thread considerations finallyif you plan to mix python with calso see the thread interfaces described in the python/ api standard manual in threaded programsc extensions must release parallel system tools