Page 1 of 1

Where do pipes reside?

Posted: Tue May 03, 2011 1:08 am
by sudheer2510
Hi, I am a newbie..,
Could any one please respond to the following query//

**Where do pipes reside...??
I am opening a pipe to the process 2 from process 1.
For example..,
Pipe1 pid is 1233
Pipe2 pid is 1267

When I am sending message from process1 to process2, only some 2 or 3 characters of the sent message is being received on process2 (where i am doing read(0,buf,size)) and even no message sometimes. So, I want to check whether some other process is consuming the data from the pipe.
so @ /proc/1267/fd, 'ls -lrt' gives the following:
lr-x------ 1 sudh 64 2011-05-03 11:55 11 -> pipe:/[1159058716]
l-wx------ 1 sudh 64 2011-05-03 11:55 10 -> pipe:/[1159058714]
lrwx------ 1 sudh 64 2011-05-03 11:55 1 -> /dev/pts/26
lrwx------ 1 sudh 64 2011-05-03 11:55 0 -> /dev/pts/26

In the above the fds on which I am working is 10, 11
I could not understand the numbers 1159058714 in pipe : / [ 1159058714 ]
*Is it the location of fd on kernel??
*Where do the pipes reside?? (Actual location, so that I can access)
*Is there any method to know what processes are accessing a file?
(I want to know this because, in my case the pipe data is not completely available when I am trying to read it from process2. So, I guess some intermediate process might be consuming that data. So, if I could check the processes acting upon that particular fd, i can get some clue)


(forgive me for my bad explanation)

Re: Where do pipes reside?

Posted: Tue May 03, 2011 1:36 am
by Combuster
When I am sending message from process1 to process2, only some 2 or 3 characters of the sent message is being received on process2 (where i am doing read(0,buf,size)) and even no message sometimes. So, I want to check whether some other process is consuming the data from the pipe.
This sounds like a typical case of not flushing the stream where needed...

Re: Where do pipes reside?

Posted: Tue May 03, 2011 2:55 am
by sudheer2510
Combuster wrote:
When I am sending message from process1 to process2, only some 2 or 3 characters of the sent message is being received on process2 (where i am doing read(0,buf,size)) and even no message sometimes. So, I want to check whether some other process is consuming the data from the pipe.
This sounds like a typical case of not flushing the stream where needed...
Also I have tried flushing after writing to pipe.. (But its not working)..
.. The process 2 is launched by grid (sun grid engine)..
So,in between Process 1 and Process 2.., Some more process were there (qrsh, qrsh_starter, statprogl).
I have seen that I am getting this issue, when there was more load on server..

Re: Where do pipes reside?

Posted: Mon May 16, 2011 6:19 pm
by xfelix
Where do Pipes reside?

Pipes are used for Inter-process Communication. So if you fork a child process, the parent and child can send messages to each other. Normal Pipes in unix are half duplex, but there is a way to have full duplex communication.
Very often the descriptors returned by pipe are copied into the file table of a process into the standard input/output index's of the table (usually to run execve some command and grab the output).