Re: how this is done: process and thread have their own register set?
- From: Josef Moellers <josef.moellers@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Sep 2007 09:31:37 +0200
linq936 wrote:
Hi,
I come across this question: each process and thread has its own
register set, at least program counter register. But one processor has
only one PC register, right? If this is the case, then how can
multiple processes have their own PC register?
They don't. Each has a *copy* of the contents of the PC register.
When a task switch occurs (either from one process to another or from one thread to another), the old contents of the PC register are saved (e.g. automatically by the processor hardware onto the stack due to an interupt) and the new contents of the PC register are restored (e.g. autmatically by the processor hardware from the stack due to the "Return From Interrupt" machine instruction).
Of course, when you have multiple CPUs (either on separate chips or as a multi-core on one chip), then you do have as many PC registers as there are CPUs, and you can have as many tasks (processes or threads) running in parallel.
Do they have to swap out? But how about thread?
For this discussion, just set "thread" == "process".
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
.
- References:
- Prev by Date: Exclusive control
- Next by Date: Re: Exclusive control
- Previous by thread: 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
|