Slowing down an old program to run on a fast CPU?
Matthew D. Fuller
fullermd at over-yonder.net
Sat Jun 11 00:16:07 GMT 2005
On Fri, Jun 10, 2005 at 03:44:15PM -0700 I heard the voice of
Mike Hunter, and lo! it spake thus:
>
> Is there a general-purpose approach to this kind of problem in the
> FBSD world? I can see myself writing a C program called `slow` that
> would take argv[1] as the factor ( > 1) by which argv[2] should be
> slowed down by.
It'd be tough. One way might be a wrapper program that SIGSTOP'd and
SIGCONT'd the program with some pauses, but that would be incredibly
nasty and probably not too pretty. A better way could would be to
wrap the program with a library implementing sleep() and friends
differently, so they pause for N times as long. But even that doesn't
help when the programs don't slow themselves down.
I guess the only general solution would be an API into the scheduler
saying "Don't give this program more than N% of the CPU", but I'm
pretty sure we don't have one. It'd be neat, though...
/usr/bin/too-nice-for-its-own-good 8-}
--
Matthew Fuller (MF4839) | fullermd at over-yonder.net
Systems/Network Administrator | http://www.over-yonder.net/~fullermd/
On the Internet, nobody can hear you scream.
More information about the freebsd-hackers
mailing list