On Saturday, November 30, 2002, at 01:15  AM, Komtanoo Pinpimai wrote:

Sorry. This question is not directly related to Perl. However, I'm so curious for a long time that why unix doesn't allow us to pass parameters to "kill system call". For example, I want to do this:

On most Unix systems, the signal mechanism is mapped onto the CPUs interrupt mechanism.
Or at the very least, modelled after it. An interrupt adjusts the program counter,
may throw a few things on the stack (like the address of the instruction to execute
after the subroutine return, maybe some CPU registers to restore when done.)

Basically, signals are supposed to be lightweight enough to happen at any moment, and
notify a program as soon as possible. This makes them somewhat problematic for perl.
Perl does a lot of things, like memory allocation that shouldn't be interrupted
by another memory allocation call. This made signals problematic for previous
versions of perl, since the programmer isn't in control of memory allocations.
Perl 5.8 handles the signals internally and passes them to the perl script at
convenient times, but those convenient times go against the "as soon as possible"
nature of signals.

Now that we have safe signals, you could use signals just as a notification
system and use some other mechansim, like a fifo to pass the data, and signals
to tell the process to fetch the data.

Another thing to consider, is that if you program needs to receive data from
various places at various times, it seems like it might be the time of system
that might want to be constructed with an event loop.

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Reply via email to