APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/10/05 Shared Memory

© October 2003 Tony Lawrence

Under normal conditions, one Unix process has absolutely no access to another's memory. However, sometimes it can be helpful (for reasons of speed, usually) to be able to read or write a shared memory area. Therefore, Unix and Linux systems provide system calls to setup and use such areas. See "man shmget" for an introduction. On some systems, there's a method of using mmap() (which maps a file into a memory buffer) to get a shared buffer. On SysV, that would involve mmapping /dev/zero, on BSD mmap has an ANON flag that tells it you want something that can be shared (though only with related processes).

When programmers talk about shared memory, it's probably this. However, hardware can also have memory mapped into system address space. This will usually be called "dual ported" memory (because both the system cpu and the add-on board can access it), but it's often just called "shared" also.

When you attempt to access memory that does not belong to you (usually because of a program bug), you'll get a "Memory Fault" error. People sometimes think this means defective ram; it doesn't.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Shared Memory

Inexpensive and informative Apple related e-books:

Take Control of Preview

iOS 8: A Take Control Crash Course

Take Control of OS X Server

Take Control of IOS 11

Are Your Bits Flipped?

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby. (Kent Beck)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode

SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)