- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Main Memory Sharing
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2007 09:24 PM
12-03-2007 09:24 PM
1) Execute all functions in a common/shared area. How it can be manipulate? (Which system need to use that will give read/write permission to other function/exe's).
2) I am using HP-UX11
3) If possible, pls give example program (.c/.cpp) that saying how it can be implemented. So that I can easily understand.
Thanks in Advance,
Nagapandi :)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2007 09:47 PM
12-03-2007 09:47 PM
Re: Main Memory Sharing
If you want to share functions/code, you create shared libs.
To create them see shmget(2), shmat(2) or mmap(2).
This thread many give you some ideas:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1139789
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 12:19 AM
12-04-2007 12:19 AM
Re: Main Memory Sharing
Give me some more visions about shared libs as you said.
Thanks, Naga :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 12:39 AM
12-04-2007 12:39 AM
Re: Main Memory Sharing
You share readonly functions as part of the executable or shared lib.
>How we can load? How we can execute in our desired location from the main memory?
You can either link them to your application or you can dynamically load shared libs with dlopen or shl_load.
You have no choice in address for functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 03:54 AM
12-04-2007 03:54 AM
Re: Main Memory Sharing
Means, Can't we get the main memory address of currently executing function?
As well, Can't we place our function in desired main memory area?
Thanks,
Naga :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 07:50 AM
12-04-2007 07:50 AM
Re: Main Memory Sharing
>>As well, Can't we place our function in desired main memory area?
No. Think about the implications of what you are asking. If I could place a function anywhere I liked in memory, I could usurp the system. Each process has its own address space and the OS makes sures that processes are not allowed to access memory outside of that space. The exception is shared memory and shared library code (and it really isn't an exception) because the same areas are mapped to multiple processes.
As Dennis has already told you, the correct approach to using the same function is many processes is to build a shared library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 07:59 AM
12-04-2007 07:59 AM
SolutionIt was recognized that in almost every case the child process did an exec() and became a completely different process. All of the extra work required to copy the process was not needed. The vfork() system call was invented to copy on a small fraction of the process and allow the two processes to share the same memory space. As long as the child did an immediate exec() that was a good optimization. However, a few people discovered that you could keep right on running without exec()'ing and have two processes (or more with additional vfork()'s) writing to the same memory) and you had shared memory without using traditional shared memory system calls. (It was a poor man's implementation of shared memory BUT IT WAS EXTREMELY DANGEROUS.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 08:58 AM
12-04-2007 08:58 AM
Re: Main Memory Sharing
In modern systems the processor generates virtual address and these are translated to physical addresses in main memory by the OS.
So there is no easy way to know the physical address of any variable/function in a program.
You can use google to search/read about these terms
"virtual memory", "paging and page tables" , "segmentation" "MMU + OS"
Thanks
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 02:53 PM
12-04-2007 02:53 PM
Re: Main Memory Sharing
You don't want to be in that business. HP-UX already has two ways to share data that I mentioned. And separate ways to share code. And you shouldn't try to mix the two, without a very good reason.
>Can't we place our function in desired main memory area?
Why work so hard? As part of a function, it has to have all this massive infrastructure to enable references to other functions and data. That's besides compiling it PIC.
>Clay: If I could place a function anywhere I liked in memory, I could usurp the system.
I assume anywhere in shared memory that Nagapandi owns.
>The vfork() system call was invented to copy on a small fraction of the process
Other OSes use copy on write to handle this.
>Sri: So there is no easy way to know the physical address of any variable/function in a program.
I assume Nagapandi was asking about a shared virtual address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 03:16 PM
12-04-2007 03:16 PM
Re: Main Memory Sharing
> Can't we get the main memory address of currently executing function?
> Can't we place our function in desired main memory area?
Why do you care about the absolute address and why do you want to control where your code is placed in memory?
You're questions seem better suited to a time of assembly languages and early operating systems, not compiled languages and virtual memory management.
It sounds like you want to eke out every last processor cycle from your machine when your code executes. Is this some real-time application or is this a purely academic set of questions?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 03:44 PM
12-04-2007 03:44 PM
Re: Main Memory Sharing
Or want to dynamically generate code like Java?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2007 05:27 AM
12-06-2007 05:27 AM
Re: Main Memory Sharing
thanks, Naga :)