<s>
In	O
computing	O
,	O
a	O
code	B-General_Concept
segment	I-General_Concept
,	O
also	O
known	O
as	O
a	O
text	B-General_Concept
segment	I-General_Concept
or	O
simply	O
as	O
text	O
,	O
is	O
a	O
portion	O
of	O
an	O
object	B-Application
file	I-Application
or	O
the	O
corresponding	O
section	O
of	O
the	O
program	O
's	O
virtual	B-General_Concept
address	I-General_Concept
space	I-General_Concept
that	O
contains	O
executable	B-Application
instructions	O
.	O
</s>
<s>
The	O
term	O
"	O
segment	O
"	O
comes	O
from	O
the	O
memory	B-General_Concept
segment	I-General_Concept
,	O
which	O
is	O
a	O
historical	O
approach	O
to	O
memory	B-General_Concept
management	I-General_Concept
that	O
has	O
been	O
succeeded	O
by	O
paging	B-Architecture
.	O
</s>
<s>
When	O
a	O
program	O
is	O
stored	O
in	O
an	O
object	B-Application
file	I-Application
,	O
the	O
code	B-General_Concept
segment	I-General_Concept
is	O
a	O
part	O
of	O
this	O
file	O
;	O
when	O
the	O
loader	B-Operating_System
places	O
a	O
program	O
into	O
memory	O
so	O
that	O
it	O
may	O
be	O
executed	O
,	O
various	O
memory	O
regions	O
are	O
allocated	O
(	O
in	O
particular	O
,	O
as	O
pages	O
)	O
,	O
corresponding	O
to	O
both	O
the	O
segments	O
in	O
the	O
object	B-Application
files	I-Application
and	O
to	O
segments	O
only	O
needed	O
at	O
run	O
time	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
code	B-General_Concept
segment	I-General_Concept
of	O
an	O
object	B-Application
file	I-Application
is	O
loaded	O
into	O
a	O
corresponding	O
code	B-General_Concept
segment	I-General_Concept
in	O
memory	O
.	O
</s>
<s>
The	O
code	B-General_Concept
segment	I-General_Concept
in	O
memory	O
is	O
typically	O
read-only	O
and	O
has	O
a	O
fixed	O
size	O
,	O
so	O
on	O
embedded	B-Architecture
systems	I-Architecture
it	O
can	O
usually	O
be	O
placed	O
in	O
read-only	B-Device
memory	I-Device
(	O
ROM	B-Device
)	O
,	O
without	O
the	O
need	O
for	O
loading	O
.	O
</s>
<s>
If	O
the	O
code	B-General_Concept
segment	I-General_Concept
is	O
not	O
read-only	O
,	O
then	O
the	O
particular	O
architecture	B-General_Concept
allows	O
self-modifying	B-Application
code	I-Application
.	O
</s>
<s>
Fixed-position	O
or	O
position-independent	B-Operating_System
code	I-Operating_System
may	O
be	O
shared	O
in	O
memory	O
by	O
several	O
processes	O
in	O
segmented	O
or	O
paged	B-Architecture
memory	I-Architecture
systems	O
.	O
</s>
<s>
As	O
a	O
memory	O
region	O
,	O
the	O
code	B-General_Concept
segment	I-General_Concept
may	O
be	O
placed	O
below	O
the	O
heap	B-General_Concept
or	O
stack	B-General_Concept
in	O
order	O
to	O
prevent	O
heap	B-General_Concept
and	O
stack	B-Error_Name
overflows	I-Error_Name
from	O
overwriting	O
it	O
.	O
</s>
