Multiple program counters

Hi, Does a multi-threaded process have multiple program counters ?

Thx in advans, Karthik Balaguru

Reply to
karthikbalaguru
Loading thread data ...

Surely there are books that you could learn this stuff out of in one consistent whole, instead of getting bits and pieces off of newsgroups?

If it's only running on one processor, there's only one 'real' program counter. But each thread will have a context saved by the operating system which will get saved away as the thread is exited and restored as it is entered, and an important part of that context will be the program counter value.

--
Tim Wescott
Control systems and communications consulting
 Click to see the full signature
Reply to
Tim Wescott

Of course.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
 Click to see the full signature
Reply to
CBFalconer

Hi, =46rom my understanding PCs are more about the processor then the real threads itself.As another poster has said,you just save the value of pc during context switch and in another context it would store different value. I wish to stand corrected incase I am wrong. Regards, s.subbarayan

Reply to
ssubbarayan

karthikbalaguru schrieb:

On most machines you'll find only one PC, may be there are some exotic machine structures that use really seperate memory areas for sepearate pieces of code, but that doesn't really make sense. Can you think of any advantage it would bring? The task/process count would be dependent on the hardware resources (array of PCs), you would need a lot of other duplicate registers for each area.

- Udo

Reply to
Udo Piechottka

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.