473,486 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Address stored by pointers is PHYSICAL or LOGICAL

24 New Member
Me and 1 of my friend were arguing, over the nature of address stored by pointers in c language.

He was saying that its logical address, while i thought he is wrong. can anyone plz tell me who is right, he or me, plz give the reasion for the same.

thanx in advance.
Jul 4 '10 #1
9 6699
Banfa
9,065 Recognized Expert Moderator Expert
Its platform dependent. I don't know what a "logical" address is but on a platform like Windows where ever program has a virtual address space your pointers will be storing virtual addresses in that address space.

On a simple embedded platform where the process has direct access to the physical memory then you might well be storing the direct physical address of them memory.
Jul 4 '10 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
The logical address is what is stored in a pointer.

The logical address is determined by a model called the address space. This model may contain more elocations that there is memory in the computer. No matter.

There is no relationship between the logical address and the physical memory location in the computer.

The operating system will convert these logical addresses to physical addresses as the program runs.
Jul 4 '10 #3
tyagithehacker
24 New Member
@Banfa
can you please tell me what type of plateform "UNIX red hat" is...??
Jul 13 '10 #4
tyagithehacker
24 New Member
@weaknessforcats
can you please explain this line of yours..

"There is no relationship between the logical address and the physical memory location in the computer."

As i feels that there is a corresponding physical address to each and every logical address.
Jul 13 '10 #5
donbock
2,426 Recognized Expert Top Contributor
I guess I would rephrase weaknessforcat's statement as
"There need not be an obvious relationship between the logical address stored in a pointer variable and the corresponding physical memory address in the computer."

For example, consider an operating system that swaps memory pages to and from the hard drive. Each time a given page swaps in it will typically reside in a different block of physical memory. The logical addresses are still the same, but the corresponding physical addresses have changed. The relationship is dynamic; that is certainly non-obvious.
Jul 13 '10 #6
Banfa
9,065 Recognized Expert Moderator Expert
can you please tell me what type of plateform "UNIX red hat" is...??
Like Windows Linux uses a swap drive and a virtual address space/map.


When weaknessforcats says there is no relationship between the logical address and the physical memory location that is not quite accurate. There is a relationship of some sort but it is controlled by the memory manager and is dynamic so you would have no way of determining what it is.

So for all intents and purposes from your (or your programs) point of view there is no relationship that you can use. The memory manager in the OS will know what the relationship is.
Jul 13 '10 #7
tyagithehacker
24 New Member
@Banfa
As u said before:-

On a simple embedded platform where the process has direct access to the physical memory then you might well be storing the direct physical address of them memory.

can u please tell me some/any of the OS/plateforms where processes has direct access to physical memory.

does it mean that under those OS/plateforms there is no memory manager exist.

and if there is no virtual space or swap partition present in such OS, then how the swapping (or multiprocessing more technically speaking) is done there.

----thanx in advance. :-)
Jul 13 '10 #8
Banfa
9,065 Recognized Expert Moderator Expert
On many micro-controllers and micro-processors the program will be using direct physical addresses, for example, ARM, PIC, ST20, 68000, such platforms do not have a memory management unit by default.

There are many OSs available for these platforms such as ThreadX, uCOS/uCOSII, vxWorks, OpenOS, Nucleus, these tend to be relatively light OSs just providing a threading facility with task synchronisation objects, may be some timing facilities and memory management code. Some, like ThreadX, vxWorks, Nucleus have lots of optional modules for control of various hardware peripherals (USB stack, network etc).


On the other hand some micro-controllers, e.g. Cyan eCog1x, have on board memory management units separating logical address from physical address.

Virtual memory/swap partitions just provide an extra source of RAM albeit slower. Normally platforms with swap space use it to store the data for programs that are not currently running. However any system whether it has virtual memory or not is limited to using only the memory it has available.

Your available memory on a system with virtual memory is (virtual memory size* + physical ram size) on a system without virtual memory you are limited to physical ram size.

In either case the OS has to find space for all the memory required for all the processes it is currently running. Although it is not normal for a program to directly access the virtual memory, the OS will swap pages of virtual memory into an out of physical RAM so that the running programs data is in RAM for access.

On an embedded platform normally you will only be running 1 process, possibly with multiple threads.




*Note windows can dynamically increase the size of its virtual memory size however if you get to that point in my experience you will be suffering serious system degradation because too high a proportion of ram is being served from virtual memory.
Jul 13 '10 #9
tyagithehacker
24 New Member
@Banfa
wow, very nicely answered. thanx :-)
Jul 13 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

53
4491
by: Alf P. Steinbach | last post by:
So, I got the itch to write something more... I apologize for not doing more on the attempted "Correct C++ Tutorial" earlier, but there were reasons. This is an UNFINISHED and RAW document,...
2
1272
by: Greg Gongola | last post by:
I think the question speaks for itself, but just to elaborate... I would like to e-mail a report to one or more e-mail addresses that are stored in a Hyperlink field of an Access table. ...
26
3091
by: Adam Warner | last post by:
Hello all, I'm very new to C but I have a number of years of Common Lisp programming experience. I'm trying to figure out ways of translating higher order concepts such as closures into C. The...
4
301
by: Chathu | last post by:
Help me.... I'm new to the pointers. I can't understand the meaning. Can anybody tell me the meaning of this code fragment. float *flp,*flq; *flp=*flp+10; ++*flp; (*flp)++; flq=flp;
23
2937
by: junky_fellow | last post by:
I have a question related to pointer/integer conversion. After reading various threads on this newsgroup I found that pointer/integer conversion is not portable and may lead to undefined results...
3
2616
by: elvira_wang | last post by:
heya, what sort of address is displayed when this instruction for instance is executed printf("myvar location is 0x%lx\n", (long) &myvar); is it logical address or linear address, i.e. with...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.