On Wed, Mar 12, 2008 at 12:44:57PM +0530, srimugunthan dhandapani wrote:
> Can anybody explain what is the advantage of using a separate segment(Bss)
> for uninitialised variables and a seperate segment(data) for initialised
> variables.Why not have a single segment?
> 
> I learnt from the web that "The advantage in using the bss segment for
> storage that
> starts off empty is that the initialization information need
> not be stored in the output file."

That is correct.

> But i dont understand to which output file they are talking about , and the
> initialisation information is written to.

The output file is the binary, or in the kernel case, the kernel image
(vmlinux).

The content of the BSS is initialised to zero (as required by the C
standard). Instead of storing a large amount of zero bytes in the
output image, you only write down "we need this many bytes of zero in
the BSS" and have the runtime initialisation clear the BSS.


Erik

-- 
Erik Mouw -- [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to