Kavya Joshi - A tale of concurrency through creativity in Python: a deep dive into how gevent works.

  Рет қаралды 14,211

PyCon 2016

PyCon 2016

Күн бұрын

Speaker: Kavya Joshi
gevent is an open source Python library for asynchronous I/O. It provides a powerful construct to build concurrent applications; think threads, except lightweight and cooperatively scheduled. We will delve into how gevent is architected from its building blocks - sophisticated coroutines, an event loop, and a dash of creativity to neatly integrate them.
Slides can be found at: speakerdeck.co... and github.com/PyC...

Пікірлер: 19
@michaeljuliano8839
@michaeljuliano8839 Жыл бұрын
Perfect. This gave me exactly the information I needed to decide how to proceed on what I want to do. I’m not sure why we need stack slicing to implement green threads when we have the yield keyword. It’s technically for generator functions, but those are just a special case of coroutine. It’s a perfectly viable option for implementing greenlets, as far as I can tell.
@Zweckon
@Zweckon 5 жыл бұрын
Very good structured presentation and a good explanation of under the hood mechanics.
@chuckturco774
@chuckturco774 8 жыл бұрын
Excellent presentation. Very clear and technically deep.
@shivashankararadi
@shivashankararadi 7 жыл бұрын
very neat deep dive
@sortof3337
@sortof3337 3 жыл бұрын
I am using it for my work.
@princeroshan4105
@princeroshan4105 Жыл бұрын
Does Cpython provide an API to access(maybe a read-only access) to the C-Stacks and heap?
@sagnikbhattacharya1202
@sagnikbhattacharya1202 3 жыл бұрын
Kavya: They wrote assembly code that removes and restores the stack from under the CPython interpreter's nose, isn't that cool! Me: Not so cool when you have to debug that lmfao. Awesome talk tho :D
@nikunj204
@nikunj204 7 жыл бұрын
Great presentation
@en8042
@en8042 Жыл бұрын
so, if greenlet_1 will overwrite greenlet_2's stack when it runs again, next time greenlet_2 wants to run, its saved stack needs to be copied back to the stack from the heap, right? It looks like to me that the first greenlet to run will be a priviliged greenlet in a sense, that it doesn't need copying or whatsoever, hence it will run a bit faster than the others. Also what's the point in saving the base stack pointer for greenlet_2 if that area can easily be overwritten by greenlet_1?
@randixlai9216
@randixlai9216 6 жыл бұрын
it's too hard for me to understand..
@MultiSosnooley
@MultiSosnooley 8 жыл бұрын
GIL does not block threads when IO.
@yuriyl1747
@yuriyl1747 5 жыл бұрын
She never said that
@guangtongshen7007
@guangtongshen7007 3 жыл бұрын
Is there anything similar in Java, that can make a network call without blocking the thread?
@guangtongshen7007
@guangtongshen7007 3 жыл бұрын
Learning Kotlin coroutine recently and I looking at this video again. I got another question - Coroutines should not block its thread. Can two greenlets send out two IO operations concurrently without blocking each other?
@guangtongshen7007
@guangtongshen7007 3 жыл бұрын
Answer my own question: the socket is nonblocking. we just need one thread for event loop. A greenlet being ready is registered as an event. An HTTP request registers READABLE event with a callback. The callback is the greenlet.switch() which makes a greenlet ready to run. Other ready greenlets run in the eventloop while waiting for that HTTP response. Coroutines are all in the same thread as the event loop.
@MultiSosnooley
@MultiSosnooley 8 жыл бұрын
asyncio is not based on callbacks (in user space).
@llanga
@llanga 8 жыл бұрын
It is fully based on callbacks. There's nothing else that the event loop interacts with. Coroutines are wrapped in Task instances which schedule _step callbacks (a trampoline pattern).
@pegasus7167
@pegasus7167 6 жыл бұрын
小姐姐太可爱了
@aharongina5226
@aharongina5226 6 жыл бұрын
lecturer should have better understanding of python threading, no solution was presented
"What is a Coroutine Anyway?" - John Reese (North Bay Python 2019)
30:27
North Bay Python
Рет қаралды 27 М.
А что бы ты сделал? @LimbLossBoss
00:17
История одного вокалиста
Рет қаралды 10 МЛН
Seja Gentil com os Pequenos Animais 😿
00:20
Los Wagners
Рет қаралды 32 МЛН
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 20 МЛН
gevent: asynchronous I/O made easy
44:01
EuroPython 2014
Рет қаралды 10 М.
Thomas Ballinger - Finding closure with closures - PyCon 2016
31:06
Jake Vanderplas - Statistics for Hackers - PyCon 2016.mp4
40:45
PyCon 2016
Рет қаралды 84 М.
G.  Peretin - Greenlet based concurrency
41:10
EuroPython Conference
Рет қаралды 2,4 М.
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel (kiwi)
Рет қаралды 200 М.
А что бы ты сделал? @LimbLossBoss
00:17
История одного вокалиста
Рет қаралды 10 МЛН