On Tue, Apr 29, 2008 at 12:29 AM, 李一 <[EMAIL PROTECTED]> wrote: > thx! > > On Mon, Apr 28, 2008 at 10:58 PM, Rene Herman <[EMAIL PROTECTED]> > wrote: > >> On 28-04-08 12:44, ?? wrote: >> >> I got a problem here: I have a large share memory (say, 1.5GB) to be >>> mapped into several processes' address space, I wanna make sure that the >>> addresses those processes use to map the shared memory are a same one >>> according to some reason. Specifically speaking, I will invoke shmat () in >>> every process with a same second argument, a same address. But there is >>> possibility that some times in some processes I can not make sure that the >>> address is not in use. So my question is: what address should I choose, is >>> there anything about process memory management in UNIX standards (posix, >>> xopen...). I can make sure that I will attatch the shared memory right after >>> the process starts. >>> >> >> Not that I'm aware of and I quite doubt anything useful exists. Are you on >> 32 or 64-bit? On 32-bit 1.5G is pretty large, on 64 it should be peanuts. > > My program will run on both 32 & 64 bit machines, the shared memory will be > 1.5GB on 32 bit machine, and maybe 60GB on a 64 bit machine. Coz' I am > managing a huge web graph, which will contain over 2 billion nodes at most, > maybe it can be contained in a 64 bit machine, but I want my program to be > compatible to 32 bit. > > The bad thing is: I may need several such shared memory blocks, but I can > only access one block at a time. What is worst, I need to randomly access > the web graph, that means I need to swap between blocks. > >> >> >> Anyways, usually, even when not guaranteed anything, you'd expect to be >> able to in practice get the same address. I know recent Red Hat >> distributions use addressspace randomization which easily could interfere. I >> suppose you are using Debian: > > right now, my way is like this: I will occupy this huge address space at > the beginning, and if it succeeded, I'll try my best not to use the mapped > address space for other purposes, I wouldn't do anything while swapping, and > swapping uses the same address. > sorry, I forgot to say that there are pointers in the data structures contained in the shared memory.
> > > And, so far so good... > >> >> >> `- Debian GNU/Linux - The power of freedom >>> >> >> (ugh) and I do not know if it also does. Does it? > > oh, my desktop used to be Debian, but now it is Ubuntu, I take it that they > are the same thing to me. > > The program runs on Red Hat Distribution. > >> >> >> I'll do you a favour and not ask why on earth you'd want the same address. >> >> Rene. >> > > > > -- > Paul Francisco = pAnk7.yArdbird > http://pank7yardbird.googlepages.com > http://hi.baidu.com/pank7 > .' ' ` . pAnk7.yArdbird ^_^ > : :' : pank7yardbird(AT)gmail.com > `. ` ' liyi(AT)net.pku.edu.cn > `- Debian GNU/Linux - The power of freedom > -- Paul Francisco = pAnk7.yArdbird http://pank7yardbird.googlepages.com http://hi.baidu.com/pank7 .' ' ` . pAnk7.yArdbird ^_^ : :' : pank7yardbird(AT)gmail.com `. ` ' liyi(AT)net.pku.edu.cn `- Debian GNU/Linux - The power of freedom