[Simh] several SIMH instances

Villy Madsen Villy.Madsen at shaw.ca
Sun Dec 3 11:51:29 EST 2006


You can always take a look at my throttle code,
Which inserts waits into the emulator code whenever VMS is idle...

Code is at members.shaw.ca/Villy.Madsen/simh

Villy 

-----Original Message-----
From: simh-bounces at trailing-edge.com [mailto:simh-bounces at trailing-edge.com] On
Behalf Of Vince Mulhollon
Sent: Sunday, December 03, 2006 08:33
To: Simh at trailing-edge.com
Subject: Re: [Simh] several SIMH instances

On Thu, Nov 30, 2006 at 07:17:06PM +0100, Michael Unger wrote:
> On 2006-11-30 16:44, "Kevin Handy" wrote:
> 
> > Patches are being worked on that will monitor the emulated CPU, and 
> > when it detects it in an idle loop, will cause the emulation to 
> > sleep. This can
> 
> Which mechanism is used to detect an "idle loop"? In the "MicroVAX 
> 3900

A better idea would be a cap for the execution rate.

If the simulated CPU has executed 10 million instructions over the elapsed time
of the simulator (at this moment, perhaps, 100 seconds) that means no more
processing, sleep until the ratio drops due to larger elapsed time.

Possible config parameter:
set instructions_per_second = 10000

Bad psuedocode:
next_run_time = total_executed_instructions/instructions_per_second;
while (next_run_time < total_elapsed_seconds_function()) {
  sleep;
}

Seconds is probably too granular.  But the general idea stands.

Also there's no need to do floating point math to check each and every
instruction execution vs elapsed time.  However, it's probably fair to have this
regulation code outside a for loop that runs 1000 or maybe 10000 instructions.

Execution would look like this:

Run 1000 instructions
Wait for real time to catch up to emulated time Run 1000 instructions Wait for
real time to catch up to emulated time repeat ....

For a machine thats "too slow" to run at real speed, it will never wait.

This would have the benefit of being simple, applicable to any OS or emulated
hardware, and also possibly reusable code for I/O devices.

Also, the speed of the host machine would have no effect on the speed of the
emulated machine, which I found quite a hassle when I was trying to use kermit
on an emulated pdp-8 (the timers in the emulated kermit ran so fast that it
essentially instantly timed out).  I vaguely remember successfully doing this on
my 386 but it won't work due to the timeout issue on my new AMD64...  The idle
loop patch would not fix this problem.

_______________________________________________
Simh mailing list
Simh at trailing-edge.com
http://mailman.trailing-edge.com/mailman/listinfo/simh





More information about the Simh mailing list