I'm raising a wonder in regards to MONITOR-MWAIT vs HLT instructions. Both halts the processor, both wakes up on various external triggers (interrupts etc).
In my experiments, HLT and MWAIT function almost the same, when taking in account :
- If you are not the OS scheduler, a simple loop with the above mentioned instructions, will be interrupted quite rapidly, and since MWAIT requires re-checking the condition in between MONITOR and MWAIT, what is the difference ? (what i'm asking is, why not using HLT in first place, and saving the pain of allocating tracing area (which, if not carefully configured, avoids the mon/mwait mechanism and turns it into a NOP), since if you're not the OS scheduler, there is no chance you won't wake up rapidly enough to simply check the value in a HLT loop... ???
(surely, MWAIT could be higher res, i haven't measured resolution, but it seems it over-wake-ups by (i assume) interrupts and such).. so i can't see the big advantage.
Thanks, Any thoughts in that manner would be greatly appreciated