I'm reading Operating System Concepts by Silberschatz 7th ed, and it says that threads of the same process share the code section, data section, and other O.S. resources, but have separate sets of stacks and registers. However, the problem set I'm working on states that threads share local variables, but aren't local variables stored on the stack, so individual threads should have their own copies?
Threads
usually share the following.
But threads
maintain their own copy of stack
, and local variables are stored on the stack so yeah you are right that each thread should have its own copy of local variables.
Maybe it's a bad terminology used or maybe it's something specific to problem set.