Non-blocking mode I/O either transfers at least one byte or returns immediately with an error or end of stream. Non-blocking algorithms refer to use of concurrency without the usual mutual exclusion primitives, guaranteeing that thread operations will not block indefinitely. This is usually handled with atomic value modification (increment/decrement) and/or reading (compare-and-exchange) operations.. It isn't clear which this tag is intended for.
Questions tagged [nonblocking]
1597 questions
620
votes
31 answers
A non-blocking read on a subprocess.PIPE in Python
I'm using the subprocess module to start a subprocess and connect to its output stream (standard output). I want to be able to execute non-blocking reads on its standard output. Is there a way to make .readline non-blocking or to check if there is…

Mathieu Pagé
- 10,764
- 13
- 48
- 71
188
votes
11 answers
Simplest way to do a fire and forget method in C#?
I saw in WCF they have the [OperationContract(IsOneWay = true)] attribute. But WCF seems kind of slow and heavy just to do create a nonblocking function. Ideally there would be something like static void nonblocking MethodFoo(){}, but I don't…

MatthewMartin
- 32,326
- 33
- 105
- 164
176
votes
16 answers
Is asynchronous jdbc call possible?
I wonder if there is a way to make asynchronous calls to a database?
For instance, imagine that I've a big request that take a very long time to process, I want to send the request and receive a notification when the request will return a value (by…

Steve Gury
- 15,158
- 6
- 38
- 42
154
votes
2 answers
What is non-blocking or asynchronous I/O in Node.js?
In the context of Server Side Javascript engines, what is non-blocking I/O or asynchronous I/O? I see this being mentioned as an advantage over Java server side implementations.

Anand
- 2,329
- 4
- 19
- 25
144
votes
9 answers
Is non-blocking I/O really faster than multi-threaded blocking I/O? How?
I searched the web on some technical details about blocking I/O and non blocking I/O and I found several people stating that non-blocking I/O would be faster than blocking I/O. For example in this document.
If I use blocking I/O, then of course the…

yankee
- 38,872
- 15
- 103
- 162
98
votes
5 answers
What's the difference between: Asynchronous, Non-Blocking, Event-Base architectures?
What's the difference between:
Asynchronous,
Non-Blocking, and
Event-base architectures?
Can something be both asynchronous and non-blocking (and event-based)?
What's most important in programming, to have something: asynchronous, non-blocking…

nickb
- 9,140
- 11
- 39
- 48
95
votes
11 answers
C non-blocking keyboard input
I'm trying to write a program in C (on Linux) that loops until the user presses a key, but shouldn't require a keypress to continue each loop.
Is there a simple way to do this? I figure I could possibly do it with select() but that seems like a lot…

Zxaos
- 7,791
- 12
- 47
- 61
88
votes
2 answers
When and how to use Tornado? When is it useless?
Ok, Tornado is non-blocking and quite fast and it can handle a lot of standing requests easily.
But I guess it's not a silver bullet and if we just blindly run Django-based or any other site with Tornado it won't give any performance boost.
I…

Vladimir Sidorenko
- 4,265
- 3
- 19
- 13
88
votes
5 answers
non-blocking IO vs async IO and implementation in Java
Trying to summarize for myself the difference between these 2 concepts (because I'm really confused when I see people are using both of them in one sentence, like "non-blocking async IO" which I'm trying to figure out what does it mean).
So, in my…

Aliaksandr Kazlou
- 3,221
- 6
- 28
- 34
88
votes
4 answers
What does Python's socket.recv() return for non-blocking sockets if no data is received until a timeout occurs?
Basically, I've read in several places that socket.recv() will return whatever it can read, or an empty string signalling that the other side has shut down (the official docs don't even mention what it returns when the connection is shut down...…

El Ninja Trepador
- 1,013
- 1
- 10
- 14
78
votes
12 answers
Polling the keyboard (detect a keypress) in python
How can I poll the keyboard from a console python app? Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):
while True:
# doing amazing pythonic…

K. Brafford
- 3,755
- 2
- 26
- 30
67
votes
1 answer
Why does a read-only open of a named pipe block?
I've noticed a couple of oddities when dealing with named pipes (FIFOs) under various flavors of UNIX (Linux, FreeBSD and MacOS X) using Python. The first, and perhaps most annoying is that attempts to open an empty/idle FIFO read-only will block…

Jim Dennis
- 17,054
- 13
- 68
- 116
61
votes
2 answers
Will Go block the current thread when doing I/O inside a goroutine?
I am confused over how Go handles non-blocking I/O. Go's APIs look mostly synchronous to me, and when watching presentations on Go, it's not uncommon to hear comments like "and the call blocks".
Is Go using blocking I/O when reading from files or…

Roger Johansson
- 22,764
- 18
- 97
- 193
59
votes
2 answers
Blocking IO vs non-blocking IO; looking for good articles
Once upon a time I bumped into Introduction to Indy article and can't stop thinking about blocking vs non-blocking IO ever since then.
Looking for some good articles describing what are pros and cons of blocking IO and non-blocking IO and how to…

Piotr Dobrogost
- 41,292
- 40
- 236
- 366
57
votes
2 answers
using Flask and Tornado together?
I am a big fan of Flask - in part because it is simple and in part because has a lot of extensions. However, Flask is meant to be used in a WSGI environment, and WSGI is not a non-blocking, so (I believe) it doesn't scale as well as Tornado for…

Abdelouahab
- 7,331
- 11
- 52
- 82