memory management - Combine data segment and bss segment -


why process creates 2 segments program variables, mean data segment , bss segment. in other world, since both intended represent program's variables , both read/write segments why not combined in 1 segment?

data in .data segment has different values determined when executable file itsself created, i.e., @ build time, includes compile , linking time.
stored directly in executable file , therefore consumes space in , core image loaded memory.

otoh, data in .bss segment has value 0 default (even though think pre-dos oses left value uninitialized 0 enforced c , c++ standards anyway). opposed data in .data, may have variety of values, 1 each datum, data in .bss need not initialized explicitly arbitrary values. in conclusion, variables from .bss do not consume space in executable file or core image. created @ runtime os.

these properties render merging both segments infeasible. @ cost of increased core image, .bss section eliminated, defeat purpose of it.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -