Re: signal question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think Mallozzi is talking not about "write" system call, but a write
instruction to Memory. Plz correct me if I am wrong.

As far as the write instuction is concerned, completion will depend on
the type of signal... For example if its a SIGALRM or SIGKILL or
SIGSTP etc (i.e. the kind of signals which are asynchronous..... i.e.
not generated due to the programs execution stream - or more precisely
- not generated by h/w exceptions due to the *current* instruction by
processor) the write instruction WILL be completed.

If the signals are like SIGSEGV, SIGILL, SIGBUS (on SPARC) etc ( which
are actually sent by the OS after exceptions are raised by the
processor. Processor raises expections when the instruction cannot be
executed), then the write instruction will be aborted without
completing.

Some h/w exceptions like page fautls are handled by the kernel and do
not appear to the process as signals (if the access was legal) and
instead the write instuction in question is restarted again after the
page is loaded. If it was indeed illegal, they come back as a SIGSEGV
to the process and the write instuction stands incomplete (infact it
can never be completed as it was illegal somehow as far as the
processor was concerned).

Hope this helps.

Bhanu.

On 7/27/05, Erik Mouw <J.A.K.Mouw@xxxxxxxxxxxxxx> wrote:
> On Wed, Jul 27, 2005 at 02:35:31PM +0000, Vincenzo Mallozzi wrote:
> > Hi,
> > I've a doubt on the behaviour of processes on receiving a signal. My doubt
> > reguards the write instruction.
> > In other word, if a process is writing into a memory page and receives a
> > signal, what's matter?
> >
> > 1) the process completes the write instruction and then handles the signal, or
> >
> > 2) the process is stopped and then, after the signal handling, continues the
> > execution (if not SIGSTOP signaled)
> 
> 3) The write() call is aborted. The signal handler is called to handle
> the signal. After the signal handler returns, the write() call returns
> the amount of bytes written so far. If there wasn't any data written
> yet, write() returns -1 and errno is set to EINTR. (so that's why you
> should always check return values).
> 
> See "Advanced programming in the Unix environment" for the gory
> details.
> 
> 
> Erik
> 
> --
> Erik Mouw
> J.A.K.Mouw@xxxxxxxxxxxxxx  mouw@xxxxxxxxxxxx
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> 
> iD8DBQFC54Ow/PlVHJtIto0RAiQRAJ9CLDptCqcfAPDAMeqzZoLc3OOdhQCfVIWa
> E+uZS2o2eYni2HwXWx5LE6o=
> =RuM9
> -----END PGP SIGNATURE-----
> 
> 
> 


-- 
The difference between Theory and Practice is more so in Practice than
in Theory.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux