difference between normal file and named pipe file

unix

    Next

  • 1. init and SIGINT on linux
    Hi, When I change the ctrlaltdel line in inittab to: ca::ctrlaltdel:/bin/echo 'shutdown disabled' it only works once. I beleive this may have something to do with the way init is handling the SIGINT that is sent when ctrl-alt-del is pressed. Only after running init q will it work again. I thought about appending ;init q to the command that is run, but that is just plain evil. Anyone have any better ideas? Thanks!
  • 2. How to co-relate tcpListenDrop with listen backlog parameter
    Hi, I am trying to understand what the tcpListenDrop parameter is all about. The value is tracked on a system wide basis, where as the backlog parameter passed to a listening socket is on a single socket. Is there a way to identify which socket might be causing the tcpListenDrop to increase? On the same lines, tcp_conn_req_max_q sets the maximum number of established sockets that are waiting to be accepted by a socket. Is this queue length set for the entire system or on a per-socket basis? If it is a system wide parameter, then how does it affect the listen() backlog parameter. Does increasing my tcp_conn_req_max_q value from 128 to 1024 while retaining a listen backlog of 50 help in any way? Hopefully, someone out there knows the answer to these questions. Thanks Ravi
  • 3. difference between normal file and named pipe file
    HI, will anyone let me know the differences between the normal unix file and named pipe file? Regards

difference between normal file and named pipe file

Postby ramu » Sat, 10 Jun 2006 19:04:21 GMT

HI,
        will anyone let me know the differences between the normal unix
file and named pipe file?

Regards


Re: difference between normal file and named pipe file

Postby Barry Margolin » Sat, 10 Jun 2006 22:02:49 GMT

In article < XXXX@XXXXX.COM >,




A normal file is a bunch of data sitting on disk.

A named pipe is a way for two processes to connect to each other and 
send data directly.

-- 
Barry Margolin,  XXXX@XXXXX.COM 
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Re: difference between normal file and named pipe file

Postby colonel_hack » Sun, 11 Jun 2006 00:28:14 GMT

> In article < XXXX@XXXXX.COM >,



A file keeps all the data until deleted/overwritten while iiuc a named 
pipe dumps the data after it is read. So a temp file could keep growing 
and fill a file system, but a named pipe is less likey to for, say, long 
running processes.

   3ch

Re: difference between normal file and named pipe file

Postby Andrew Smallshaw » Wed, 14 Jun 2006 01:44:05 GMT



I'm not sure I understand this - a write to a named pipe will block if
there is no corresponding process reading from the pipe, usually
blocking the whole process until there's a reader.  This in itself is
can be quite a useful shell hack - it allows to send a signal between
two processes, potentially owned by different users, without root
permissions being needed.

-- 
Andrew Smallshaw
 XXXX@XXXXX.COM 

Re: difference between normal file and named pipe file

Postby colonel_hack » Thu, 15 Jun 2006 06:41:20 GMT






I'm not sure what part you don't understand (perhaps I've said something 
wrong) but:
An open for writing to a named pipe will block if there is no process with 
the file open for reading (and vice versa). But it dosen't have to be 
actively reading for the writer to write, so the file can still grow. I 
think there is also some smaller limit that for a normal file. But the 
blocking scheme is also an important difference.

   3ch

Re: difference between normal file and named pipe file

Postby Barry Margolin » Thu, 15 Jun 2006 13:06:15 GMT

In article < XXXX@XXXXX.COM >,







What file?  There's no file associated with a named pipe, it's just a 
kernel connection between the two processes.


There's typically a buffer of about 4KB in the kernel.  So if the writer 
writes faster than the reader reads, the writer will block when it gets 
4K ahead of the reader.

-- 
Barry Margolin,  XXXX@XXXXX.COM 
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Re: difference between normal file and named pipe file

Postby ramu » Thu, 15 Jun 2006 16:46:39 GMT

Well. Thanks for your answers.  The differences what you have given are
functional. Can anyone tell me the implementation level differencs
between normal unix files and named pipe files?

Regards


Re: difference between normal file and named pipe file

Postby colonel_hack » Fri, 16 Jun 2006 01:30:41 GMT



