简体   繁体   中英

Signal Stack

I did read that signals need to have a separate stack, why and how do you think it is implemented ?

Are they dynamically allocated or statically allocated ? How is memory allocation done ? Is it the same for all signals ?

The reason that signals need a separate stack is that, if the normal stack gets corrupted or overflows, the signal can still execute. I think the signal stack is usually allocated dynamically, but it could implemented be either way. You can set a new signal stack with sigaltstack . It is the same for all signals.

Another, more esoteric reason is to create user-level threads. See the paper, "Portable Multithreading" by Ralf Engelschall: http://www.gnu.org/software/pth/rse-pmt.ps . It describes how the "signal stack trampoline trick" is used to effect userspace threading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM