<HTML ><HEAD ><TITLE >Semaphore and shared memory functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK REL="HOME" TITLE="PHP Manual" HREF="manual.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="sql_regcase" HREF="function.sql-regcase.html"><LINK REL="NEXT" TITLE="sem_get" HREF="function.sem-get.html"></HEAD ><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.sql-regcase.html" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.sem-get.html" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.sem" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XLVII. Semaphore and shared memory functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN24799" ></A ><P > This module provides semaphore functions using System V semaphores. Semaphores may be used to provide exclusive access to resources on the current machine, or to limit the number of processes that may simultaneously use a resource.</P ><P > This module provides also shared memory functions using System V shared memory. Shared memory may be used to provide access to global variables. Different httpd-daemons and even other programs (such as Perl, C, ...) are able to access this data to provide a global data-exchange. Remember, that shared memory is NOT safe against simultaneous access. Use semaphores for synchronization. <DIV CLASS="table" ><P ><B >Table 1. Limits of shared memory by the Unix OS</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >SHMMAX</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >max size of shared memory, normally 131072 bytes</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >SHMMIN</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >minimum size of shared memory, normally 1 byte</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >SHMMNI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >max amount of shared memory segments, normally 100</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >SHMSEG</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >max amount of shared memory per process, normally 6</TD ></TR ></TABLE ></DIV ></P ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.sem-get.html" >sem_get</A > — get a semaphore id</DT ><DT ><A HREF="function.sem-acquire.html" >sem_acquire</A > — acquire a semaphore</DT ><DT ><A HREF="function.sem-release.html" >sem_release</A > — release a semaphore</DT ><DT ><A HREF="function.shm-attach.html" >shm_attach</A > — Creates or open a shared memory segment</DT ><DT ><A HREF="function.shm-detach.html" >shm_detach</A > — Disconnects from shared memory segment</DT ><DT ><A HREF="function.shm-remove.html" >shm_remove</A > — Removes shared memory from Unix systems</DT ><DT ><A HREF="function.shm-put-var.html" >shm_put_var</A > — Inserts or updates a variable in shared memory</DT ><DT ><A HREF="function.shm-get-var.html" >shm_get_var</A > — Returns a variable from shared memory </DT ><DT ><A HREF="function.shm-remove-var.html" >shm_remove_var</A > — Removes a variable from shared memory </DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.sql-regcase.html" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="manual.html" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.sem-get.html" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >sql_regcase</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >sem_get</TD ></TR ></TABLE ></DIV ></BODY ></HTML >