Recentemente, descobri que meu WSL (ZSHELL) custa muitos recursos de CPU (cerca de 35%) por meio do gerenciador de recursos do Windows.
Então tento descobrir e resolver esse problema da seguinte maneira:
~ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Mar28 ? 00:00:00 /init ro
root 3 1 0 Mar28 tty1 00:00:00 /init ro
mbinary 4 3 0 Mar28 tty1 00:00:12 -zsh
mbinary 48 1 0 Mar28 tty1 00:00:00 [awk] <defunct>
mbinary 66 1 0 Mar28 tty1 00:00:00 [awk] <defunct>
mbinary 173 1 0 Mar29 tty1 00:00:00 [awk] <defunct>
mbinary 225 1 0 Mar29 tty1 00:00:00 [awk] <defunct>
mbinary 431 1 0 09:45 tty1 00:00:00 [awk] <defunct>
root 6845 1 0 09:53 tty2 00:00:00 /init ro
mbinary 6846 6845 0 09:53 tty2 00:00:04 -zsh
mbinary 7419 6846 0 10:03 tty2 00:00:00 python3
mbinary 7455 1 0 14:42 tty1 00:00:00 [awk] <defunct>
mbinary 7522 1 0 14:42 tty1 00:00:00 [awk] <defunct>
mbinary 7559 1 0 14:43 tty1 00:00:00 [awk] <defunct>
mbinary 7587 1 0 14:48 tty1 00:00:00 [awk] <defunct>
mbinary 7595 1 0 14:49 tty1 00:00:00 [awk] <defunct>
mbinary 7604 1 0 14:49 tty1 00:00:00 [awk] <defunct>
mbinary 7643 1 0 14:49 tty1 00:00:00 [awk] <defunct>
mbinary 7666 1 97 15:03 tty1 00:00:21 -zsh
mbinary 7670 7666 0 15:03 tty1 00:00:00 [awk] <defunct>
mbinary 7699 4 0 15:03 tty1 00:00:00 ps -ef
➜ ~ sudo kill -9 1
➜ ~ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Mar28 ? 00:00:00 /init ro
root 3 1 0 Mar28 tty1 00:00:00 /init ro
mbinary 4 3 0 Mar28 tty1 00:00:12 -zsh
mbinary 48 1 0 Mar28 tty1 00:00:00 [awk] <defunct>
mbinary 66 1 0 Mar28 tty1 00:00:00 [awk] <defunct>
mbinary 173 1 0 Mar29 tty1 00:00:00 [awk] <defunct>
mbinary 225 1 0 Mar29 tty1 00:00:00 [awk] <defunct>
mbinary 431 1 0 09:45 tty1 00:00:00 [awk] <defunct>
root 6845 1 0 09:53 tty2 00:00:00 /init ro
mbinary 6846 6845 0 09:53 tty2 00:00:04 -zsh
mbinary 7419 6846 0 10:03 tty2 00:00:00 python3
mbinary 7455 1 0 14:42 tty1 00:00:00 [awk] <defunct>
mbinary 7522 1 0 14:42 tty1 00:00:00 [awk] <defunct>
mbinary 7559 1 0 14:43 tty1 00:00:00 [awk] <defunct>
mbinary 7587 1 0 14:48 tty1 00:00:00 [awk] <defunct>
mbinary 7595 1 0 14:49 tty1 00:00:00 [awk] <defunct>
mbinary 7604 1 0 14:49 tty1 00:00:00 [awk] <defunct>
mbinary 7643 1 0 14:49 tty1 00:00:00 [awk] <defunct>
mbinary 7666 1 99 15:03 tty1 00:00:25 -zsh
mbinary 7670 7666 0 15:03 tty1 00:00:00 [awk] <defunct>
mbinary 7712 4 0 15:03 tty1 00:00:00 ps -ef
Não funciona.
Descobri que os processos zumbis awk
ocorrem depois que uso o comando z
.
Informações: Windows 10: 1809 WSL: Ubuntu 1804
Responder1
Estou executando o Microsoft Windows 10 Pro (64 bits), versão 10.0.18362 e ainda recebo processos zsh não autorizados. Esta função elimina os processos zsh não autorizados.
killzshs(){ps ax -o pid,command,ppid | grep '.*zsh.*\s1$' | awk '{print $1}' | xargs kill -9}
Em seguida, chame killzshs
ou coloque a função em seus dotfiles.
Responder2
Esse problema foi corrigido no Windows versão 10.0.18362.30. Detalhesaqui