Ron Pressler - Why user-mode threads are (often) the right answer

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 8

  • @pasxizeis
    @pasxizeis 2 года назад

    Can someone explain at 42:06, what does it mean that "it percolate all the way up the stack" and why is that so?

    • @Esran02
      @Esran02 2 года назад

      It means that if you have this code:
      int foo() { bar(); baz() }
      int bar() { ... }
      int baz() { ... }
      it is regular synchronous code with 0 interleaving points. Let's say bar wants to do IO, and you don't want the thread running foo to block waiting for it. With async-await, you can mark bar async. This will not compile however
      int foo() { await bar(); baz() }
      async Task bar() { ... }
      int baz() { ... }
      You have to instead do this:
      async Task foo { await bar(); baz() }
      async Task bar() { ... }
      int baz() { ... }
      This means that because you want to make bar async, you have to also make foo async. Because you made foo async, you have to make any callers of foo async and so on.

  • @user72974
    @user72974 3 года назад

    Watched this when it was posted and for some reason forgot to leave a comment back then. This video is fantastic. I've never before felt like I understood ways to implement concurrency so deeply. I love exploring topics like "Why did Node.js add async/await?" When you were talking about how the "await" points end up being points where the program yields to the runtime, I started to think "Why would C# use that? Don't they have threads? Couldn't they handle scheduling like Java is?" and it was funny seeing you talk about that at the end of the video.

  • @allanwind295
    @allanwind295 2 года назад

    Those notifications are super annoying.

  • @obinnaokafor6252
    @obinnaokafor6252 2 года назад

    the presenter does not know why C# implemented async/ await.

    • @user72974
      @user72974 Год назад

      I found that part of the video interesting. What do you think they got wrong about that?

    • @obinnaokafor6252
      @obinnaokafor6252 Год назад

      @@user72974 async / await has been copied by almost other language ecosystem.

    • @zhamed9587
      @zhamed9587 Год назад

      @@obinnaokafor6252 Incidentally, the C# folks are having talks about implementing user threads.