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

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.com/pycon2016 and github.com/PyCon/2016-slides

Пікірлер: 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.

  • @chuckturco774
    @chuckturco7747 жыл бұрын

    Excellent presentation. Very clear and technically deep.

  • @shivashankararadi
    @shivashankararadi7 жыл бұрын

    very neat deep dive

  • @Zweckon
    @Zweckon4 жыл бұрын

    Very good structured presentation and a good explanation of under the hood mechanics.

  • @nikunj204
    @nikunj2047 жыл бұрын

    Great presentation

  • @sortof3337
    @sortof33373 жыл бұрын

    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?

  • @MultiSosnooley
    @MultiSosnooley8 жыл бұрын

    GIL does not block threads when IO.

  • @yuriyl1747

    @yuriyl1747

    5 жыл бұрын

    She never said that

  • @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
    @randixlai92165 жыл бұрын

    it's too hard for me to understand..

  • @guangtongshen7007
    @guangtongshen70073 жыл бұрын

    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
    @MultiSosnooley8 жыл бұрын

    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).

  • @sagnikbhattacharya1202
    @sagnikbhattacharya12023 жыл бұрын

    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

  • @pegasus7167
    @pegasus71676 жыл бұрын

    小姐姐太可爱了

  • @aharongina5226
    @aharongina52266 жыл бұрын

    lecturer should have better understanding of python threading, no solution was presented