#9678: Rewrite interrupt handling
------------------------------+---------------------------------------------
   Reporter:  jdemeyer        |       Owner:  tba                        
       Type:  task            |      Status:  needs_work                 
   Priority:  major           |   Milestone:  sage-feature               
  Component:  c_lib           |    Keywords:  interrupt, error, c, cython
     Author:  Jeroen Demeyer  |    Upstream:  N/A                        
   Reviewer:                  |      Merged:                             
Work_issues:                  |  
------------------------------+---------------------------------------------
Description changed by jdemeyer:

Old description:

> There are lots of things to be improved in the interrupt handling
> routines in c_lib/src/interrupt.c and c_lib/include/interrupt.h.
>
> Major changes planned:
>  * '''DONE''': make {{{sig_on()}}} have function syntax so that we can
> declare it {{{cdef int sig_on() except 0}}}.  See #10115 for the syntax
> changes.
>  * '''DONE''': do not save signals in {{{sigsetjmp()}}} (by giving a
> second argument of 0 instead of 1).  This speeds up a sig_on/sig_off loop
> from 382 clock cycles to 24 clock cycles on a Core(TM)2 Duo CPU T5870 @
> 2.00GHz running Linux 2.6.32 glibc 2.11.2.
>  * '''DONE''': using {{{sigaction()}}} instead of {{{signal()}}} since
> that has more well-defined semantics.
>  * '''DONE''': handle SIGINT differently from other signals (other
> signals are urgent and cannot be ignored.  SIGINT on the other hand does
> not need to handled immediately, but we have to be careful for race
> conditions).
>  * '''DONE''': allow {{{sig_on()}}} and {{{sig_off()}}} to be nested.
>  * '''IN PROGRESS''': implement {{{sig_retry()}}} for retrying failed
> computations (this is useful for PARI, see #10018).
>  * have an interface for more general errors which are not signals.
>  * '''DONE''': clean up old, unused code.
>  * '''IN PROGRESS''': testing interrupt handling: #10030.
>  * '''IN PROGRESS''': fix breakage because of this patch: #10061.
>  * '''IN PROGRESS''': documentation: #10109.
>  * allow to temporarily suspend interrupts and do this in
> {{{sage_malloc()}}} and friends (an interrupt during {{{malloc()}}} will
> mess up the heap, this happens sometimes with a "fixed"  #9564!)
>  * '''DONE''': eliminate race condition when a SIGINT arrives before
> {{{sig_on()}}} or during {{{sig_on()}}}.
>
> Other related tickets:
>  * #800 (make _sig_on and _sig_off faster when stacked)
>  * #9640 (Change PARI error catching mechanism)
>  * #9564 (libsingular exponentiation can not be interrupted)
>  * #7879 (Remove unnecessary signal handling for low prec mpfr
> operations) --- hopefully {{{sig_on()}}} and {{{sig_off()}}} can be made
> very fast such that this shouldn't be an issue anymore.
>  * #10018 (Unhandled SIGSEGV after bnfcertify())
>  * #7794 ({{{PolynomialRing_integral_domain}}} ignores Ctrl-C and
> segfaults)
>  * #5313 (patch singular so that when it runs out of memory the error
> message says "singular" in it)
>  * #3423 (Make Pari error messages more informative)
>  * #10126 (Fix error handing in Matrix_rational_dense._invert_pari())
>
> Patch chain: #9893, '''#9678''', #10061, #10030, #10018, #9640

New description:

 There are lots of things to be improved in the interrupt handling routines
 in c_lib/src/interrupt.c and c_lib/include/interrupt.h.

 Major changes planned:
  * '''DONE''': make {{{sig_on()}}} have function syntax so that we can
 declare it {{{cdef int sig_on() except 0}}}.  See #10115 for the syntax
 changes.
  * '''DONE''': do not save signals in {{{sigsetjmp()}}} (by giving a
 second argument of 0 instead of 1).  This speeds up a sig_on/sig_off loop
 from 382 clock cycles to 24 clock cycles on a Core(TM)2 Duo CPU T5870 @
 2.00GHz running Linux 2.6.32 glibc 2.11.2.
  * '''DONE''': using {{{sigaction()}}} instead of {{{signal()}}} since
 that has more well-defined semantics.
  * '''DONE''': handle SIGINT differently from other signals (other signals
 are urgent and cannot be ignored.  SIGINT on the other hand does not need
 to handled immediately, but we have to be careful for race conditions).
  * '''DONE''': allow {{{sig_on()}}} and {{{sig_off()}}} to be nested.
  * '''IN PROGRESS''': implement {{{sig_retry()}}} for retrying failed
 computations (this is useful for PARI, see #10018).
  * have an interface for more general errors which are not signals.
  * '''DONE''': clean up old, unused code.
  * '''IN PROGRESS''': testing interrupt handling: #10030.
  * '''IN PROGRESS''': fix breakage because of this patch: #10061.
  * '''IN PROGRESS''': documentation: #10109.
  * allow to temporarily suspend interrupts and do this in
 {{{sage_malloc()}}} and friends (an interrupt during {{{malloc()}}} will
 mess up the heap, this happens sometimes with a "fixed"  #9564!)
  * '''DONE''': eliminate race condition when a SIGINT arrives before
 {{{sig_on()}}} or during {{{sig_on()}}}.

 Other related tickets:
  * #800 (make _sig_on and _sig_off faster when stacked)
  * #9640 (Change PARI error catching mechanism)
  * #9564 (libsingular exponentiation can not be interrupted)
  * #7879 (Remove unnecessary signal handling for low prec mpfr operations)
 --- hopefully {{{sig_on()}}} and {{{sig_off()}}} can be made very fast
 such that this shouldn't be an issue anymore.
  * #10018 (Unhandled SIGSEGV after bnfcertify())
  * #7794 ({{{PolynomialRing_integral_domain}}} ignores Ctrl-C and
 segfaults)
  * #5313 (patch singular so that when it runs out of memory the error
 message says "singular" in it)
  * #3423 (Make Pari error messages more informative)
  * #10126 (Fix error handing in Matrix_rational_dense._invert_pari())

 Patch chain: #9893, #9345, '''#9678''', #10061, #10030, #10018, #9640

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9678#comment:21>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to