GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 07:52:03 JST Drew DeVault Drew DeVault

    A good place to start is asking yourself, "what happens if my program is not blocking on read(2) on a network socket when a packet comes in"

    The answer is not that the router waits until you call read(2) to send it!

    In conversation Thursday, 11-Apr-2024 07:52:03 JST from fosstodon.org permalink
    • Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 07:59:59 JST Drew DeVault Drew DeVault
      in reply to
      • miki

      @miki bzzzzzt, wrong

      You want I/O multiplexing to address this case, which is not the same thing as async I/O.

      In conversation Thursday, 11-Apr-2024 07:59:59 JST permalink
      Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      miki (miki@dragonscave.space)'s status on Thursday, 11-Apr-2024 08:00:00 JST miki miki
      in reply to

      @drewdevault I'd disagree here, a program can be I/O bound (let's say small requests to a slow service / on a slow network), but you might still want to e.g. accept input from the user while the slow service is doing its thing. If you don't have threads or async i/o, you're waiting on the network while the user thinks your program is broken.

      In conversation Thursday, 11-Apr-2024 08:00:00 JST permalink
    • Embed this notice
      Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 08:00:01 JST Drew DeVault Drew DeVault
      in reply to

      One last tip: the purpose of async I/O is to give the CPU back to your program while the I/O operation completes. But if you don't have a plan for what to do with the CPU while you have it, you don't need async I/O.

      In conversation Thursday, 11-Apr-2024 08:00:01 JST permalink
      Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 08:00:01 JST Drew DeVault Drew DeVault
      in reply to

      Async I/O is also often used for I/O multiplexing, which is when you have more than one source of I/O and want to have several I/O operations in flight at the same time, but otherwise you don't need the CPU while they work. You don't need async I/O for that, you need poll(2).

      In conversation Thursday, 11-Apr-2024 08:00:01 JST permalink
    • Embed this notice
      Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 08:00:01 JST Drew DeVault Drew DeVault
      in reply to

      And finally, if your program is I/O bound then you don't need threads.

      In conversation Thursday, 11-Apr-2024 08:00:01 JST permalink
      Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 08:00:02 JST Drew DeVault Drew DeVault
      in reply to

      Also, I can count on one hand the number of programmers I trust to use O_NONBLOCK

      In conversation Thursday, 11-Apr-2024 08:00:02 JST permalink
    • Embed this notice
      Drew DeVault (drewdevault@fosstodon.org)'s status on Thursday, 11-Apr-2024 08:00:06 JST Drew DeVault Drew DeVault
      in reply to
      • Multi

      @multisn8 lol

      for my next pro-tip, don't support windows

      In conversation Thursday, 11-Apr-2024 08:00:06 JST permalink
      Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      Multi (multisn8@peoplemaking.games)'s status on Thursday, 11-Apr-2024 08:00:07 JST Multi Multi
      in reply to

      @drewdevault ¹except if they turn out useful in edge-cases
      like installing lots of files and deferring the closing of those file handles to dedicated threads because Windows Defender™️

      e.g. rustup needed that: https://www.youtube.com/watch?v=qbKGw8MQ0i8

      In conversation Thursday, 11-Apr-2024 08:00:07 JST permalink

      Attachments

      1. "NTFS really isn't that bad" - Robert Collins (LCA 2020)
        from linux.conf.au
        Robert Collinshttps://lca2020.linux.org.au/schedule/presentation/38/Why was rustup slow (3m30s to install (not including download time)) in early 2019 on Win...
    • Embed this notice
      _L4NyrlfL1I0 (yrlf@graz.social)'s status on Thursday, 11-Apr-2024 19:18:41 JST _L4NyrlfL1I0 _L4NyrlfL1I0
      in reply to
      • cuddle
      • miki

      @cuddle @drewdevault @miki

      Disclaimer: I'm mostly extrapolating from code I've read, articles I've read, a few personal projects that attempt to not needlessly block, and a few experiments with the various APIs.

      It might very well be that my understanding of this is incomplete, lacking, or wrong. If anyone here has more experience, feel free to correct me as I'd like to know more about this as well.

      In conversation Thursday, 11-Apr-2024 19:18:41 JST permalink

      Attachments

      1. Domain not in remote thumbnail source whitelist: APIs.It
        Shiatsu: APIS Associazione Professionale Italiana Shiatsu - Terapie naturali, Linfodrenaggio, Riflessologia Plantare, massaggi shiatzu - Homepage
        from A.P.I.S. Associazione Professionale Italiana Shiatsu - Namikoshi Shiatsu Europe - Italia
        L'APIS Associazione Professionale Italiana Shiatsu riunisce operatori e terapisti italiani che utilizzano la tecnica originale di digitopressione shiatsu metodo Tokujiro Namikoshi. È la sezione italiana della European Shiatsu Association, fondata nel 1993 da Toru Namikoshi e Denis J. Binks. Come organo di formazione si avvale della Scuola Italo-Giapponese Shiatsu Namikoshi, sezione dell'Istituto Italiano di Terapie Naturali
      Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      _L4NyrlfL1I0 (yrlf@graz.social)'s status on Thursday, 11-Apr-2024 19:18:42 JST _L4NyrlfL1I0 _L4NyrlfL1I0
      in reply to
      • cuddle
      • miki

      @cuddle @drewdevault @miki

      On POSIX/Linux, AFAIK the only "real" low-level async I/O API that exists is IO uring (you put work in the ring and it completes at some point in the future). All other APIs are basically variations on the I/O multiplexing model (poll() / epoll() / select()).

      There is O_NONBLOCK, but all that does IIUC (correct me if I'm wrong) is to make sure that I/O calls return EAGAIN when too much work is posted at once to do it without blocking, and you need to poll() it again

      In conversation Thursday, 11-Apr-2024 19:18:42 JST permalink
    • Embed this notice
      _L4NyrlfL1I0 (yrlf@graz.social)'s status on Thursday, 11-Apr-2024 19:18:43 JST _L4NyrlfL1I0 _L4NyrlfL1I0
      in reply to
      • cuddle
      • miki

      @cuddle @drewdevault @miki

      Even in Async I/O you don't have infinite work to do. At some point you will run out of useful work to do while waiting and you will need to block on I/O (otherwise you will needlessly spin the CPU)

      With I/O multiplexing it's the same: you will repeatedly call poll() / epoll() / select() on your file descriptors, and as long as you still have useful work to do while waiting you can pass the timeout as 0 and it will not block if no fd is ready at this point.

      1/2

      In conversation Thursday, 11-Apr-2024 19:18:43 JST permalink
    • Embed this notice
      cuddle (cuddle@mastodon.bsd.cafe)'s status on Thursday, 11-Apr-2024 19:18:45 JST cuddle cuddle
      in reply to
      • miki
      • _L4NyrlfL1I0

      @yrlf @drewdevault @miki isn't the entire async I/O means it wouldn't do the blocking? Whereas I/O multiplexing does blocks the process and continuously check for event on the file descriptor

      In conversation Thursday, 11-Apr-2024 19:18:45 JST permalink
    • Embed this notice
      _L4NyrlfL1I0 (yrlf@graz.social)'s status on Thursday, 11-Apr-2024 19:18:46 JST _L4NyrlfL1I0 _L4NyrlfL1I0
      in reply to
      • miki

      @drewdevault how exactly does async I/O differ from I/O multiplexing in your understanding?

      I/O multiplexing is IIUC having a single thread of execution and using poll() / epoll() / select() / ... to periodically check which I/O is ready and then handling that (either directly or via callbacks). Most nontrivial programs that do that do it via callbacks and an event loop.

      1/2

      @miki

      In conversation Thursday, 11-Apr-2024 19:18:46 JST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.