Null process / idle loop
Posted: Fri Jun 09, 2023 10:25 am
Curiosity only - low priority!
Years ago I did the VAX/VMS internals courses and I still have the documentation for the course, dated around 1987/8. The other day I was running OpenVMS 9.2 as a VM when I noticed that with nothing to do the host saw <1% CPU usage. I have 4 cores, and had 2 allocated to VMS at the time. I remembered back over the decades and thought that the VMS scheduler never really stopped, it just sat in a tight loop (not quite a spinlock) waiting for something to be available. Sure enough:
Now clearly internals have changed radically over 5 major versions and 4 architectures! So just to satisfy my idle curiosity, how does the VM release unused CPU back to the host whilst still being responsive to interrupts from scheduling events and device drivers?
Years ago I did the VAX/VMS internals courses and I still have the documentation for the course, dated around 1987/8. The other day I was running OpenVMS 9.2 as a VM when I noticed that with nothing to do the host saw <1% CPU usage. I have 4 cores, and had 2 allocated to VMS at the time. I remembered back over the decades and thought that the VMS scheduler never really stopped, it just sat in a tight loop (not quite a spinlock) waiting for something to be available. Sure enough:
Code: Select all
60$: TSTL G^SCH$GL_COMQS ; POSSIBLY READY TO DO SOMETHING?
BNEQ 20$ ; YES, TRY AGAIN
BEQL 60$ ; NO, KEEP LOOKING