2 ms·
I mean, this technique seems pretty general already? Get a signal, do the thing (fork, then exec, then copy state, then you're done). But, there's other optio
by toast0 2y ago
I mean, this technique seems pretty general already?
Get a signal, do the thing (fork, then exec, then copy state, then you're done).
But, there's other options. If you want to keep long running connections, but there's not really shared state, you can just fork and then move the socket to the new server and let the old one drain out and exit when it's done/ after you waited long enough. Using a BEAM language like Erlang or Elixir gives you hotloading as a fundamental tool, and otp has some suggestions for how you could use that. You can do hotloading in C with dlopen and dlsym/dlfunc, but you've got to structure your code carefully to make it work, and you may be stuck with a fixed outer loop, depending on how creative you are at writing weird C. Java has hotloading too, at least in some vms. I've built hotloading in Perl, but I don't think I'd be proud of my code if I looked at it again.