Threads for arr2036

  1. 2

    I’m an active developer on libkqueue. libkqueue is a userland translation library for Linux, Windows and Solaris.

    The author really misrepresents some of the capabilities of Linux. I’m going to use the proc filter here, as this is something i’ve been actively working on fixing in libkqueue for the past few weeks.

    kqueue’s proc filter can monitor any process (that the calling process has visibility of) for exit, fork, signal reception, execve, and reaping. pidfd can only be used to monitor direct children of the current process, and only for exit. netlink is the only equivalent functionality to proc on Linux and it is by no way as usable. You end drinking from the systemwide event hose (unless you feel like hand crafting some BFP rules), and that’s only after you jump through the hoops of getting the right CAP permissions.

    At the time of writing pidfd has only been in the kernel for about 2 years (first released in 5.3). You can pick it up just fine on ubuntu-20.04, but it’s absent on RHEL8. Before pidfd, if you had a program that wanted to be asynchronously notified of a process exiting, and you didn’t want to deal with netlink (or didn’t have the permissions to use it), you needed a horror like this. This code spawns a “waiter thread”, who’s only purpose is to wait for SIGCHLD, then go scan all the PIDs other threads in the process want to be notified about, and notify them (via eventfd), that the child process has exited. As you can imagine, this does not scale well.

    1. 2

      Just in case anyone else finds this useful… We’re doing C development on macOS using Make. One of the issues that we’ve run into, and may have now solved, is the awful performance of fork() on macOS, and the significant latency it adds when calling out to the shell from make files.

      A new load directive was added in gmake v4.x which allows you to load a dynamic library, and have it register C functions to extend the expansion keywords available.

      We’re currently splitting out the guts of our test harness utility into a separate library, and exposing the functionality as makefile expansions. We’ve found call overhead for a make expansion is about 7.8 microseconds, vs about 100ms for fork() (shell + ASAN + LSAN).

      Even for non-macOS users, avoiding the overhead of calling out to a script to do text mangling that requires functionality not provided with the builtin expansions, would be a definite bonus in large build systems.

      1. 2

        See .ONESHELL for avoiding excessive fork. It essentially executes each recipe in a single shell script. If you set the shellflag -e, the failure behavior is almost the same as original makefile.

      1. 6

        A month ago I switched to a remote job after working at a busy and social company for three years. There are many benefits in working remotely, but by far the most important drawback is that not having other people around for most of every working day is simply incredibly lonely.

        “Go out more” as advertised in this article seems to miss this point. Meeting people out of work hours doesn’t solve the unnatural state during the default day. If you see a chimpanzee spend most of his days in an isolated part of the forest, something is probably wrong with it. I think the same holds for humans.

        I would say that the only really healthy approach to remote work is to rent a space with a number of other remote workers (not necessarily from the same company) that you can get to know on a personal level. Which is what I’m lucky enough to be doing now.

        1. 21

          Comments like this always remind me of something I read a while ago. Someone said: “Introverts think extroverts are different. Extroverts think introverts are broken.”

          Most people I met are like you, but some of us aren’t. And I’ve been working mostly remotely with short interludes for more than a decade without ever experiencing loneliness.

          Totally agree with you that after work socializing is a poor substitute for those who need this social contact.

          1. 6

            I’m the same way. I’ve never been lonely, and I’ve worked remote for almost 4 years now. If anything, I probably know my coworkers better because there’s a bit more incentive to talk on slack since we are (mostly) all remote.

            1. 4

              I consider myself mostly an introvert. Still, being around people, even without interacting with them, almost seems like a necessity of life. I feel that especially for introverts, who are less likely to spontaneously catch up with people outside of work, the company of people during work is quite essential.

              Perhaps it is just a matter of getting used to a new situation, but so far it strikes me as odd that in discussions about remote work, this issue is usually brushed off with “get out more often!”.

              1. 6

                I feel similarly; I have always considered myself an introvert, and after 8 years of working in offices, I was really happy to accept a remote position.

                After two and a half years I started paying for a permanent desk in a coworking space in the city, because sitting in my home office in the suburbs all day was driving me crazy. I’d go out for a walk every day, usually have lunch out just to be out and about more, but it was still not enough. It’s been a year since I started working in the coworking space and every now and then I’ll have a reason to stay home (waiting for a package or getting something at home fixed), and it reminds me how lonely it is.

                (I’m glad not everyone has this experience! But I don’t think the divide is as clean cut as extrovert/introvert.)

                (edit: reading @technomancy’s comment below makes me realise the part where I’m working remotely across timezones — and indeed, in an “unpopular” timezone (UTC+10/11) — probably makes the biggest difference of all. I think it’d be much different if my team was in my timezone.)

            2. 7

              Why aren’t you interacting with your team? I’m on slack and have multiple video calls with teammates per day. It’s actually slightly better than being in the office, because the office creates the sense that if someone is not there (but working elsewhere) they’re inaccessible.

              1. 3

                I take issue with the assumption that multiple video calls a day is an appropriate level of interaction for all remote teams. It may work if you’re all working collaboratively on a small set of projects, but that definitely isn’t a given, and without the need for that level of collaboration and communication, it’d be hard to justify interrupting the work of the rest of your team to satisfy your personal social requirements.

                1. 2

                  Sometimes that’s not possible. I remoted from China for about three months when I was visiting my partner out there. The team was distributed in Europe and the Americas. The language barrier and the huge timezone difference were very isolating. Definitely started to go a bit crazy spending so much time alone, and I’m definitely on the more introverted side.

                  Now we’re in MXCD and it’s significantly better. Loads of (10+) co-working spaces within walking distance, whereas Guangzhou only had 2-3, with about an hour commute each way, and people are awake/online, so lots more slack based interaction.

                  We also have an apartment dog, which I would recommend to anyone if you’re animal inclined. It’s really nice having a doggy friend when working from the apt, and she provides a good incentive to take regular breaks instead of powering through the day.

                  1. 9

                    I remoted from China for about three months when I was visiting my partner out there. The team was distributed in Europe and the Americas.

                    Working with a team across a time zone difference is usually done remotely, but it’s a vastly different thing from working remotely with people in the same or adjacent time zones that it’s misleading to draw conclusions about one from experience in the other.

                    1. 2

                      There are multiple additive factors. Radical timezone differences, difficulty communicating with locals, and being physically isolated (working from a home office) all significantly contribute to a feeling of general isolation. It’s not just about being physically separate from your team.

                      The move from Guangzhou to Mexico City highlighted for me how each of those factors contributed to that feeling of loneliness, and how, as each one of them was addressed, remote work needn’t be so isolating.

                      My experience mirrors @kivikakk, and @thev in that I’ve found co-working spaces can help significantly. They help not just with the feeling of physical isolation, but because they tend to attract people in a similar industry, and if you are overseas, because they tend to attract a higher percentage of expats who generally have similar in-country experiences, and who may speak your native language.

                2. 2

                  Speak for yourself, pal. I work for a mostly-remote company, and we’re not all basement-dwelling losers, and as far as I know nobody’s secretly dying of loneliness. Back when I was commuting to a cube farm, I wasn’t there to hang out with friends, I was there to pay the rent.

                  1. 1

                    My friends started a company together and they’re not all in one place so they spend their time on a Discord call together, which I always thought was kind of clever.

                    1. 1

                      I love spending days at home alone. I feel much more peaceful and balanced. Be careful not to generalize from your own experience.