[ As a courtesy to new readers: TCB = "thread control block", the kernel data structure holding thread-specific data including the thread's stack. ]
"Adam 'WeirdArms' Wiggins" awiggins@cse.unsw.edu.au writes:
I was woundering why the TCB size in ix86 L4 is 1K, how much of the stack at the end of the TCB is actually used?
Very little: Most of the time, less than 150 bytes.
Could the TCB be reduced to 512K? If not why not?
^^^^ 512 bytes?
I think it could. L4/x86 has disabled hardware interrupts most of the time, so the theoretical maximal stack usage probably isn't much higher than the one we see, maybe 100 bytes more. I guess Jochen didn't know it was so little when he designed L4, and never changed it later.
In the Fiasco kernel, things are different: This kernel had been written in C++, and it may be interrupted at almost any time; handlers may interrupt each other and stack up on one thread's stack. That's why the theoretical maximal stack usage is much higher. Although I haven't computed it yet, I have estimated that a < 1K stack is too small for the current implementation. That's why Fiasco by default is configured to use 2-KByte TCBs.
Michael