How to know who is switching process in Linux

  
                  

When we are doing a Linux server, we often need to know who is doing the process switch and what is the reason for the process switch. Because of the high cost of process switching, I give a number that LMbench tests:

Context switching – times in microseconds – smaller is better

—————————— ——————————————-

Host OS 2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K

Ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw

——— —————— ————————————————————

my174.cm4 Linux 2.6.18 - 6.1100 7.0200 6.1100 8.7400 7.7200 8.96000 9.62000

On my very high-end server, the overhead of process switching is around 8us. This is unacceptable compared to high-performance servers, so we have to be in a time slice. Do as much as possible within the work, instead of wasting time on unnecessary switching.

Curious to kill the cat, let's investigate who is switching our process:

view sourceprint?[root@my174 admin]# dstat 1

---- Total-cpu-usage-----dsk/total- -net/total- ---paging-- ---system--

usr sys idl wai hiq siq

Copyright © Windows knowledge All Rights Reserved