How do I slow down a process?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do I slow down a process?
# 1  
Old 11-03-2011
How do I slow down a process?

Hello, I've been searching for something that slows down a process for some time now. Slow down as in make time pass by slower. I have rarely turned to asking a forum in the past but at this point I've given up.

For example: if I made a program that would print "Hello" in 5 seconds, I would use this time slower to instead print "Hello" much later, maybe 10 seconds later, maybe 5 minutes later, maybe 5 days later, or maybe even allow it to be 5 seconds later.

I found a open source program that does the opposite: make time FASTER. This program is called warp and is developed by Glenn Fowler at AT&T Labs Research. This program is a .so file that you load and you specify the time multiplier and offset in a environment variable called "WARP". This is pretty neat and all, and ideally I'd like a program that can go either way, make time faster or slower, and I'd also be really cool if you could specify an offset, like you do with Glenn's warp, but I guess I'm really just looking for the make time go slower part right now.

Thanks for the help.
# 2  
Old 11-04-2011
Code:
$ date && printf '%s' "H" && sleep 5 && printf '%s\n' "ello" && date
vendredi 4 novembre 2011, 12:18:56 (UTC+0100)
Hello
vendredi 4 novembre 2011, 12:19:01 (UTC+0100)
$

Just replace sleep 5 with sleep $1 in your script Smilie
# 3  
Old 11-04-2011
Do you want to just delay the process? Or do you want to slow down processing?

The former can be done with sleep, cron, or at.
To slow down processing, you could use cpulimit, which limits CPU usage by pausing and resuming the process using signals. Note that that probably won't influence timer-based events.
# 4  
Old 11-04-2011
what about changing its priority (e.g with nice )?

What iI ment was, as previous post seems to suggest, what purpose for what? why cant a simple nice suffice, you may have good reasons but we dont know...

Last edited by vbe; 11-04-2011 at 09:18 AM..
# 5  
Old 11-04-2011
Quote:
Originally Posted by Nathan1
I found a open source program that does the opposite: make time FASTER. This program is called warp and is developed by Glenn Fowler at AT&T Labs Research. This program is a .so file that you load and you specify the time multiplier and offset in a environment variable called "WARP". This is pretty neat and all, and ideally I'd like a program that can go either way, make time faster or slower, and I'd also be really cool if you could specify an offset, like you do with Glenn's warp, but I guess I'm really just looking for the make time go slower part right now.

Thanks for the help.
Can you put a <1 multiplier into warp to slow it down, or does it have to be an integer?

This kind of trickery, making date() return incorrect values, may have unpredictable results if your program actually uses date() for anything important.
# 6  
Old 11-04-2011
Thanks for the help everybody, but sleep, cron, at, cpulimit, and nice do not slow time down.

Quote:
Originally Posted by Corona688
Can you put a <1 multiplier into warp to slow it down, or does it have to be an integer?
Yes, I've tried and it must be a Integer. The program is written in c so I looked at the code and the number parsing function thing does not handle decimal values, and the number is stored as an integer. I don't really have any knowledge with c, but I think I should be able to replace every place it tries to store the the number as an integer and tell it to make it store it as a decimal number instead, and then redo the number parsing function so that it parses the part after the decimal point. I think that would only work if the integer math is the same as decimal number math. Maybe I should ask the developer for help but the last update was almost 10 years ago.

Quote:
Originally Posted by Corona688
This kind of trickery, making date() return incorrect values, may have unpredictable results if your program actually uses date() for anything important.
So far it looks predictable with modifying the date, and it seems like this should always be true as long as the program asks the system for the current date. Oh and I am trying to change something "important" so I already assumed the risk of breaking my computer.

Last edited by Nathan1; 11-04-2011 at 06:27 PM..
# 7  
Old 11-05-2011
Quote:
Originally Posted by Nathan1
Yes, I've tried and it must be a Integer. The program is written in c so I looked at the code and the number parsing function thing does not handle decimal values, and the number is stored as an integer. I don't really have any knowledge with c, but I think I should be able to replace every place it tries to store the the number as an integer and tell it to make it store it as a decimal number instead, and then redo the number parsing function so that it parses the part after the decimal point. I think that would only work if the integer math is the same as decimal number math. Maybe I should ask the developer for help but the last update was almost 10 years ago.
If you could link me to the source, I'd take a look.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Improve script - slow process with big files

Gents, Please can u help me to improve this script to be more faster, it works perfectly but for big files take a lot time to end the job.. I see the problem is in the step (while) and in this part the script takes a lot time.. Please if you can find a best way to do will be great. ... (13 Replies)
Discussion started by: jiam912
13 Replies

2. Solaris

Defunct process are generated after JNLP connection with a slave and the machine gets very slow

Hi everyone, I'm working on continous integration with Jenkins. I’m facing an issue while connecting a slave (solaris sparc 8) with Jenkins ver. 1.532.2 This slave is connected via the option “Launch slave via execution of command on the Master”. Connection is established with: -... (1 Reply)
Discussion started by: javaPIC
1 Replies

3. AIX

AIX 7.1 on Power 750 is very slow with no high memory or process consumption

Hi, This thread has been posted before on linuxquestions.org, but no answer, maybe because this is unix question and not linux. I'm posting the same thread here, hope I can get an answer from someone in the meantime, I wish I could post of emergency thread but it needs bits which I don't have :... (6 Replies)
Discussion started by: aLuViAn
6 Replies

4. Shell Programming and Scripting

Why is SED so slow?

I have many files which contain about two million lines. Now I want to use sed to delete the 9th line and add a new line behind the 8th line. I use the command as follows: for((i=1;i<100;i++)); do echo $i; sed -i '9d' $i.dat; sed -i '8a this is a new line' $i.dat; done But it is... (3 Replies)
Discussion started by: wxuyec
3 Replies

5. Shell Programming and Scripting

My attempt is FAR too slow

I have numerous (hundreds) of data files with various values in each file. The values are 1 per line, and identified by the fieldname in the 1st field in the line, which is delimited from the actual field value by a colon. So an example from one of the files looks like this: NAME: Bob Jones... (2 Replies)
Discussion started by: Finja
2 Replies

6. Solaris

Certain zones are slow

only the Tomcat serving ones. An oracle zone on the same global zone responds instantaneously. Running netstat results in a long wait. Cannot deploy builds with Jenkins to these web servers. Thoughts? (2 Replies)
Discussion started by: LittleLebowski
2 Replies

7. UNIX for Dummies Questions & Answers

Slow printing / CUPS - process "parallel" high cpu

Hello. I have a slackware system running cups with an HP laserJet 2100 connected via parallel port in ECP mode. Print jobs are working. Very slowly. 15K test print out of cups takes about 2 minutes to complete. When the printout is on the way to the printer, the process "parallel" uses... (0 Replies)
Discussion started by: agentrnge
0 Replies

8. HP-UX

Server become too slow

Hi, Since last week our server become too slow when we try to run application on it. When we run top command, it show as below: So it's nothing to do with heavy utilization, right? Can you give some opinion on what actually had happended? Thank you very much... :b: (4 Replies)
Discussion started by: yeazas
4 Replies

9. Post Here to Contact Site Administrators and Moderators

Slow

The site has gone slow for quite some time... Can you do somethin abt it (2 Replies)
Discussion started by: DPAI
2 Replies
Login or Register to Ask a Question