AllenDowney / ThinkOS

Text and supporting code for Think OS: A Brief Introduction to Operating Systems, by Allen Downey.
554 stars 222 forks source link

Fix typo in 3.5: static vs global segments #32

Closed numberMumbler closed 5 years ago

numberMumbler commented 5 years ago

Corrects line to use "global" instead of "static" segment.

At the end of section 3.5, the book states that a static local variable "is allocated in the static segment along with global variables".

However, the previous section states that "globals segment contains global variables and local variables that are declared static." The "static segment contains immutable values, like string literals". This is confirmed by adding the static int to the code example in section 3.4 and observing that the address is 128 bits (0x70) larger than global.

AllenDowney commented 5 years ago

Good catch. Thanks!