1 / 3

Shared memory in Linux

Shared memory in Linux. Creating a shared segment. #include <sys/ ipc.h > #include <sys/ shm.h > shmid =shmget (IPC_PRIVATE, size , IPC_CREAT| 0 666); “size” is the amount of RAM you need “ shmid ” is the ID of the new segment to be shared with children (if < 0 then error)

adair
Télécharger la présentation

Shared memory in Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Shared memory in Linux

  2. Creating a shared segment • #include <sys/ipc.h> • #include <sys/shm.h> shmid=shmget (IPC_PRIVATE, size, IPC_CREAT|0666); • “size” is the amount of RAM you need • “shmid” is the ID of the new segment to be shared with children (if < 0 then error) • Content is initialized to all 0 • NOTE: 0666 is octal notation for: 110110110

  3. Using the segment • #include <sys/types.h> • retval=shmat(shmid, NULL, 0); • shmid is returned from shmget • “retval” is a void *

More Related