How to create a CPU spike with a bash command

后端 未结 23 1215
小蘑菇
小蘑菇 2020-11-30 16:11

I want to create a near 100% load on a Linux machine. It\'s quad core system and I want all cores going full speed. Ideally, the CPU load would last a designated amount of

23条回答
  •  日久生厌
    2020-11-30 16:41

    One core (doesn't invoke external process):

    while true; do true; done
    

    Two cores:

    while true; do /bin/true; done
    

    The latter only makes both of mine go to ~50% though...

    This one will make both go to 100%:

    while true; do echo; done
    

提交回复
热议问题