I am trying to understand the fundamental of shared memory concept. I trying to create a shared library having one function and one STATIC array variable. I want to access static array variable through the function of that shared library.

Here is my shared library

```
     //foo.c    
     #include <stdio.h>

    static int DATA[1024]={1 ,2 ,3 ,...., 1024};
    inline void foo(void)
    {
        int j, k=0;
        for(j=0;j<1024;j++)
        {
            k=DATA[j];
       }
        k+=0;    
    }

```

I have created shared library object (libfoo.so) by following instructions from [shared library](http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html)

**Now my questions are**

1> If I access foo() from two different program ( program1 and program2), will there be separate copy of foo() function for program1 and program2 ?

2> will there be separate copy of **static DATA array** for program1 and program2 ?

3> Will they load into same physical memory location ? If the static DATA array is loaded separately, is there any way to force/make it loaded into same memory location ?

4> Is there any way to find where the **static DATA array** is stored for program1 and program2 ?

I am using gcc under linux. Any help will be highly appreciated .Thanks in advance.