Results 1 to 4 of 4
hello, please i wanna attach a process to a specific adress in shared memory but i couldn't (invalid argument), could u please give me the general form of an adress,
...
- 03-20-2008 #1Just Joined!
- Join Date
- Dec 2007
- Location
- Algeria
- Posts
- 26
[SOLVED] shmat() function
hello, please i wanna attach a process to a specific adress in shared memory but i couldn't (invalid argument), could u please give me the general form of an adress,
i use shmat()
thank u
- 03-20-2008 #2
That parameter is not intended to attach to a particular address in shared memory. That parameter is intended to attach the beginning of the shared memory block to a specified address in physical memory. It is not usually supported (and probably not in Linux), which is a good thing, because most applications using shared memory don't care where in physical memory that shared memory resides.
Unless you have specific needs to the contrary, make this parameter zero. If you do have specific needs, please tell us about them.--
Bill
Old age and treachery will overcome youth and skill.
- 03-20-2008 #3Just Joined!
- Join Date
- Dec 2007
- Location
- Algeria
- Posts
- 26
shmat()
thanks,
the program that im making is : 6 processes, 1 manager and 5 normal processes,
when a normal process need a resource, it has to ask the manager for it, by using a shared memory called TREQUEST;
so i need to specify an adress for each process in the same shared memory TREQUEST;
if u have a solution or another design with one shared memory please tell me;
- 03-20-2008 #4
Ouch! All that bold print hurt my eyes! :)
If you haven't done so already, do this at the command line:
If you were specifying a particular address to shmat(), that would have been the second parameter. Don't do that; use NULL there. Use the address which comes back from the function call as the location (in user space) of the shared memory.Code:man shmat man shmctl man shmget
To make sure that all processes share the same memory (though possibly at different places in their user address space), pass in the same first paramter to shmat() for each.
If man pages are not installed on your system, google each of these sets of words:
Hope this helps.Code:man shmat Linux man shmctl Linux man shmget Linux
--
Bill
Old age and treachery will overcome youth and skill.


