Comments (4)
The prior implementation (when compiled with _POSIX_SOURCE) used the clock_getres API. This strategy was flawed since the clock_getres API returns the "UNITS" of the clock resolution. These value of the 'units' aren't what is important for a reliable idle implementation. What is important is smallest amount of time you can actually sleep when calling nanosleep() (or whatever platform specific sleep mechanism is available).
The new strategy measures the minimum sleep time. This measurement is correct and the simulator will behave as designed, and simulated time will track real time as close as possible.
For all platforms, if the minimum sleep time is greater than SIM_IDLE_MAX (which is 10ms), then the assumptions in the idle code can't produce reliable results. The closer the minimum sleep time gets to SIM_IDLE_MAX, the more erratic the progress of time (within the simulator) will appear when compared to wall clock time. Once SIM_IDLE_MAX is exceeded things can't be predicted or corrected.
On my test NetBSD 5.1 system, the clock tick (sleep resolution) appears to be 20ms, so I see the failure here as well.
If you can convince your OS to run with a shorter clock tick (and hence have a finer grained sleep resolution), then the simh idling implementation will work just fine. Some operating systems allow this value to be configured or even programmatically manipulated. If you can provide a programmatic way to influence the sleep resolution (or a better sleep implementation), we'll be glad to integrate its use. All modern hardware can have system clock ticks which are sufficiently small to provide reliable simh idling.
Alternatively, if having simulated time have any useful relationship to real time is not important to you, you can continue to use idling on the older simh version.
I have checked in code on the master branch which will report why idling isn't available due to minimum sleep resolution constraints and to display the available minimum OS sleep time.
from simh.
Thanks for the info Mark. You are seeing exactly what I am seeing.
from simh.
Please come back and let us know if you come up with a better sleep implementation or have a way to influence the host clock tick size. Even if it involves rebuilding a kernel. The details of how to do this may be useful to others. I'm closing this now.
from simh.
This issue also comes up on Solaris host systems. Info suggests that changing /etc/system to contain the following lines will be sufficient to provide a 1ms host tick on Solaris hosts.
set hires_tick=1
set hires_hz=1000
The changed setting will take effect after the Solaris host system is rebooted.
from simh.
Related Issues (20)
- How do I need to compile vaxstation4000m60 and vaxstation4000vlc to get VC and VE devices? HOT 1
- set RQx unit=y gives "Plug y already in use on RQy" even if RQy is disabled HOT 2
- The maintainer of this repo has hijacked the project and relicensed it under a closed source license https://groups.io/g/simh/topic/new_license/91108560 HOT 13
- LICENSE.txt and author names HOT 1
- Simh is not longer a FOSS project HOT 5
- Does not build under Arch Linux (GCC 12.2.0) HOT 1
- File open error when trying to attach xq to network device HOT 4
- microvax2 HELP ROM info partially outdated/wrong HOT 2
- AltairZ80: ^E doesn't work when attaching SIO to Telnet (port 23) HOT 9
- fis11 fac get_exp HOT 6
- new build system HOT 7
- simh build error (openSUSE Tumbleweed, GCC 13.1.1) HOT 3
- SIMH pdp8 Fails to Build on Raspberry Pi Linux HOT 3
- build fails due to pointer mismatch in sim_disk.c HOT 1
- no builds available
- MicroVAX3900 aborts on Widows due to sim_idle() - waiting too long HOT 3
- AltairZ80: Altair DOS stops responding to key presses after interrupts have been enabled. HOT 8
- AltairZ80: Question about setting the Switch Register (SR) HOT 6
- vax8200 hangs booting VMS V4.4 HOT 12
- Is this project still being developed? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simh.