How do I throttle a command in a terminal window?
Posted
by
To Do
on Ask Ubuntu
See other posts from Ask Ubuntu
or by To Do
Published on 2012-11-24T15:03:10Z
Indexed on
2012/11/26
17:27 UTC
Read the original article
Hit count: 262
I needed to run convert
with a lot of images at the same time. The command took quite a while but this doesn't bother me.
The issue is that this command rendered my computer unusable while the command was running (for about 15 minutes).
So is it possible to throttle the command by limiting resources (processor and memory) to the command, directly from the command line? This can only work if I add something to the same line before pressing Enter because once I start the process the computer slows so much that it is impossible for example to switch to "System monitor" and reduce priority.
Edit: top and iotop results
I managed to run top
and sudo iotop >iotop.txt
while doing one of these convert operations. (The iotop.txt file produced is difficult to read)
Results of top:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 14275 username 20 0 4043m 3.0g 1448 D 7.0 80.4 0:16.45 convert
Results of iotop:
[?1049h[1;24r(B[m[4l[?7h[?1h=[39;49m[?25l[39;49m(B[m[H[2JTotal DISK READ: 1269.04 K/s | Total DISK WRITE:[59G0.00 B/s (B[0;7m TID PRIO USER DISK READ DISK WRITE SWAPIN(B[0;1;7m IO>(B[0;7m COMMAND [3;2H(B[m2516 be/4 username 350.08 K/s 0.00 B/s 0.00 % 0.00 % zeitgeist-datahub 7394 be/4 username 568.88 K/s 0.00 B/s 77.41 % 0.00 % --rendere~.530483991[5;1H14275 idle username 350.08 K/s 0.00 B/s 37.49 % 0.00 % convert S~f test.pdf[6;2H2048 be/4 root[6;24H0.00 B/s 0.00 B/s 0.00 % 0.00 % [kworker/3:2] [5G1 be/4 root[7;24H0.00 B/s 0.00 B/s 0.00 % 0.00 % init
Furthermore, even after the process ends, the computer does not return to the previous performance. I found a way around this by running sudo swapoff -a
followed by sudo swapon -a
© Ask Ubuntu or respective owner