6 ms·
The part of me that loves low-level programming is wondering why they didn't overload all of or rN, rN, rN (for all N 0..31) so that a thread could com
by messe 4y ago
The part of me that loves low-level programming is wondering why they didn't overload all of
or rN, rN, rN (for all N 0..31)
so that a thread could communicate, not only that it's priority should be lowered, but also provide an additional number alongside that request.
- userbinator 4y agoIf you look at the linked Raymond Chen article, the number does communicate the priority to be used, although it seems that not all 32 are used (and 0 is already used as the "true NOP".)
- masklinn 4y agoThe single comment to TFA further points out that some of the values (registers) trigger other operations e.g. pause, yield, …
- messe 4y agoThanks for pointing this out! I'd read through all of Raymond Chen's architecture articles a couple of years ago, so I didn't bother clicking through. The linked article does indeed go into detail on this! I guess it's time to dive back into them.
- Aaargh20318 4y agoWhy overload an existing instruction at all ? Why not introduce a new instruction to accomplish this ? It seems very hacky.
- bodyfour 4y agoBecause then you can only use that instruction if you're sure the target CPU supports it... or else your program will crash. Sequences like "or r1, r1, r1" are going to be harmless when run on a processor that is unaware of its special meaning, which is exactly what you want for a "hint" instruction.