threading

Chris Angelico rosuav at gmail.com
Wed Apr 9 12:25:43 EDT 2014


On Thu, Apr 10, 2014 at 2:14 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 4/9/2014 10:30 AM, Frank Millman wrote:
>
>> In other words, non-blocking implies that everything required to pass off
>> the request to a handler and be ready to deal with the next one must
>> already
>> be in memory, and it must not rely on communicating with any outside
>> resource at all. Is this correct?
>
>
> Chris said no, I would have said yes, but I think we understand the above
> differently.

I said no because I see asynchronous I/O as a perfectly viable
structure for a program, which means that a non-blocking handler is
allowed to communicate with outside resources. Conversely, if you see
"a non-blocking handler" as meaning the one small piece that runs
uninterruptibly, then you might say that yes, it must not rely on any
outside resource.

Of course, it depends on where you're looking. Memory is itself an
outside resource that can potentially take a long time to give a
result - just look at what happens when you dip into swap space, and
RAM accesses become disk accesses. But generally, you go asynchronous
in order to increase your throughput; and if you're churning through
your page file, well, that's going to kill throughput whichever way
you look at it. It's generally safe enough to pretend that RAM can be
accessed in-line, and worry about the slowdowns elsewhere.

ChrisA



More information about the Python-list mailing list