I need to use the ./cgroup/cpu tool to limit the CPU usage of a particular process. At present, I have achieved this, but every time I have to start the process first, then get the PID of the process, and then write the PID to the tasks file.
Considering this scenario, I need to use gzip tool periodically to compress some data. Every time gzip is started, its process PID is incremented, and compression usually ends quickly. In this case, it is very tedious to write gzip process PID to ./cgroup/cpu/mytestnode/tasks every time.Is there a better way? For example, write the process name into tasks but not PID.