Re: how this is done: process and thread have their own register set?
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Tue, 18 Sep 2007 22:39:22 -0700
On Sep 17, 9:46 pm, linq936 <linq...@xxxxxxxxx> wrote:
Hi,
I come across this question: each process and thread has its own
register set, at least program counter register.
It's own *logical* program counter. It does not have its own program
counter register. Only cores (CPUs) have physical program counter
register.
But one processor has
only one PC register, right?
Right, so when a thread is running on a processor, that's where its
program counter is. When it's not running, it's program counter is
stored elsewhere. When a thread is not running, there is no reason its
program counter needs to be in a CPU's program counter register.
If this is the case, then how can
multiple processes have their own PC register?
Each thread always stores its logical PC register *somewhere*. While
it's running, that in a CPU's physical PC register. While a thread is
not running, that's in a memory area somewhere.
Do they have to swap out? But how about thread?
They have to swap out of the CPU register and into memory. This whole
discussion should more properly about threads, not processes.
Part of a thread's context, when its not running, it its PC register,
its stack pointer, and anything else needed for it to resuming
running.
DS
.
- References:
- Prev by Date: Re: What exactly is the need to have swappable and non swappable pages
- Next by Date: Re: how this is done: process and thread have their own register set?
- Previous by thread: Re: how this is done: process and thread have their own register set?
- Next by thread: Re: how this is done: process and thread have their own register set?
- Index(es):
Relevant Pages
|