Stack puke is the name for a process in which processors in computers save their internal states when they encounter an exception. The term comes from the description of the way the process is visualised – as the processor ‘puking its guts’ into the stack. The stack here, is a LIFO data structure that contains instructions. LIFO means last in, first out, and it describes a way of processing data. Specifically, one where the last bit of data received is the first to be sent out when it has been processed. A LIFO structure in computing is used in lots of ways – syntax parsing, recursive functions, expression evaluation, and more.
The process of stack puking isn’t universal – only some processor architectures do this. To use an older example – the Motorola 68020 does this. If it encounters some kind of exception or fault, the stack puke process runs. It is used to save important internal state information while the error is taken care of and resolved. The process of saving the internal state info can take a while, and lead to a slowing of the processor’s performance while it happens. This is especially true for processors with long pipelines. Of course, slowdowns can happen for a lot of reasons, not just for a stack puke.
Tip: A long time is relative. The time taken will generally be measured in clock cycles, which in modern CPUs are extremely short time periods.
In the case of the Motorola 68020, a stack puke can ‘regurgitate’ up to 92 bytes of data. This can happen when it encounters a bus fault, for example.
Did this help? Let us know!