Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I run a convert *.tif bla.pdf command sometimes with say 60 images. Now this renders my computer unusable until it finishes.

I tried using nice and ionice but it did not help much.

Is there a way to limit resources (disk read/writes and maybe cpu) to the convert command?

share|improve this question
2  
ionice -c 3 (idle priority class) should have no impact on regular system activity. If you say it still renders your computer unusable, I'd suspect something is wrong (e.g. had disk problems, etc.) You need to trace and fix that problem first. Check your logs (especially the kernel log) for unusual errors, etc. –  haimg Nov 26 '12 at 15:57
    
Maybe it is because it uses a lot of CPU as well. I actually tried to "chain" ionice and nice ionice -c 3 nice -n 20 convert. Is it a bad idea? –  To Do Nov 26 '12 at 16:05
    
It's not a bad idea per se (nice and ionice are orthogonal), but I'd rather find out what's wrong before trying random tricks. Your computer should not behave like this in any case, it's not normal. –  haimg Nov 26 '12 at 16:41
    
I think that nice and ionice only modify priority to commands but do not prevent them to use all resources. The moment another app requires resources it needs to "wait" until the operation ends to get it's needs. What about using ulimit to keep a "reserve" i/O and cpu? –  To Do Nov 26 '12 at 16:48
add comment

1 Answer

up vote 1 down vote accepted

Actually the problem is that all the tiff files were being loaded into RAM at one time. The problem was not related to CPU usage nor to read/write operations to disk (well, sortof). It was filling RAM (4Gb) and then using Swap.

So, as suggested by someone I split the procedure in two steps.

  1. find . -iname '*.tif' | xargs -I% convert % %.pdf converts each image separately
  2. pdftk *.pdf cat output merged.pdf && rm *.tif.pdf merges the pdf files and deletes the individual pdf's.

Overall it was faster and the computer was not blocked.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.