Dear all,
I am new in this forum, I am looking for answers to my issues.
Actually, I am working in thesis on implementation shared memory programming model under real-time constraints.
My platform consists from multiple cores connects through network on-chip and access to memory off-chip. The memory model divides to private local memory for each core and shared region for all. Each core has own OS and access to memory by using lookup table (LUT), also each core has L1 and L2 caches and didn't has cache coherency between cores. This is description briefly for my platform, and I aim to porting programming model for this system, has real time shared features.
However, There is big issue in this system. It is memory addressing, when core allocated object in shared memory space, should make sort translation to address and send the offset to consumer core. The consumer core also do the same procedure to get the correct address space, since the virtual address is not valid for other cores. So, the access on it can not be accomplished with simply passing the proper pointer.
Therefore, I am looking to ideas or solution to manage this issue.
My questions:
1. I have idea, but I didn't have enough to prepare. If we could mapping the shared memory region as the same virtual address for every processor, we could implement the pointer access approach to shared memory. So, how could implementing this idea? Namely shared virtual mapping and force other cores to remapping this region based on the information memory mapping of one core.
2. Is possible to mapping the stack of processor in shared memory?
I am looking to hearing you.
Thanks in Advance
Mapping memory regio into the address space of every process
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Mapping memory regio into the address space of every pro
Sounds like an homework question ripped from it's original context. I can't reproduce enough of the actual problem to give hints without making the answer obvious, if there even is one.
Re: Mapping memory regio into the address space of every pro
This is not homework, just, I tried to explain the problem. I will appreciate any help.
Thanks
Thanks
Re: Mapping memory regio into the address space of every pro
The normal method is to create a kernel-managed 'named' object and return whatever pointer or handle is appropriate to the processes. Copying/sharing etc. can be done using the global 'name'. The kernel takes care of the details.However, There is big issue in this system. It is memory addressing, when core allocated object in shared memory space, should make sort translation to address and send the offset to consumer core. The consumer core also do the same procedure to get the correct address space, since the virtual address is not valid for other cores. So, the access on it can not be accomplished with simply passing the proper pointer.
That's generally a poor and rather restrictive solution. I would advise against it.1. I have idea, but I didn't have enough to prepare. If we could mapping the shared memory region as the same virtual address for every processor, we could implement the pointer access approach to shared memory. So, how could implementing this idea? Namely shared virtual mapping and force other cores to remapping this region based on the information memory mapping of one core.
Yes, but again I would advise against it. Stacks are not supposed to be managed by processes. They are under control of the compiler/language environment.2. Is possible to mapping the stack of processor in shared memory?
If a trainstation is where trains stop, what is a workstation ?
Re: Mapping memory regio into the address space of every pro
Thanks for response.
The normal method is to create a kernel-managed 'named' object and return whatever pointer or handle is appropriate to the processes. Copying/sharing etc. can be done using the global 'name'. The kernel takes care of the details.
This is looking like a nice idea, How could I do it ? Could you give me more details to implement it?
Yes, but again I would advise against it. Stacks are not supposed to be managed by processes. They are under control of the compiler/language environment.
I know this option under control of the compiler. Namely, one core as the master mapping his stack in shared array. Consequently, all local and global variables of master are shareable and by implementing the idea of fixed virtual address, every core could access this variables.
The normal method is to create a kernel-managed 'named' object and return whatever pointer or handle is appropriate to the processes. Copying/sharing etc. can be done using the global 'name'. The kernel takes care of the details.
This is looking like a nice idea, How could I do it ? Could you give me more details to implement it?
Yes, but again I would advise against it. Stacks are not supposed to be managed by processes. They are under control of the compiler/language environment.
I know this option under control of the compiler. Namely, one core as the master mapping his stack in shared array. Consequently, all local and global variables of master are shareable and by implementing the idea of fixed virtual address, every core could access this variables.
Re: Mapping memory regio into the address space of every pro
No, you can't do that. Global variables are not on the stack. Furtheremore, while compilers generally use the stack for local variables, many local variables are register based or are optimised away. There is no way to portably and consistently predict where a local variable (on another core) might be at a particular time.I know this option under control of the compiler. Namely, one core as the master mapping his stack in shared array. Consequently, all local and global variables of master are shareable and by implementing the idea of fixed virtual address, every core could access this variables.
If a trainstation is where trains stop, what is a workstation ?
Re: Mapping memory regio into the address space of every pro
It can be done by abstracting the global object and provide functions to work on that:hhh83 wrote:Could you give me more details to implement it?
Code: Select all
typedef struct {
uint32_t handle;
uint32_t attr;
uintptr_t phy_addr; // physical address
size_t size;
uint32_t ref; // reference count (or a more complex user/process list for bookkeeping)
...
} GLOBAL_OBJECT;
uint32_t global_allocate(size_t size) {
GLOBAL_OBJECT* obj = ....; // allocate a new slot
obj->phy_addr = allocate_physical_memory(size);
...
return obj->handle;
}
void* global_retain(uint32_t handle, void* addr, size_t size) {
GLOBAL_OBJECT* obj = lock_object(handle);
mmap(addr, obj->phy_addr, size, flags);
...
unlock_object(handle);
}
Re: Mapping memory regio into the address space of every pro
Make SAS OS, lose mapping problems at once.
Learn to read.