* GCC and Memory Organization
@ 2002-04-09 15:07 William N. Zanatta
2002-04-09 22:12 ` Glynn Clements
0 siblings, 1 reply; 5+ messages in thread
From: William N. Zanatta @ 2002-04-09 15:07 UTC (permalink / raw)
To: 'linux-c-programming@vger.kernel.org'
Hello brothers,
I have a question on memory organization...
In my Computer Architeture classes, I've learned something like that
there are two ways to organize data in memory.
The first one puts it in a linear mode like:
+---------------+
12k | z | z | | |
|---------------|
8k | y | y | z | z |
|---------------|
4k | x | x | x | y |
+---------------+
And the second way is a non-linear, a block mode like:
+---------------+
12k | z | z | z | z |
|---------------|
8k | y | y | y | |
|---------------|
4k | x | x | | |
+---------------+
The second way should be faster than the first one for memory
management, right?! That a kindda obviuos as it wouldn't be necessary to
scan all the block to find the next entry. Also it can be expensive
since the 4k block is allocated for only 2k of real data.
My question is, how does GCC works with this? Does it have any switch
for optimizing (or not) the code?? What's the default action???
Thank you, keep it hard!
William Zanatta
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: GCC and Memory Organization
2002-04-09 15:07 GCC and Memory Organization William N. Zanatta
@ 2002-04-09 22:12 ` Glynn Clements
2002-04-11 12:48 ` William N. Zanatta
2002-04-11 13:22 ` William N. Zanatta
0 siblings, 2 replies; 5+ messages in thread
From: Glynn Clements @ 2002-04-09 22:12 UTC (permalink / raw)
To: William N. Zanatta; +Cc: 'linux-c-programming@vger.kernel.org'
William N. Zanatta wrote:
> I have a question on memory organization...
> In my Computer Architeture classes, I've learned something like that
> there are two ways to organize data in memory.
> The first one puts it in a linear mode like:
>
> +---------------+
> 12k | z | z | | |
> |---------------|
> 8k | y | y | z | z |
> |---------------|
> 4k | x | x | x | y |
> +---------------+
>
> And the second way is a non-linear, a block mode like:
>
> +---------------+
> 12k | z | z | z | z |
> |---------------|
> 8k | y | y | y | |
> |---------------|
> 4k | x | x | | |
> +---------------+
>
> The second way should be faster than the first one for memory
> management, right?! That a kindda obviuos as it wouldn't be necessary to
> scan all the block to find the next entry. Also it can be expensive
> since the 4k block is allocated for only 2k of real data.
>
> My question is, how does GCC works with this? Does it have any switch
> for optimizing (or not) the code?? What's the default action???
This isn't a compiler issue. The different layouts would require
different source code. The former corresponds to a one-dimensional
array, while the latter corresponds to a two-dimensional array.
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-04-11 14:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-09 15:07 GCC and Memory Organization William N. Zanatta
2002-04-09 22:12 ` Glynn Clements
2002-04-11 12:48 ` William N. Zanatta
2002-04-11 13:22 ` William N. Zanatta
2002-04-11 14:07 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).