Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

Process segments(stack,heap,data and code) are contiguous in memory?

Can some body help, does all segments belongs to process are contiguous in the memory? if yes then why those should be in contiguous?.

as per my understanding stack comes down and heap grows up(depends on CPU architecture) that shows all segments lay one by one(tightly coupled).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. Segments themselves are architecturally dependent. Few processors other than Intel use segments. In addition, there are no segments in 64-bit mode on Intel processors.

  2. If you are on an intel processor, not-64-bit-mode, the segments are virtually contiguous. The heap does not interleaves with the code. However, their may be discontinuities in the virtual memory within a segment in systems that support that.The segments do not have to be contiguous with each other.

  3. If you are running on a system without segments, the code, heap, and data can be interleaves. However, each stack must be contiguous.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...