Data segment

OSI Model

A data segment is a datagram, which is used for encapsulation in the OSI model on the fourth layer ( transport layer). A data segment consists of protocol elements that contain Layer 4 information control. When addressing the data segment assigned a layer -4 address, so a port. The data segment is encapsulated in the layer 3 in a data packet.

Protocols of layer 4, which create the data segments are:

  • Transmission Control Protocol (TCP)
  • User Datagram Protocol ( UDP)
  • Stream Control Transmission Protocol ( SCTP ​​)

Programming languages

The term also refers to the separation of data and executable code in programming languages. He can be a section in an object file or in memory, which contains global variables initialized by the programmer. Sometimes pure data, BSS, stack, and heap areas are collectively referred to as "data segment ".

There are separate segments for data and executable code into machine language. Therefore, for example, Intel processors hold registers CS (code segment) and DS ( Data Segment ) ready. Individual commands then refer to either the data or code segment. To calculate a jump instruction such as JMP 0120, for example, the value in CS and the value 0120 which is the absolute address to jump to. Commands for data exchange such as MOV DX, [ BX ], however, relate the current in BX value to the value specified in register DS. Assembly languages ​​provide their own instructions for the definition of segments of data, code, stack, and their order ready ( for example. DATA. CODE. STACK, and others).