Arista Networks Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: In-Person
BSS is a segment in RAM.
_en.wikipedia.org/wiki/.bss
_en.wikipedia.org/wiki/Data_segment
In computer programming, the name .bss or bss is used by many compilers and linkers for a part of the data segment containing statically-allocated variables represented solely by zero-valued bits initially (i.e., when execution begins). It is often referred to as the "bss section" or "bss segment".
In C, statically-allocated variables without an explicit initializer are initialized to zero (for arithmetic types) or a null pointer (for pointer types). Implementations of C typically represent zero values and null pointer values using a bit pattern consisting solely of zero-valued bits (though this is not required by the C standard)
mapped to virtual address or physical address?
usually in virtual space, BSS is mapped below the data segment but does not really occupy any space in the image per say as u only need it when referencing it (since they are zero), space is created in memory.
Compilers put it in virtual space, i dont see why BSS cannot really occupy the virtual address of the text area, its just the standard is more like text,data,bss , you can design or configure your compiler to do it, but make sure of CPU requirements and page boundaries
In physical space, theoretically, i still see no reason why they cannot occupy the physical frame 0, practically, interrupt handlers occupy that space and for a reason, isr dont use MMUs or 1-1 MMUs if CPU has MMU always on , but again, very very secure systems can relocate the ISRs to another location in physical memory , this could be a very good research study
Note: being in lowest memory location has got nothing to do with NULL pointer, thats C issue, you can load contents via assembly from address 0! (again see the CPU architecture)
What's BSS?
- eugene.yarovoi January 15, 2012