Where did the text segment get its name?
Asked Answered
A

9

43

Traditional assembler, and higher level compilers work with several memory segments, according to intended use. Hence, there is a data segment, a stack segment, a bss, and text segment. The text segment is also called the code segment.

Text segment? For machine code?

I have asked all the old-timers I could find, how something as unreadable as machine code came to be know as the "text segment". Every one of them agreed that, that was really what it was called, but none of them seemed to be surprised by it. And no one could offer an explanation.

Here's your chance to show off your geek history knowledge by enlightening us.

Arsis answered 15/8, 2009 at 18:27 Comment(1)
Maybe a question for the Retrocomputing SE site?Flexion
T
31

Going a little further with nos's comments, I turned up a scanned version of the GE-635 Programming Manual, and found the following in the section on the macro assembler:

The GE-625/635 Macro Assembler is being provided to give the professional programmers some of the conveniences of a compiler and the flexibility of an Assembler. [...] The output options enable him to obtain binary text in relocatable as well as absolute formats.

So, it appears that the use of "binary text" was a GE colloquialism, or perhaps a commonly used term at the time (remember that those were the days when card readers/punches were used for much IO). So, one possible path is GE, to Multics via GE-645, to Unix via Bell Labs' work on Multics, to Linux.

Tanjatanjore answered 15/8, 2009 at 18:45 Comment(2)
It probably goes further back. the PL/1 compiler on multics used to output a text segment - the instructions(code) and a link segmentBalbriggan
The GE-635 more or less pre-dated Multics and the Multics PL/1 compiler, as the original date of that manual linked above shows. So while Multics people do refer consistently to the "text segment" as the file containing executable machine instructions, they may well have got it from the GE folks. Note though that the first PL/1 compiler for Multics, EPL, was written at Bell Labs. I suspect though the use of the word "text" for machine code comes from much earlier in computing history.Chokebore
A
5

Could it be because the program code, be it hard-to-read machine instructions, is really the program text - i.e. the text that contains the instructions? The same as when you call a calculus book a text book, although it is pretty hard to decipher unless you are familiar with the mathematical symbols that are the code..

Axenic answered 15/8, 2009 at 18:33 Comment(0)
C
4

It might have something to do with the fact that the code section was usually read-only, and it could also contain strings of characters for the text messages the program could display to the user as messages. Hence the "text" section. This is in contrast to the "data" section which contains pieces of data that can be modified.

Calculator answered 1/7, 2018 at 4:30 Comment(0)
C
0

From Wictionary:

  1. A written passage consisting of multiple glyphs, characters, symbols or sentences.
  2. A book, tome or other set of writings.
  3. (colloquial) A brief written message transmitted between mobile phones; an SMS text message.
  4. (computing) Data which can be interpreted as human-readable text (often contrasted with binary data).

I suggest that the meaning in computer terms is derived from the fact that the program is what is written into the computer before the program is run, as opposed to the data, which is read in, processed, and then written back out.

Callida answered 15/8, 2009 at 21:3 Comment(0)
G
0

I suggest that the meaning references the assembler (in that case that is for what we are speaking about) language is text, readable text. So the segment .text can be traduced as segment where the code program (text) is written and where the text of the program is, but last is called segment .data. Also it can be called segment .code because is the segment where the program's code is.

In my opinion should be just called: .code (which is text and also it logically differenciates from the other sections).

Grimalkin answered 10/11, 2010 at 20:48 Comment(2)
But what does "code" mean? Before computers and telecommunications, "code" is enciphered ... text! Maybe "text" is a reaction to the word "code". What do you mean it's "code"? Code to you, but to us hackers it is plain text.Timepleaser
"Code" and "cipher" are not the same. Code is just a different way of writing something, maybe more compactly, or with a different set of symbols, while "cipher" is a special type of code, meant to CONCEAL the information from unwanted readers by making it unintelligible to them unless they know how to decipher it (know the "key").Calculator
N
0

I've always imagined it comes form the analogy with human-readable text.

You write in english language a piece of text. It is a string of letters, punctuations, etc. and adheres to certain rules defined by the language (i.e. syntactical, grammatical, etc.). It can be understood by people that know the language.

Similarly, you write (i.e. build) in machine language a "text". It is a string of binary data (digits) and adheres to certain rules defined by the language (i.e. the instruction set architecture). It can be understood (i.e. executed) by processors that know that machine language (i.e. implement the ISA).

IMO the term "code" is less logical. "code" means a piece of information that has been converted (encoded) from it's original form into some alternative representation (for whatever purpose). But with the executable "code", it is not clear which was its the "original" form.

Nmr answered 22/1, 2020 at 11:36 Comment(0)
M
0

The name segment comes from the memory management techniques used in older times, which is now replaced by paging. I believe the name text comes from the analogy with the novel. Like the text in the novel, the code can be thought of as a piece of text in a novel. The text section of the code tells describes the code or it tells the story of what the program does.

I agree with kdgregory's answer, but I think the the binary text notation came from this fact.

Moulder answered 8/6, 2020 at 7:56 Comment(0)
S
0

I would say "text" implied reading. Because the text segment is read-only, I think it comes from the idea of a text book, which is also read-only in the most literal sense.

Either that, or it's some kind of abbreviation that was internally used back in the day, which could have meant something like "To EXecuTe." Though, the etymology would have been lost to time.

Selfinsurance answered 26/8, 2021 at 12:28 Comment(0)
C
0

I guess 'text' means 'the main body of a book', and the 'main body' meaning is borrowed. 'code' might have different meaning that time, so 'text' is used instead of 'code'.

Concupiscent answered 25/3, 2023 at 11:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.