| |
| Stacks go on a free list after they are allocated. |
| |
| User may allocate thread descriptors, which then is given a stack when |
| the function bound to the thread first runs. When it exits, the stack |
| is freed and returned to the free list. Stack areas above the topmost |
| thread are simply discarded. |
| |
| Thread descriptors persist even after the bound function returns or |
| invokes thread exit routine, since return code is saved there. |
| |
| mips require simplified context switch longjmp because Mach on mips |
| (aka pmax) had code to prevent longjmp to a greater stack address. |
| |
| stack_est marks the stack with values, call printf while multithreaded |
| and also force a few context switches, and then looks at the stack to |
| see how much was modified. The parameter -s specifies how much stack |
| space to -allocate- for the threads. The program will mark half of |
| that space (leaving the rest alone just in case) and test for usage. |
| If the output is approximately half of the -s value, re-run the |
| program with a larger value. The output is a reasonable baseline for |
| stack usage for the architecture on which stack_est was compiled. The |
| programmer will still have to raise that per-thread value as his code |
| requires (call depth + automatic variable usage). |