Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61755
| References | <6si4t0hdjeddqflqos0hd9tu.1386835600560@email.android.com> |
|---|---|
| Date | 2013-12-12 13:15 -0800 |
| Subject | Re: |
| From | Dan Stromberg <drsalists@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4024.1386882907.18130.python-list@python.org> (permalink) |
On Thu, Dec 12, 2013 at 12:06 AM, marcinmltd <marcinmltd@gmail.com> wrote: > Hello, > > I'm big fan of multiprocessing module, but recently I started looking at > threading in Python more closely and got couple of questions I hope You can > help me with: > > 1. When I run two or more threads in my python process are they really run > concurrently on mulicore machine? > > 2. Browsing through documentation it looks like python interpreter protects > its sensitive states by using GIL. Can you guys list situations when this > happens? > > 2. What would be general advice from python experts on when to use threadng > and when switch to multliprocessing in python? Is the decision still > influenced by how often we need to comunicate between the tasks as it's in > C\C++? Jython and IronPython reportedly thread well generally. CPython threads I/O-bound tasks well, but as soon as you introduce one CPU-bound thread, the other threads start to have problems. Pypy is probably the same as CPython, at least until they get their STM working well. Multiprocessing can do CPU-bound and I/O-bound workloads, but starting a new process takes longer than starting a new thread (especially on Windows). Inter-thread/process communication is likely slower on multiprocessing than multithreading as well, but this is merely my inference. Note: CPython is what a lot of people call "Python"; CPython is a new term for the original implementation to distinguish it from the other implementations that exist today.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Dan Stromberg <drsalists@gmail.com> - 2013-12-12 13:15 -0800
csiph-web