stackoverflow and c.l.py (was: GIL switch interval)

S

Stefan Behnel

Matt Joiner, 14.09.2011 04:23:
i'm curious as to what can be done with (and handled better) by
adjusting sys.setswitchinterval
i've opened a question on SO for this, that people might find of
interest: http://stackoverflow.com[...]

I wonder why people ask this kind of question on stackoverflow, and then
come here asking people to go over there, read the question, and
(potentially) provide an answer.

IMHO, c.l.py is a much better place to ask Python(-related) questions than
stackoverflow. It's also a much better place to search for an answer that
is already available in the archives.

Stefan
 
S

Steven D'Aprano

Matt Joiner, 14.09.2011 04:23:
i'm curious as to what can be done with (and handled better) by
adjusting sys.setswitchinterval
i've opened a question on SO for this, that people might find of
interest: http://stackoverflow.com[...]

I wonder why people ask this kind of question on stackoverflow, and then
come here asking people to go over there, read the question, and
(potentially) provide an answer.

You should post that question on stackoverflow, and ask them to reply here.
 
E

Ethan Furman

Steven said:
Matt Joiner, 14.09.2011 04:23:
i'm curious as to what can be done with (and handled better) by
adjusting sys.setswitchinterval
i've opened a question on SO for this, that people might find of
interest: http://stackoverflow.com[...]
I wonder why people ask this kind of question on stackoverflow, and then
come here asking people to go over there, read the question, and
(potentially) provide an answer.

You should post that question on stackoverflow, and ask them to reply here.

+10!
 
R

Roy Smith

Duncan Booth said:
If you want an answer to how to get a specific bit of code to work then
Stackoverflow is better if only because people can see who has already
answered so don't need to waste time re-answering every trivial little
question about syntax.

Any halfway decent newsreader application will follow threading and put
all the responses to a given question in one place. Of course, this is
a relatively new feature. If your newsreader is any older than about
the mid 1980's, it may not be able to do this.

Stefan Behnel said:
I wonder why people ask this kind of question on stackoverflow, and then
come here asking people to go over there, read the question, and
(potentially) provide an answer.

If you ask here you will probably get the correct answer to your
question (along with some deep dives into related topics, which are
often more valuable than the original answer). If you ask on SO, you
may also get the correct answer, but in addition you will earn SO karma
points. Maybe even some neat badge. I guess it all depends on what
your goal is.

Obligatory GIL comment -- I wrote some code the other day that used 4
threads to perform 4 I/O bound operations (fetching 4 jpegs in parallel
over http). I figured the fact that they were I/O bound would avoid any
GIL problems. I was shocked and dismayed, however, to find that the 4
operations all got serialized. I guess I really didn't understand how
the GIL worked after all.

So, I rewrote it to use the multiprocessing module. Egads, still
serialized! To make a long story short, it turns out we were using some
crappy consumer-grade Linksys box as our DNS server, and *it* was single
threaded. My 4 threads were blocking on name resolution!

We moved to using a real nameserver, and I converted the code back to
using threading. Works like a charm now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top