Daniel
2010-01-26 23:07:01 UTC
Now I'm a little perplexed thinking about it. The bootloader I've written is about 1000 lines of Intel instructions, but it's 16-bit "RealMode", synchronous code (just the way they boot and read the MBR). I had to be VERY careful what I stored in the registers in between interrupts and my different functions. It really hit me; what in the world goes on in multi-threaded code with the registers!?
You see, my code might boil down to:
mov eax, some_value
...on Thread 0x0.
But by chance, Thread 0x1 might do this at the exact same time:
mov eax, other_value
...is that even possible? Mind you, there are much more registers in PMode, especially with a multi-core. But I'm curious as to how that is ever avoided. Something might be depending on the value in eax right after this occurs! Is this all avoided by the virtual memory capabilities in Pmode? I'm just wondering what safeguards the processor from nasty things like this.
Note: If you honestly don't know, don't even post. Pretty please! :)