3 ms·
On the interpreter side, most of the I/O read time is waiting for an OS buffer to fill with the right amount of data. Waiting happens to occur "in parallel" whe
by nine_k 9y ago
On the interpreter side, most of the I/O read time is waiting for an OS buffer to fill with the right amount of data. Waiting happens to occur "in parallel" when using async I/O.
I suppose that sending is similar: you pass the OS a buffer, and wait for completion. Sending of the data occurs while you wait.
So, if you can parallelize waits, the OS could be doing strictly parallel I/O for you (e.g. via two network interfaces, or network and disk), even though your code is concurrent but not parallel, and you don't run two sync OS I/O calls in parallel.
- zzzeek 9y ago> Waiting happens to occur "in parallel" when using async I/O. > and you don't run two sync OS I/O calls in parallel. you can run sync IO calls and wait for each in separate threads. the GIL is released for IO. the waiting is "in parallel" just as much with a threaded / blocking approach as with a non-blocking.
- barrkel 9y agoWaiting for multiple concurrent things to complete isn't parallelism, in the on-topic jargon meaning of the term. Parallelism is things physically being executed simultaneously, increasing throughput via physically multiple resources. The multiple IOs you're waiting on might be executing in parallel if you have e.g. a RAID array or SAN in the loop, but it's an implementation detail and isn't what the article is about.