1752810 會員
5789 線上
108789 解決方案
發表新文章

關於psr的切換

 
watermelonyu
教授

關於psr的切換

我用下列指令發現我的top daemon 會一直在cpu 0 and cpu 1切換,但是我的cpu loading total根本不到10%

為什麼還是會一直切換呢?

ps -eo "pid,user,psr,pset,state,args"

PID USER PSR PSET S COMMAND

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 0 0 S + top

2612 root 0 0 S + top

2612 root 0 0 S + top

2612 root 0 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 0 0 S + top

2612 root 0 0 S + top

2612 root 0 0 S + top

2612 root 0 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top

2612 root 1 0 S + top
5則回覆 5
watermelonyu
教授

關於psr的切換

Hello Joey:



Because there is one public domain named as top, so is your top is your specific daemon or just the top command used to monitor system running status?



Best Regards

Danny Lin
watermelonyu
教授

關於psr的切換

Hello Joey:



Under normal condition, if you run a process and DIDN'T use "runon" command to bind it to specific CPU or a processor set or RAD, the running CPUs switched in useful CPU processors is normal. You can use

"man runon" to check and try to bind "top" to specific CPU then use "ps" command to check again.



Best Regards

Danny Lin
watermelonyu
教授

關於psr的切換

用了runon 的確可以把process限定在特定的cpu_num

您說在正常的情況下process will switch in useful CPU

所以是程式自行判斷囉,即使我的兩顆CPU loading都很低

程式還是會在兩這之間切換來切換去的

watermelonyu
教授

關於psr的切換

Hello Joey:



Process will be run on available CPUs that is controlled by kernel job scheduling, if you use "runon", then kernel will know it will be run on the dedicated CPU, otherwise, it's decided by kernel by putting the process in run queue and scheduling it to be run by any available CPUs.



Best Regards

Danny
watermelonyu
教授

關於psr的切換

Hello Joey:



I forgot to mention that UNIX is a time-sharing system, so if there are so many processes running, then each process will be run for a time slice then other processes will get CPU resources, so you processes will not be always run on the same CPU.



Best Regards

Danny Lin