skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    One temporary solution I've found is to use ps to get the PIDs of the vscode-server processes, pipe them through awk, then manually taskset them.

    ps aux | grep vscode-server | awk '{print $2}' | xargs -I {} taskset -cp <your_fav_core> {}
    

  2. 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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search