Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12587

RE: Python thread

From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Date 2011-09-01 18:21 -0400
Subject RE: Python thread
References <j3ov0b$40l$1@dough.gmane.org> <CA85C0D1.88C3%mydevgroup@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.669.1314915717.27778.python-list@python.org> (permalink)

Show all headers | View raw


>So what exactly does threading module do, if it doesn't create a subprocess.
>Does each thread have its own stack and PC.
>What advantage would a threading module provide over sequential execution.

I believe it merely simulates multiple processes through scheduling (like the CPU).

From http://docs.python.org/library/threading.html: CPython implementation detail: Due to the Global Interpreter Lock, in CPython only one thread can execute Python code at once (even though certain performance-oriented libraries might overcome this limitation). If you want your application to make better of use of the computational resources of multi-core machines, you are advised to use multiprocessing. However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423




This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: Python thread "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2011-09-01 18:21 -0400

csiph-web