ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am using shared memory in my application. On linux POSIX shared memory file is created at /dev/shm, but on Mac OS i am not able to find the /dev/shm. So I have few queries regarding the location of POSIX shared memory on Mac OS:
1. Is POSIX shared memory on Mac OS is stored as file(Just like at /dev/shm on Linux)?If Yes, Which location?
2. How POSIX shared memory implementation on Mac OS is different from Linux?
I am using shared memory in my application. On linux POSIX shared memory file is created at /dev/shm, but on Mac OS i am not able to find the /dev/shm. So I have few queries regarding the location of POSIX shared memory on Mac OS:
1. Is POSIX shared memory on Mac OS is stored as file(Just like at /dev/shm on Linux)?If Yes, Which location?
2. How POSIX shared memory implementation on Mac OS is different from Linux?
Thanks & Regards,
Vinay
1), I can not reply your questions directly (for I truly not well know about that)
2), but I have some expirience of shm under Mac OS, maybe helpful for you.
3), I offten use filemapping under Mac OS instead of shm, it is work stable, and simpler than shm under Mac OS.
What do you mean by 'shared memory file'? Shared memory is in memory, not file...
for Linux specific, /dev/shm/* is for shared memory files.
most UNIXs not need do like that (such as freebsd which is the kernel for original Mac OS).
but for shm under Mac OS, truly need solving some issues which not occurs under Linux, they are truly difference. so I often use filemapping instead of.
@gchen: Yes. In FreeBSD also /dev/shm doesn't exist. Can you plz provide me some details about where it is stored in FreeBSD or If it is not stored as the file, then how it handled(Is it stored in some shared memory space may be maintained by kernel where users cannot access)?
@NevemTeve: In Linux, each POSIX Shared memory or Semaphore created is stored as file under /dev/shm directory.
In Linux, each POSIX Shared memory or Semaphore created is stored as file under /dev/shm directory.
What you say is, AFAIK, true. However please note that /dev/shm is not an actual data store on a disk, but is a virtual filesystem. While it can be accessed using the usual filesystem semantics, its underlying data is produced at runtime by the Liniux kernel.
Don't know whether this contributes to your question, but it seemed worth pointing out.
However please note that /dev/shm is not an actual data store on a disk, but is a virtual filesystem. While it can be accessed using the usual filesystem semantics, its underlying data is produced at runtime by the Liniux kernel.
1st, support what said above.
2nd, For the named object(such as shm), it has an ID (or a string under Windows OS) which defined by user, and should be knowned by the processes which will use it. And another none-relative processes need not know it.
3nd, many UNIXs implenment "/dev/shm/*", it is only for making monitoring or administration easier. It (/dev/shm/*) is not required by the processes which will use shm.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.