index.html :: rss :: github :: telegram :: email

linux: learning threads

13 Aug 2024
  1. Implement network (probably, tcp) server in a simple, single-threaded way;

  2. make it multitreaded:

    2.1. use some shared resources: e.g. request counter with mutex

    2.2 use raw clone() syscall with CLONE_THREAD + CLONE_SIGHAND + CLONE_VM params;

    2.3 use pthread as it's the POSIX-compatible threading library on all modern nix;

Play around the CLONE_xxx parameters: use separated signals tables, shared and non-shared fds, etc.

Check how sharing a single connection fd across multiple threads works and affects preformance.