[Info-vax] clock problems with OpenVMS x86 on VirtualBox
Johnny Billquist
bqt at softjar.se
Mon May 15 06:06:12 EDT 2023
On 2023-05-12 12:24, gah4 wrote:
> On Friday, May 12, 2023 at 2:56:13 AM UTC-7, Johnny Billquist wrote:
>
> (snip, I wrote)
>
>>> How does VMS keep track of time?
>
>> Same as pretty much anything else. You have a clock interrupt at a
>> regular interval and the OS counts time based on that.
>
>> VMS started off on the VAX, however, and that architecture do not have a
>> WAIT instruction, so at idle, the processor is really just spinning.
>> Not sure if that was amended on Alpha or later.
>
>> But a WAIT is commonly only stopping the processor until something
>> happens, which usually is an interrupt. If there is still nothing to do
>> after the interrupt handler finish, the processor would loop back to the
>> WAIT again.
>
> Yes. On the other hand, when the OS gives up, usually at IPL time when
> something fails, there is disabled WAIT state. That is, no interrupts
> enabled, in which case it stops.
Yeah. Well, if you disable all interrupts, and spin (or WAIT), not much
else can be expected to happen...
>> simh (for example) do detect the idle loop in VMS (on VAX), and pause
>> execution if it detects this loop, to let the host rest.
>
> Some put a special instruction in the loop to make it easier for emulators.
Doable if you have sources, which usually isn't the case with VMS.
NetBSD on VAX did add a hack to allow simh to detect the idle state,
which is harmless on real hardware (basically raising IPL to 1).
> There are two time related things that OS need to do. One is tell what
> time of day, month, year, it is. The other is task switching, and any other
> short time related events.
>
> IBM S/360 uses the same system for both, as you describe.
So does VMS, all Unixes that I've ever encountered, all PDP-11 OSes I've
ever encountered, all RTOSes I've ever encountered, and everything else
I've ever encountered...
> But S/370 adds a TOD clock, which keeps track of time, and a separate
> system for non TOD related timing. One complication with the TOD clock
> in Y2K days, is that access is not privileged, such that it can't be emulated
> by VM. So, VM/370 and successor guests read the hardware TOD clock.
> But other timing uses a different timer which is emulated.
Most systems do have a TOD clock as well, in hardware. But it is not
used for actually reporting current wall clock time, but is read out at
boot time and the OS time is set from it, and occasionally it is also
written to, to correct small drifts that happen over time.
Some PDP-11s have it, all VAXen have it, any PC have it these days, and
pretty much most other hardware as well, unless it's a rather limited
embedded system.
> So, some VirtualBox guests have a special way to get the host clock for
> TOD functions, but the interrupt clock for others. Saves a lot of work
> keeping two clocks synchronized.
Which is how it works on everything I've encountered. :-)
But as I mentioned, the TOD clock is read out at boot time, and not
directly used for reporting current time.
Johnny
More information about the Info-vax
mailing list