home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:4316 comp.unix.misc:3236
- Path: sparky!uunet!sybus.sybus.com!myrddin!tscs!bailey
- From: bill@bailey.UUCP (Bill Glidden 882-8369)
- Subject: Re: Process & Signal Question
- Newsgroups: comp.unix.programmer,comp.unix.misc
- Date: 15 Aug 92 05:15:54 GMT
- Distribution: world
- Message-ID: <1657227@bailey.UUCP>
- Organization: Ben Bailey's Home..Tampa Fl.
- Sender: news@bailey.UUCP (GNEWS Version 2.0 news poster.)
- Lines: 26
-
- herberj@prism.CS.ORST.EDU (John Wesley Herberg) writes:
- >
- > 1 - Is there an effecient way for one process to know if another is running
- > when the only thing you know about it is its name. The way I'm doing it now
- > is grabbing info for all the processes by using pstat(an HP-UX call) &
- > searching through that info for a matching process name. Is there some type
- > of call I could do on the executable to see if it is in use. I noticed
- > make doesn't allow you to update a file when its being used - how does it know?
- >
- Make knows the executable is in use because when you fopen or open a file for
- create and it is in use, the operating system returns an error condition to
- the calling program. Of course, I don't recommend this for your situation.
-
- > 2 - In Marc Rochkind's "Advanced Unix Programming", he says it's not a good
- > idea to use the SIGUSR1/2 signals for user defined signals. Why? All I want
- > to do is notify another process of an event & I don't want the overhead of a
- > msg, shared mem, etc. Seems to me this would be the most effecient way. Is
- > there something else I should know about using signals?
- >
- I believe the point he is trying to make (on page 211) is that a signal is
- not recommended for inter-process communication, because signals have no
- information content. As an event trigger, though, I think that a signal
- works just fine if you are willing to code the overhead of catching and
- resetting it. Also, how often will you be signalling the other process?
- If it is more than once, remember to reset the signal catching function
- for SIGUSR1 immediately upon entering the signal catching function.
-