What is global address space? - caching

I was reading about Cache-only memory access on Wikipedia. There is a line saying that "In NUMA, each address in the global address space is typically assigned a fixed home node". I don't know what is global address space. Can someone tell me what is global address space?

In a machine with multiple nodes, each node has a set of addressable memory locations--its local address space. The global address space of the machine is the union of these sets.

Related

What is the difference between kernel logicla address space , kernel virtual address space and user virtual address space

Let me put my understanding.
Suppose we have a 32-bit memory address space for a system. So a process can access any memory in the 4GB range
If the RAM in the system we have of 4GB, kernel divides it into 1:3 . 1GB for kernel , and rest 3GB for the user space process.
A user space process will get the system memory access within that 3GB memory only and which address it gets is determined by the page table.
Kernel logical address is that 1GB ( approx ~896MB) memory which is being reserved only for the kernel. Is this correct?
kernel virtual address is the memory left i.e. 104MB + 3GB that also can be assigned to userspace. Is this correct?
user virtual address is the address generated by the user space process and its corresponding memory would be assigned from the 3GB reserved for the user space process by the kernel.
Let me know if my above understanding is correct? If not can you please explain in detail the difference between kernel logical address space , kernel virtual address space and user virtual address space.
your understanding is a mixture of right and wrong, I'll try to point to some of them:
in 32 bit machines, we're not always limited by 4GB addressable RAM, check this question for more detail: link
the memory is an abstraction for the user space programs, they see it a a continuous big chunk of memory, but the kernel manages this abstraction with some hardware support named MMU, to map the used virtual space in the user space program into an actual physical address or even some bloc in hard drive if swapping is activated.
the kernel can actually access to the physical memory, in order to manage the abstraction mentioned above, it can also use this abstraction, this depends on the designer of the kernel.
as for the difference between the virtual and logical addressing, check this answer: link

Are the memory addresses stored in the general purpose registers relative?

When a program stores a memory address within a general purpose register is that address local/virtual to the process?
Is it likely that two completely different program doing different things would load the same memory address into the general purpose registers?
Are the memory addresses stored in the general purpose registers relative?
No. They are parallel. One kind of addresses is translated into a second kind of addresses by the Memory Management Unit.
When a program stores a memory address within a general purpose register is that address local/virtual to the process?
It is just a value in a GPR. This value can used to access an address which is a virtual address in a user process. This address is unique for each process.
Is it likely that two completely different program doing different things would load the same memory address into the general purpose registers?
Two different programs can use the same address in a GPR to access two different physical memory locations. The address translation from virtual address to physical address is done by the MMU.
Program 1:
Virtual address ^ Physical address
0x04000000 = 0x00001234
Program 2:
Virtual address ^ Physical address
0x04000000 = 0x12345678
The virtual address of both processes is identical.
The physical address is not.
The difference between both is handled by the MMU which translates one to the other for each process.
The CPU works with virtual addresses. If two different processes place the same virtual address in a register it will not matter because each virtual address will translate into a different physical address (with help from the OS*).
*in more details:
The OS is responsible for assigning an address, in a special register, that points to the start of an address translation table. that table (and its address) is unique for every process.

kmap for HIGHMEM

I use kmap to get logical address of page but I'm a bit confuse about high memory. If the page lies at high memory, what does kmap return? One source said that logical address, another - the linear address of descriptor of page.
The aim is getting directly access to physical pages' content by transforming vma addresses into linear kernel space address of certain pages.
kmap always returns a virtual address that addresses the desired page. If the page is already accessible -- i.e. it already has a valid kernel virtual address (because, say, it's in the FIXADDR area and hence already mapped) -- then that address is simply returned to you. If it's in the highmem area, then a temporary virtual address mapping is established and a valid virtual address of the memory is returned.
The transformation referenced by your last sentence is a bit ambiguous, but since you have a "struct page" I assume you mean a page that came from a vm_struct-described mapping? ("vma" is somewhat overloaded)
In any case, assuming your real aim is just to obtain an address through which you can "directly" modify and examine a designated location in arbitrary physical memory in the case where you already have a 'struct page', kmap should work for you.
By definition kernel logical address (also called as linear address) are virtual address in kernel space that can be translated into physical address by subtracting a fixed offset.
The range of kernel address space is a fixed compilation time parameter so if virtual address space runs from 3G - 4G (say) then low mem can run from 3G - OFFSET to 4G - OFFSET. Pages outside this range is high memory. Therefore there can be no kernel logical address for a high memory page.
kmap() creates a mapping for the high memory page into kernel address space and returns a virtual address, which can be accessed to get to the high mem page's contents.

Windows - How does this memory addressing work?

Assuming x86, I'm starting to learn that addresses 0x0 thru 0x7FFFFFFF are for the process; whereas anything higher is reserved for the kernel.
I have three curiosities:
1) Does a process EVER call an address higher than 0x7FFFFFFF? I assume it will always result in some sort of access denied? How is that access denied enforced?
2) Does "shared memory" IPC work by mapping two processes virtual addresses to the same physical address range?
3) The amount of RAM in your machine can vary. You may have 2GB, or much more like 16GB. How does this affect the addressing of RAM? Does the kernel ever leave a bunch of RAM unused because it was reserved for itself, but doesn't need it? How can I see this?
I am not very sure but you will find the maximum in this MSDN doc about how it works:-
The range of virtual addresses that is available to a process is
called the virtual address space for the process. Each user-mode
process has its own private virtual address space. For a 32-bit
process, the virtual address space is usually the 2-gigabyte range
0x00000000 through 0x7FFFFFFF. For a 64-bit process, the virtual
address space is the 8-terabyte range 0x000'00000000 through
0x7FF'FFFFFFFF. A range of virtual addresses is sometimes called a
range of virtual memory.
The diagram shows the virtual address spaces for two 64-bit processes:
Notepad.exe and MyApp.exe. Each process has its own virtual address
space that goes from 0x000'0000000 through 0x7FF'FFFFFFFF. Each shaded
block represents one page (4 kilobytes in size) of virtual or physical
memory. Notice that the Notepad process uses three contiguous pages of
virtual addresses, starting at 0x7F7'93950000. But those three
contiguous pages of virtual addresses are mapped to noncontiguous
pages in physical memory. Also notice that both processes use a page
of virtual memory beginning at 0x7F7'93950000, but those virtual pages
are mapped to different pages of physical memory.

Address shown is real address or logical address

When we print the address of variable does it represent the actual physical address or logical address ..
In debug mode (visual studio) same address is shown repeatedly .
When you print the address of a variable it is always the virtual address.
Physical memory is abstracted away from you at a low level in your operating system, during normal operation users and developers will seldom ever be concerned with physical memory.
Learn more about virtual memory from Wikipedia

Resources