some_id
some_id

Reputation: 29896

Data between processes

What if code is run in its own process and it includes the .h file or corelogic.c which is part of another process.

I have one process running a bunch of code that includes the header of a module that is running in another process.

What is the code in process 1 calls the code in process 2 and sets variables that are present in code that is in process2?

Does process 1 have a copy of all the code connected via the .h file that it includes from process 2's modules?

So there is 2 copies of the variables, 1 for each process? Is it impossible to set process 2's variables from process 1?

Upvotes: 0

Views: 71

Answers (1)

Jerome
Jerome

Reputation: 1519

The two processes in your example have their own copy of every point of data. For your two processes to use the same memory (a change in value in one process automatically changes the value in the second process), you need to use shared memory. In Linux, you can use shmget.

Upvotes: 1

Related Questions