473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Run time memory organization

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
3 4183
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: iouswuoibev | last post by:
When writing a function that manipulates data (for example, a string), is it in principle a good or bad idea to allocate/deallocate memory within that function? For example, I have the following...
5
by: Manish Jain | last post by:
Environment: Windows 2000 Server (SP4), ASP.Net/C# (Framework 1.1) Hardware: PIII @ 700 MHz, 512 MB RAM ----------------------------------------------------------------------------...
1
by: Jeremy Cowles | last post by:
Is it possible to pass an instance of a standard C++ class into managed memory and use it (MC++/C#/VB/J#)? I guess I am still foggy on the whole concept of Managed C++. TIA, Jeremy
15
by: Chetan Raj | last post by:
Hi All, We have a web-application in asp.net that interacts with legacy code written in COM. The memory usage in aspnet_wp.exe increases every sec and never reduces. Using the .NET performance...
0
by: mrwilsondg | last post by:
Hi Guys! I am newbie to MS-SQL Server and I’ve run into a very very serious trouble. My company/organization that I am currently with is running MS-SQL Server 2000 Standard and our problem is: ...
53
by: fdmfdmfdm | last post by:
This is an interview question and I gave out my answer here, could you please check for me? Q. What are the memory allocation for static variable in a function, an automatic variable and global...
8
by: Just D. | last post by:
I see in many Internet sources that all 32-bit systems are having limitations and can't address above 2 GB limit for the user application reserving 2 GB more for the system. There are some tricks...
14
by: vivek | last post by:
i have some doubts on dynamic memory allocation and stacks and heaps where is the dynamic memory allocation used? in function calls there are some counters like "i" in the below function. Is...
5
by: Ian Boyd | last post by:
Customer is running a load test against a websphere application that uses DB2. While the load test is running the memory usage of DB2 climbs from x up to y. When the load test ends, the memory...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.