home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsi!ft
- From: ft@cbnewsi.cb.att.com (frederick.d.true)
- Subject: Unlocking named pipes
- Organization: AT&T
- Date: Tue, 17 Nov 1992 06:11:16 GMT
- Message-ID: <1992Nov17.061116.3260@cbnewsi.cb.att.com>
- Followup-To: ftrue@attmail.att.com
- Keywords: named pipe
- Lines: 42
-
- I'm having a bit of trouble figuring out what's wrong with the
- following usage of named pipes. I have 12 large compressed files which
- I would like to merge/sort (they are sorted) without having to
- decompress all of them before merging. So, I've written a simple script
- to create 12 named pipes with mknod, say pipe1..pipe12. I begin
- background processes to zcat each of the 12 files to one of the pipes
- in sequence. I then start 'sort <switches> -m pipe1 .. pipe12 | <stuff> >
- outputfile'.
-
- Things go fine for a while, then the entire process freezes. The
- output stream stops, and all processes go into IW wait, as if waiting
- for something to happen. While in deadlock, if I try to read any of
- the pipes, they each have data waiting, so all seems to be fine. So
- who stopped everything and why?
-
- Sort is able to merge at most 16 files at once, so I don't think
- there's anything wrong there. Is there another anomoly in sort that
- might cause this failure?
-
- As best I can tell, sort found a depleted pipe that zcat couldn't keep
- up with (perhaps sort is reading large buffers?), but no EOF, and
- started sleeping. However, this isn't logical since the sort process
- is followed by 3 other heavyweight processes in the pipe before the
- output is written, so I would think that zcat could feed the pipes
- fast enough. Besides, I thought processes would handle FIFO's normally
- and sleep for at most a few seconds if it found and empty one before
- hitting EOF.
-
- By the way, in case it proves significant: I'm using SunOS 4.1.2 on a
- SPARC. Standard sort, zcat, etc. Named pipes are created with mknod
- -p. I've also tried sleeping for a few seconds before starting things,
- with no results.
-
- Can someone clear up the confusion, or at least add postulations to
- the heap?
-
- Please e-mail to ftrue@attmail.att.com or post here.
-
- --
- Fred True
- AT&T
-
-