I would like some help regarding multithreading...
i want to know what exactly happens when i start a new thread... i.e how it affects the variables etc. in the program...
one query i have is what happens if i start 2 threads starting with the same function.. will their running be separate from each other or will the changing of the local variables by one affect the other...
and is their anyway to overcome this problem in the case one affects the other...
shre86
0
Light Poster
Recommended Answers
Jump to Postseparate threads use different stacks (the part of the memory that stores the local variables) but share the same heap(the part of the memory that stores the objects allocated by 'malloc', or 'new', and global variables).
That means that any changes made on variables allocated on the heap are …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.