By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,171 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,171 IT Pros & Developers. It's quick & easy.

Run time memory organization

P: n/a
Hi all,

I was reading the book "Write Great Code vol 1" by Ryndall hyde
in this book chapter 11 is named as Memory architecture &
Organization. in this chapter there is a section named "Run time
memory organization"

author goes on to say that the run time memory is divided into
different sections namely

1) The code section (which holds programs machine instructions)
2) The constant section
(which holds compiler generated read only data)
3) The read only data section,that holds user-defined data that only
be read, never written

4) the static section ,which holds user defined ,initialized static
variables

5) The BSS section ,that holds user-defined un - initialized variables

6) The stack section, where program keeps local variables & other
temporary data

7) The heap section , where program maintains dynamic variables

8) the section reserved for O.S

Most of the time , a given application can live with the default
layouts chosen for these sections by the compiler and linker/loader

In some cases, however , knowing the memory layout can allow you to
develop shorter programs.

for ex , as the code section is usually read only , it may be possible
to combine the code,constants, and read-only data sections into a
single section , thus saving any padding space that the compiler/
linker may place between those sections.
Now my question is as follows can anybody give examples for the above
statement??

Oct 3 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
sulekha wrote:
Hi all,

I was reading the book "Write Great Code vol 1" by Ryndall hyde
in this book chapter 11 is named as Memory architecture &
Organization. in this chapter there is a section named "Run time
memory organization"
<snip rest>

Standard C, (which is the primary topic of this group), has no knowledge of
binary formats and runtime memory layouts. Since your question is
intrinsically architecture specific and involves some knowledge of assembly
language, you should ask in <news:alt.lang.asmand
<news:comp.lang.asm.x86>.

BTW, Randall Hyde is a "regular" in both the above groups, so you'll get the
information straight from the "horse's mouth", so to speak.

Oct 3 '07 #2

P: n/a
On Oct 3, 2:27 pm, santosh <santosh....@gmail.comwrote:
sulekha wrote:
Hi all,
I was reading the book "Write Great Code vol 1" by Ryndall hyde
in this book chapter 11 is named as Memory architecture &
Organization. in this chapter there is a section named "Run time
memory organization"

<snip rest>

Standard C, (which is the primary topic of this group), has no knowledge of
binary formats and runtime memory layouts. Since your question is
intrinsically architecture specific and involves some knowledge of assembly
language, you should ask in <news:alt.lang.asmand
<news:comp.lang.asm.x86>.

BTW, Randall Hyde is a "regular" in both the above groups, so you'll get the
information straight from the "horse's mouth", so to speak.
ya i think this can be done in 80x86 0r 80x85 assembly programming
only. there u have quite a control over choosing the range of memory
addresses.

regards,
varun

Oct 3 '07 #3

P: n/a
sulekha wrote:
>
I was reading the book "Write Great Code vol 1" by Ryndall hyde
in this book chapter 11 is named as Memory architecture &
Organization. in this chapter there is a section named "Run time
memory organization"

author goes on to say that the run time memory is divided into
different sections namely

1) The code section (which holds programs machine instructions)
2) The constant section
(which holds compiler generated read only data)
3) The read only data section,that holds user-defined data that
only be read, never written
4) the static section ,which holds user defined ,initialized
static variables
5) The BSS section, that holds user-defined un - initialized
variables
6) The stack section, where program keeps local variables &
other temporary data
7) The heap section, where program maintains dynamic variables
8) the section reserved for O.S
This organization applies to some particular implementation of C,
and is not in the least general. If you want comments on it you
need to go to a newsgroup that deals with that implementation, not
c.l.c. Here we deal with the language as defined in the ISO and
ANSI standards, and earlier by K&R. Variables can exist in static,
auto, or dynamic storage, but how those are implemented is not
defined. How they act is. Code lives in some sort of magic space.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Oct 4 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.