1

For my assignment I'm given the question to have a parent process send "user inputted" lines of text VIA signal to the child and have it print out the line of text.

I'm seriously confused. I've read the whole chapter in my book on signals and it seems for the most part they are only used for termination, pauses, alerts. I originally thought through the alerts I could do that, But I'm honestly unsure. Is there a way to pass data through signals.

Andrew Ricci
  • 475
  • 5
  • 21
  • 1
    No, signals don't themselves pass data. But you can use a signal to mean "Hey! Wake up! I've left data for you in the usual place.", that usual place being a file or pipe or something. – Lee Daniel Crocker Oct 14 '15 at 00:24
  • Further, note that if the 'usual place' mentioned by Lee is a pipe, then you don't really have to send a signal to the child. It could simply be sitting waiting to read data from the pipe. When the parent writes to the pipe, the kernel will let the child know there is data ready by letting the read return (with the data). – Jonathan Leffler Oct 14 '15 at 00:44

1 Answers1

1

POSIX signals (what we call signals in UNIX speak), are just events, so the only data you are sending is that it happened. This does of course not prevent people from talking about signals in other contexts or with different meanings...

Michael
  • 3,639
  • 14
  • 29