The thread context switch includes saving the registers of the current execution context and loading the registers with the saved values ββfrom the execution context. (by the way). Thus, each thread effectively has its own set of registers. Also its own stack, since ESP is one of the registers.
One way to think about what you are getting streams is by keeping the current state of the register and loading the registers into a new state. If this does not happen, then this is not a thread switch. If you also switch to another set of virtual address tables, then you have a process switch, not a thread switch.
you speak:
I understand that each process has its own set of registers, and each thread can change these registers correctly?
But this is not entirely correct. Each CPU core has one set of registers. These registers change whenever the OS switches to another thread. But there is only one thread running in the processor core at any given time. Processes actually do not have their own registers, process their own threads (or at least one thread), and threads have registers or, rather, a place to store the values ββfor the registers, while the thread waits for the CPU core will be available to run.
John knoeller
source share