Discussion Locked

Shell Script

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am not very good with shell scripting...I need a very short and simple script that requires a lot of CPU usage for a time of about 5 minutes.

I was thinking something like computing PI to x significant decimals(however many it would take to make this script run somewhere in that time-frame on my AIX box) That is just an idea. As long as it is CPU intensive and does not produce io, it doesn't really matter what the script does. Thanks for any suggestions.

5 replies

by sergey kovzik

it would be nice to involve memory operations too. you might consider using perl - some hash operations are really eating CPU

by sergey kovzik

oh, ok. I hope you have perl installed. try this one. save text below into test.pl, for example
---
$t1=time(); while (time()-$t1<1*60) {}
---
actually this script doing nothing, simple loop until time expire. :) 1*60 - is number of seconds to delay. if you need 5 minutes - change it to 5*60. I executed this script as "perl test.pl" and it eated all 100% on my 800Mhz CPU :) It is possible to built more complicate scripts and you can run multiply scripts same time. but everything depends on your OS behaviour. For example I can change priority of task in Windows. If this perl task has normal priority - I don't feel much difficulties to switch run other task and switch between them. But if I change priority to high - this really makes PC slow, and if I select real-time - this makes PC dead :) And about PI - Intel platform has two CPUs actually - second is NPU (numerical) - and when it does operations - main CPU doing nothing, just waiting. so calculating number won't load CPU much. But I don't know structure of AIX

This discussion is closed to new replies.