A -named- pipe? Per Maurice Bach in The Design of the Unix operating 
system: "A named pipe is a file whose semantics are the same as those of 
an unnamed pipe, except it has a directory entry and is accessed by a path 
name." Also he says the size limit is set by the use of only direct blocks 
of the inode but he is talking about System V

Under FreeBSD (and similar under Fedora core 3):
%ls
%
%mkfifo joe
%ls
joe
%echo "1234567890" > joe

hangs until I do
%cat joe
1234567890
%
in another terminal.
and
%ls -i
147374 joe
show it has an inode

Perhaps in modern unices the name is stored in the file system but data 
in buffers, but it has a directory entry and and inode. That is what I 
meant by calling it a file anyway.

This has encouraged me read up on named pipes though :-)

   3ch

Re: difference between normal file and named pipe file

Postby Barry Margolin » Fri, 16 Jun 2006 09:04:54 GMT

In article < XXXX@XXXXX.COM >,






If everything that has a directory entry is a file, then yes it's a 
file, and so is a tty device, tape drive, etc.  I was using the term in 
the more traditional sense to mean a collection of non-volatile data on 
some storage medium.

-- 
Barry Margolin,  XXXX@XXXXX.COM 
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Re: difference between normal file and named pipe file

Postby colonel_hack » Fri, 16 Jun 2006 13:46:18 GMT



More traditional outside of unix, but it is the standard unix terminology. 
"Everything is a file" and all that.

   3ch

Re: difference between normal file and named pipe file

Postby Barry Margolin » Fri, 16 Jun 2006 21:51:05 GMT

In article < XXXX@XXXXX.COM >,






Yeah, I never was a big fan of Unix's term "special file".

-- 
Barry Margolin,  XXXX@XXXXX.COM 
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Similar Threads:

1.[PATCH 3/5] firmware/WHENCE: Use 'File:' field name in front of each file name

2.IPC based on name pipe FIFO and transaction log file

Please critique this design:

Multiple threads of one process communicate with one or more 
threads of another process.

The first process appends (O_APPEND flag) transaction 
records to a transaction log file, and then writes to a 
named pipe to inform the other process that a transaction is 
ready for processing. The transaction log file contains all 
of the details of the transaction as fixed length binary 
records. Any reads of this file use pread().

The second process receives this message and begins 
processing. There are three status codes that are written to 
the transaction log file:
0=New (the first process writes this one using pwrite())

1=Being Processed (the second process writes this one using 
pwrite())

2=Processing is Completed (the second process writes this 
one using pwrite())

As soon as the second process begins processing it marks 
this transaction as [Being Processed], when processing is 
completed it marks this transaction as [Processing is 
Completed] and notifies the first process using another 
named pipe. 


3.using named pipes for core files?

I'm having trouble with not having enough disk space for very large core files.
What I would rather do is have named pipes (called core) be routed to a central
server that reads and preserves the core files.
I have had no luck with this and I suspect it is due to the kernel
using O_NOFOLLOW in do_coredump().
Does anyone know if this is possible (using 2.4.20 or thereabouts)?

I am creating a named pipe (0600) called core and then have a reader blocking
on an open of it, writing to a new file, and then closing the new file.
I have set kernel.core_uses_pid = 0.  The core reader sees the open but
never gets anything on a read.

tks
AGG

4.IPC based on name pipe FIFO and transaction log file

Please critique this design:

Multiple threads of one process communicate with one or more 
threads of another process.

The first process appends (O_APPEND flag) transaction 
records to a transaction log file, and then writes to a 
named pipe to inform the other process that a transaction is 
ready for processing. The transaction log file contains all 
of the details of the transaction as fixed length binary 
records. Any reads of this file use pread().

The second process receives this message and begins 
processing. There are three status codes that are written to 
the transaction log file:
0=New (the first process writes this one using pwrite())

1=Being Processed (the second process writes this one using 
pwrite())

2=Processing is Completed (the second process writes this 
one using pwrite())

As soon as the second process begins processing it marks 
this transaction as [Being Processed], when processing is 
completed it marks this transaction as [Processing is 
Completed] and notifies the first process using another 
named pipe. 




Return to unix

 

Who is online

Users browsing this forum: No registered users and 25 guest