Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to change the data of a process from another one without using shared memory?

Tags:

c

linux

I am working on a fuse program, when a read() call in fuse is called, it will read the specific file A and save it to its buffer. In my case, I let fuse send a message to my program, and it retrieves data from remote server and save it to this file A, then fuse read this file to get the data.

I am wondering is there a way to let my program save the data right into the buffer of fuse, and avoid I/O operations. Does named pipe a good option? I mean does it store its data in the memory? Or could I change this buffer to a shared memory? I know how to create a shared memory, but do not know if I could convert it. It seems a privates one.

Thanks your guys.

like image 847
bxshi Avatar asked Jan 22 '26 16:01

bxshi


1 Answers

Oh i think here you want to make some communication between two different process then the idea of IPC(Interprocess Communication) comes..

there are 5 ways of doing that

1 Shared memory permits processes to communicate by simply reading and writing to a specified memory location.

2 Mapped memory is similar to shared memory, except that it is associated with a file in the filesystem.

3 Pipes permit sequential communication from one process to a related process.

4 FIFOs are similar to pipes, except that unrelated processes can communicate because the pipe is given a name in the filesystem.

5 Sockets support communication between unrelated processes even on different computers.

i think here shared memory will be good option.

1> 1st declare some shared memory in your program then attache it with fuse

2> when fuse send a message then your program should get data from server 
and save it to that shared memory 

3> make some signaling methods(to avoid any race condition) so after that 
fuse can use that data 
like image 121
Jeegar Patel Avatar answered Jan 25 '26 09:01

Jeegar Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!