.so story

.so story

Post by pellegrino stephan » Sat, 07 Apr 2001 23:27:52



Hi everybody,

just a little thing for linux pros 8)

1) How can I do to know all the .so which are in ram ?
    I mean a kind of  `ps' but for the .so ??

2) In my own .so, I've put a global var like int x;
    and I've put also a simple function test_fct() like

    int test_fct()  {  x++; printf(" value of x : %d\n", x);  return x; }

   ok...
   now I create a "regular" a.out which call my test_fct()
   right...

   now, under shell
   # a.out &
   value of x : 1

    then another
    # a.out &
   value of x : 1

   Why x stays at 1 ????

thanx

steph

 
 
 

.so story

Post by Zoran Cutur » Sat, 07 Apr 2001 23:43:12



Quote:> Hi everybody,

> just a little thing for linux pros 8)

> 1) How can I do to know all the .so which are in ram ?
>     I mean a kind of  `ps' but for the .so ??

> 2) In my own .so, I've put a global var like int x;
>     and I've put also a simple function test_fct() like

>     int test_fct()  {  x++; printf(" value of x : %d\n", x);  return x; }

>    ok...
>    now I create a "regular" a.out which call my test_fct()
>    right...

>    now, under shell
>    # a.out &
>    value of x : 1

>     then another
>     # a.out &
>    value of x : 1

>    Why x stays at 1 ????

Because the only segment of a program that
can be shared is the text segment. All other
segments (data and bss for globals and local
statics) are constructed from the executable
files at runtime and every process has its own
data, bss, heap and stack segments.

The text segment is the one that holds the
instructions. But text doesn't hold any data.

--

"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond

 
 
 

.so story

Post by Lorand Somogy » Sun, 15 Apr 2001 02:38:22



> Because the only segment of a program that
> can be shared is the text segment. All other
> segments (data and bss for globals and local
> statics) are constructed from the executable
> files at runtime and every process has its own
> data, bss, heap and stack segments.

> The text segment is the one that holds the
> instructions. But text doesn't hold any data.

Is there a way somehow to make a data
segment which would be shared among the instances?

Greatings,
Larry.

 
 
 

.so story

Post by Joseph A. Knapk » Mon, 16 Apr 2001 12:24:33




>> Because the only segment of a program that
>> can be shared is the text segment. All other
>> segments (data and bss for globals and local
>> statics) are constructed from the executable
>> files at runtime and every process has its own
>> data, bss, heap and stack segments.

>> The text segment is the one that holds the
>> instructions. But text doesn't hold any data.

[Aside: data segments are indeed shared, on most modern
VM OS's including Linux, via copy-on-write. There's no
way to use this fact for IPC, though, which seems to
be what you are interested in.]

Quote:

> Is there a way somehow to make a data
> segment which would be shared among the instances?

> Greatings,
> Larry.

I haven't seen the beginning of this thread, so
sorry if this isn't what you're looking for:

man shmget
man shmat

And make sure your kernel is built with "System V IPC"
enabled.

Regards,

-- Joe

-- Joseph Knapka
"If I ever get reincarnated... let me make certain I don't come back
  as a paperclip." -- protagonist, H Murakami's "Hard-boiled Wonderland"
// Linux MM Documentation in progress:
// http://home.earthlink.net/~jknapka/linux-mm/vmoutline.html
* Evolution is an "unproven theory" in the same sense that gravity is. *

 
 
 

1. Flatfish's career as an AIX admin: the story of a wanker.

This makes it more believable!

-Ed

--

/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f 5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0 rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for showpage

2. LCD Displays on Red Hat 7.1

3. Request: Stories---Linux in the Large Scale?

4. Alcatel speed touch pro configuration with static IPs

5. 7200-any linux success stories to share??

6. TCP/IP Setup using "netconfig"

7. Steve Gibson story on NPR

8. How do I set a Static IP??

9. +ve story re: UNIX dying for thirty years.

10. CA-Unicenter success stories - ?????

11. Install Stories

12. migratepv - the real story

13. HP Colorado 5 or 8 GB success story, anybody?