Where do pipes reside?

Programming, for all ages and all languages.
Post Reply
sudheer2510
Posts: 3
Joined: Mon May 02, 2011 11:57 pm

Where do pipes reside?

Post 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)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Where do pipes reside?

Post 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...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
sudheer2510
Posts: 3
Joined: Mon May 02, 2011 11:57 pm

Re: Where do pipes reside?

Post 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..
User avatar
xfelix
Member
Member
Posts: 25
Joined: Fri Feb 18, 2011 5:40 pm

Re: Where do pipes reside?

Post 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).
The More I See, The More I See There Is To See!
Post Reply