answersLogoWhite

0


Best Answer

The BSS segment is where all uninitialised static variables are allocated at runtime. BSS is an acronym for Block Started by Symbol, however it can also be referred to as the BES segment (Block Ended by Symbol) depending on how it is physically implemented. Regardless of how it is implemented, we can simply refer to it as the uninitialised data segment.

Unlike the data segment which is initialised directly from a bitmap image stored within the object file itself, the uninitialised data segment is dynamically instantiated at load time as a contiguous block of zero-initialised memory. Only the length of the block need be stored in the object file.

Uninitialised static variables are simply those that have not been explicitly initialised. Static variables may be declared globally (at file scope, outside of any function) or locally (inside a function):

int x; // uninitialised global variable

void foo () {

static int y; // uninitialised local variable

}

Both x and y will be allocated in the uninitialised data segment.

Although all constant variables must be initialised at the point of declaration in C, a constant variable that is initialised with the value zero may be allocated in the uninitialised data segment rather than in the initialised data segment where all other initialised static variables and constant variables are allocated. Similarly with static variables initialised to zero. This helps reduce the size of the object file and thus improves load time.

In memory, the text segment (.text) contains the executable code and is loaded first, followed by the data segment (.data) and finally the BSS segment (.bss). The object file header allows the program loader to allocate memory to all three segments as a single contiguous allocation. The .text and .data segments are initialised from bitmap images stored within the object file itself while the .bss segment is typically zero-filled-on-demand. However, in embedded systems software, the C runtime must initialise the BSS segment prior to entering main().

User Avatar

Wiki User

βˆ™ 8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is BSS segment in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can a processs BSS segment grow during program execution?

No. The size of the data segment (which includes the BSS) is determined at compile time and cannot change at runtime. The data segment stores all the program's constants, global variables and static variables, the total size of which can be determined at compile time and is therefore fixed at that point. BSS is an abbreviation of Block Start by Symbol and is used specifically to allocate all global and static variables that are either in an uninitialised state or are explicitly initialised to zero. Global and static variables initialised with non-zero values are allocated separately from the BSS, as are all the constants.


Which segment is included by A and C?

ab


What is the meaning of near and far declaration in microprocessor programming using C?

Programs that are loaded into memory typically have several segments associated with them: the Code Segment (CS), the Stack Segment (SS), the Data Segment (DS), sometimes an Extended Segment (ES), and almost always a Block Started by Symbol (BSS) segment. This question requires that we focus only on the Code Segment (CS). The CS is a segment of memory that contains some of the instructions that are required for the program to execute. If this segment is not large enough to contain the whole program then the program can be loaded into different segments. Such a segment may be 64Kb in size (although the size may differ). Instructions located in these segments are referred to by their offset from the start of the segment, and not by their absolute location in memory. Thus, in order to locate a certain instruction, we need the segment's starting address, and the offset of the instruction in that segment. Whenever a branch (jump, goto) takes place which refers to an instruction that is located in another segment, it is known as a far jump, conversely whenever a jump refers to an instruction that is located in the same segment, it is known as a near jump. The difference referring to the modication of the CS register which contains the address of the current Code Segment for the current running program.


What is the meaning of BSS engineer?

base subsystem station


What is Code segment in C program?

A code segment, also known as the text segment holds all the executable instructions of the process. The text segment usually starts from the lowest address space of the process memory (leaving behind a small unmapped memory ..not mapped to a physical memory) --Vivek Purushotham (vivek.purushotham@gmail.com)

Related questions

What is bss in c?

BSS is block started with symbol


Where the static variables are stored?

initialize static variables are stored in data segment where uninitialized static variables are stored in BSS(block storing for Symbol) it also a part of data segment exp static int i=10;//stored in data segment static int i;//stored in BSS (uninitialized data segment) Thanks NAvin


Can a processs BSS segment grow during program execution?

No. The size of the data segment (which includes the BSS) is determined at compile time and cannot change at runtime. The data segment stores all the program's constants, global variables and static variables, the total size of which can be determined at compile time and is therefore fixed at that point. BSS is an abbreviation of Block Start by Symbol and is used specifically to allocate all global and static variables that are either in an uninitialised state or are explicitly initialised to zero. Global and static variables initialised with non-zero values are allocated separately from the BSS, as are all the constants.


Where can you find information on BSS?

Information on BSS can be found in many places, but the most recommended places to find information on BSS is in books and ebooks that detail the C programming language or, if using a specific compiler, in literature regarding that specific compiler.


What is the meaning of BSS engineer in telecom?

bss


Which segment is included by angle a and angle c?

Which segment is included by A and C?


What is the population of BSS Group?

The population of BSS Group is 4,800.


When was BSS Group created?

BSS Group was created in 1899.


What is a segment that have the same lenght?

Congruent line segment


How common is BSS?

Although specific incidence is unknown, BSS is estimated to occur in 200-400 injuries


Which of these segments has an endpoint c and midpoint b?

A+ = segment C A


Which segment is included by A and C?

ab