How do I taskset vscode-server?

81 Views Asked by At

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

There are 2 best solutions below

0
On BEST ANSWER

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
0
On

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> {}