Faheem
Faheem

Reputation: 1453

Threads sharing Stack locations?

I did a search but couldn't find anything. I was reading a paper that mentions thread sharing stack locations.... I wonder how and why'd that be needed. Any examples would be highly appreciated.

Many thanks.

Upvotes: 0

Views: 614

Answers (1)

Alienfluid
Alienfluid

Reputation: 326

If you declare a variable on the stack and pass it's address to another thread, you are essentially sharing a stack location. Is that what the paper described?

Or was the paper referring to OS support such that the threads using the same stack to keep the EIP/SP etc.? Seems like a problem waiting to happen for me. I guess you could do that to make sure that stack space is not wasted for each thread when you know the constraints of your code, but seems like an overkill.

Upvotes: 1

Related Questions