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

Поділитися
Вставка
  • Опубліковано 20 сер 2024
  • 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 4 роки тому

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

  • @chuckturco774
    @chuckturco774 7 років тому

    Excellent presentation. Very clear and technically deep.

  • @shivashankararadi
    @shivashankararadi 7 років тому +1

    very neat deep dive

  • @sortof3337
    @sortof3337 3 роки тому

    I am using it for my work.

  • @nikunj204
    @nikunj204 7 років тому

    Great presentation

  • @sagnikbhattacharya1202
    @sagnikbhattacharya1202 3 роки тому +1

    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

  • @MultiSosnooley
    @MultiSosnooley 8 років тому +9

    GIL does not block threads when IO.

    • @yuriyl1747
      @yuriyl1747 5 років тому +4

      She never said that

  • @randixlai9216
    @randixlai9216 5 років тому +3

    it's too hard for me to understand..

  • @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?

  • @princeroshan4105
    @princeroshan4105 Рік тому

    Does Cpython provide an API to access(maybe a read-only access) to the C-Stacks and heap?

  • @MultiSosnooley
    @MultiSosnooley 8 років тому

    asyncio is not based on callbacks (in user space).

    • @llanga
      @llanga 8 років тому +2

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

  • @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 роки тому +1

      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.

  • @pegasus7167
    @pegasus7167 6 років тому +1

    小姐姐太可爱了

  • @aharongina5226
    @aharongina5226 6 років тому

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