HI, will anyone let me know the differences between the normal unix file and named pipe file? Regards
HI, will anyone let me know the differences between the normal unix file and named pipe file? Regards
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 ***
> 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
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
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
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 ***
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
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
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 ***
More traditional outside of unix, but it is the standard unix terminology. "Everything is a file" and all that. 3ch
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 ***
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.
Users browsing this forum: No registered users and 25 guest