Reputation: 915
I have a command which is checkReplace test.txt
and would like to assign more CPU and memory to this line of command (which I wrote it in a shell script for automation). Since the test.txt could be huge (10GB etc), anyone here could kindly suggest me how to increase the CPU and memory allocation to this command so as to increase the writing speed of test.txt (I suppose). Kindly advice, thanks
Upvotes: 0
Views: 2082
Reputation: 21509
If checkReplace
is a shell script then re-writing it in another scripting language (python, perl, ruby, ...) or in a real programming language would significantly improve it's speed. Shell scripts are mainly for simple tasks. But if you need heavy computations or I/O operations they are usually way to inefficient.
Upvotes: 2
Reputation: 485
You can start the command with higher CPU priority by simply starting it with the nice command, like so:
# nice -n -20 checkReplace test.txt
The highest possible priority is -20, with the default being 0. However, unless you're running other heavily CPU intensive processes, I can't imagine increasing CPU priority of a process will help it write to disk too much faster. That depends largely on hard drive write speeds, etc.
Upvotes: 2