7 ms·
All gevent code written today assumes that between I/O events all actions will happen atomically with respect to the rest of the program. That means you can sa
by sausagefeet 15y ago
All gevent code written today assumes that between I/O events all actions will happen atomically with respect to the rest of the program. That means you can safely do any multi-step operation on a shared resource you want without issue. The second you want to run 2 gevent threads in parallel this guarantee goes out the window. Gevent could be modified for multicore suppor if Python got it, but that still breaks every piece of gevent code written today. This is the same problem Twisted and Tornado have.
- j2labs 15y agoGevent wasn't designed for multicore because it doesn't exist today. It's fair to assume some work would have to be done to continue using it safely. Edit: Solve the problems you actually have.
- sausagefeet 15y agoAnd that's exactly my point, the entire framework doesn't scale to multicore without a lot of work, just like callbacks. Which was my initial claim.
- j2labs 15y agoThat's entirely dependent on what the work being done is. It's typical for gevent users to use the built-in queue systems to pass messages between coroutines, similar to Erlang's actor model. I do t believe a lot of work would be required if gevent users stuck to this style, as gevents docs suggest.
- sausagefeet 15y agoThe guarantees of the framework no longer exist when you want to do things in parallel. Sure, not every line of code using gevent would break from this, but that's not the point. Even people using queues are often still playing with shared resources, which would be unsafe in multicore still.
- j2labs 15y agoYou, my friend, have made excellent points and I yield to you now. I hope this conversation is informative for readers.