Home > Blockchain >  Trying to understand `stress -m` in Linux
Trying to understand `stress -m` in Linux

Time:01-30

I'm learning CLI tools, I don't understand the behaviour of stress -m, according to the official documentation, stress -m option does the following:

spawn N workers spinning on malloc()/free()

I am not an experienced sysadmin, so could someone give a more didactic explanation? I don't see the relation between this and the amount of memory used by stress -m or the device from which this memory is taken.

Thanks in advance.

CodePudding user response:

The -m options sets the number of workers spawned, but the --vm-bytes options allows you to set how much virtual memory each worker is going to use.

For example, after running stress -m 1 --vm-bytes 1024M, you can see in htop that the process is using around 1027M of virtual memory (VIRT column):

enter image description here

CodePudding user response:

"stress -m" is a command used to generate system stress on a Linux or Unix-like operating system. The "-m" option specifies the number of worker threads to generate, causing the system to run multiple processes and consume more CPU, memory, and I/O resources. This command is often used to test the performance and stability of a system under heavy load. Note that excessive use of the stress command can cause a system to crash, hang, or otherwise become unresponsive, so it should be used with caution and only for testing purposes.

  • Related