shared libraries, datasegment and multiple processes
I have a shared library that defines and uses a global variable and a atatic variable. My question is that whether shared libraries have a datasegment.
If yes does that mean that this datasegment will be accessed accross multiple processes, thereby works like a shared memory and some short of synchronisation logic is needed within the library to serialize the access?
If no then how these global varibles will be placed into the caller datasegment. I mean how the linker will solve the symbols? Will these symbols be exported to the caller through the stub?
Does all this depend upon the operating system used?
Any help will be most appreciated.
Each process gets its own copy of library data - only the code is shared.