I read on stackoverflow.com that it is more portable.
I'm pretty sure mmap is more fundamental. shm() will also work, but I prefer mmap, it's more flexible. I also like the idea of being able to map in massive things from disk without wasting untold amounts of memory; whereas the memory the system will allow you to shm() may be fairly limited, and eats swap.
Quote:
Oh, I haven't noticed that fact. Good to know.Ok, I will remember that.Do you mean that below code is wrong?
Not wrong, no. It illustrates an important feature of shm, getting at anonymous memory from the outside. Just knowing the name can get you the memory, where mmap() would need to map an actual file to get at already-in-use segments a process didn't inherit. Remember though, a UNIX system is supposed to back all memory with disk one way or another. If you don't let it be on disk, it may just end up in swap.
Quote:
I think that is my problem. What does it mean big enough?
Well, how large are your structures? Think in terms of available memory, not in clients. Many programs have that kind of configurable maximum; use this much memory but no more. mmap makes this simple because you can map in the max amount of memory without actually using it. The OS will just give you more when you use it, up to the max you requested.
Many programs have a configurable limit for that sort of upper max. I recall a chess program that took a configurable amount of space for its memory buffer. It couldn't run as a limited user until fiddled with settings in /proc though because shm only gives limited users 16 megs or so by default in Linux. With file-backed mmap, hundreds of megs is the practical limit for one segment in 32-bit; and on 64-bit, the sky is the limit.
Quote:
Server doesn't know how much clients would have. The main point is how to organize this shared memory to grow as new games are started. Good idea, thanks
You only want it to grow to a point. You don't want it to eat beyond all available memory and grind your machine into swapdeath. Pick a fraction of total RAM maybe.
Quote:
I am not sure if I understand well. Could you propose any sketch?
It could be that I misunderstood the intent of the structure you posted though. I have no idea how you plan to organize this memory yet.
Last edited by Corona688; 06-07-2011 at 07:53 PM..
My System is FC3, The following Players don't run well:
1).Helix Player couldn't play MP3 and *.wma files,
2).Totem is the same,
3)XMMS couldn't play .wma files.
I am a newer of Linux,but I like Linux,just as you.
Could you help me?
Thank you! (1 Reply)
When I compile this C programme I get different outputs each time I run it
Please explain to me whats happening in the code if you can give me a detailed explanation. Because I am stuck with this.
#include <stdio.h>
main(){
int i = 0;
printf("I am the... (1 Reply)
When I compile this C programme I get different outputs each time I run it
Please explain to me whats happening in the code if you can give me a detailed explanation with the schedular functionality it will help a lot. Because I am stuck with this.
#include <stdio.h>
main(){... (3 Replies)
Hello All,
I am using Mozilla 1.7.8 on hp-ux 11.00, and install flash player 6 for it. it is giving following errors and get crashed. when i want to open a site need flash plugin.
Gtk-WARNING **: invalid cast from `GtkSuperWin' to `GtkWidget'
Gtk-WARNING **: invalid cast from `GtkSuperWin'... (1 Reply)
Is it safe to call fork+exec in a multithreaded application.
Because In my multithreaded application, I need to execute another program in each thread.
I am using solaris 10.
Any suggestions pls. (2 Replies)
I have an input file with contents like:
5785690|68690|898809
7960789|89709|789789
7669900|87865|659708
7869098|65769|347658
so on..
I need to pass this file to 10 parallely running processes (forking)so that each line is processed by a process and no line is processed twice and write the... (1 Reply)
Hi,
I am unable to install VLC or any other media players in my SL 6.3 distro. I am using yum utility to install the packages, but i am getting the below error messages,
--> Processing Dependency: libpng15.so.15()(64bit) for package: vlc-core-2.0.3-1.fc18.x86_64
--> Processing... (1 Reply)