linuxvisual-studio-codevscode-remotevisual-studio-code-servertaskset

How do I taskset vscode-server?


Often, I'm using VS Code's Remote SSH extension to develop on a remote server. This consumes some compute on the server, so I'd like to taskset the vscode-server command so that it only runs on certain cores.

I've tried (without much success) to find the exact command that the Remote SSH extension runs on the remote server.

From looking at the output of ps, it seems the first command is ~/.vscode-server/bin/<commit>/bin/code-server --start-server ..., which seems to spawn several child processes.

How do I modify this command from the local machine and prefix it with taskset -c 0?


Solution

  • You can try to put following at the beginning of code-server :

    if test -z "$TASKSET_FLAG"; then
        export TASKSET_FLAG=1
        exec taskset -c 0 "$0" "$@"
    fi