Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6967033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:16:07+00:00 2026-05-27T16:16:07+00:00

http://www.php.net/manual/en/intro.shmop.php Shmop is an easy to use set of functions that allows PHP to

  • 0

http://www.php.net/manual/en/intro.shmop.php

Shmop is an easy to use set of functions that allows PHP to read,
write, create and delete Unix shared memory segments.

I don’t understand, what exactly is the purpose of this extension? What is it used for?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:16:08+00:00Added an answer on May 27, 2026 at 4:16 pm

    Shared memory allows multiple processes to access the same data in memory. You can use it to share data among running PHP scripts.

     $shm = shmop_open(0xF00, "c", 0644, 4);
    
     $count = unpack('L', shmop_read($shm, 0, 4));
     $count = reset($count);
     var_dump($count);
     echo "count: ", $count++, "<br/>\n";
     shmop_write($shm, pack('L', $count), 0);
    

    When the computer restarts, anything in shared memory is lost.

    Different processes can access the same shared memory at the same time, which can lead to race conditions. In the example above, if two processes read the shared memory before either writes back to it, the count will be 1 less than it should be. Race conditions can be prevented by using a mutex, but that’s outside the scope of this Q&A.

    Shared memory is used for one type of inter-process communication, namely data passing. Some others available in PHP (depending on the platform and PHP build) are:

    • Signals (posix_kill to send a signal, pcntl_signal to set up a signal handler), a limited type of message passing. Signals aren’t particularly useful in scripted pages, as each script should run for a very short time.
    • Sockets for data. Sockets can use a network, or can be local.
    • Pipes for data. posix_mkfifo is used to create named pipes (aka FIFOs), and the standard file functions are used to read and write data. Unnamed (aka anonymous) pipes can be created between parent and child processes using popen or proc_open. Note unnamed pipes cannot be created between arbitrary processes. Note that pipes on some systems are unidirectional: a pipe handle can be used either to read or write, but not both.
    • Semaphores for synchronization.
    • Message queues for messaging. In PHP, the Semaphore extension offers both message queues and another set of shared memory functions (e.g. shm_attach). Many other extensions for various messaging protocols are also available, including SAM, STOMP and AMQP. See “Other Services” in the PHP manual for, well, others.
    • Network stream wrappers for data. At a lower level, these are just sockets, though they provide a different interface. They are also for specific application level protocols, whereas sockets are more general.
    • Network protocol extensions, such as cURL, for messaging & data. Like stream wrappers, these are (limitd) sockets in disguise.
    • Web service extensions, such as SOAP and XML-RPC, for remote procedure calls (RPC). Note that while these are socket based, they’re for a different type of IPC (RPC rather than data).

    While sockets (and anything based on them, such as stream wrappers) and pipes can be used to pass data between processes, their abilities with more than two processes are limited. Sockets can only connect two processes; to handle more than two, multiple sockets need to be opened (which is where a client-server architecture usually comes into it). With pipes, only one process can read given data; once it has, that data won’t be available to other readers, though they can read other data (which will then become unavailable to all but the reader). An arbitrary number of processes can open the same shared memory region.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am playing around with php rar http://www.php.net/manual/en/intro.rar.php Goal : Gather file (name) information
I'm studying http://www.php.net/manual/en/function.dns-get-record.php and there seems to be no option to set a custom
I use Factories (see http://www.php.net/manual/en/language.oop5.patterns.php for the pattern) a lot to increase the testability
http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime says that a session.cookie_lifetime of 0 goes until the browser is closed. Is
http://www.php.net/manual/en/filter.filters.flags.php How can I use this function to strip down a string to just
How do I return the comment property from exif_read_data link: http://www.php.net/manual/en/function.exif-read-data.php
The php.net page here http://www.php.net/manual/en/mysqlinfo.library.choosing.php says this Configure commands for using mysqlnd // Recommended,
Except https://www.php.net/manual/en/book.ktaglib.php and http://getid3.sourceforge.net/ does anyone know of any other way to work from
alt text http://www.freeimagehosting.net/image.php?a55fa98f01.jpg Hi I am trying to use a HTML select box with
Hello I know all about http://www.php.net/manual/en/function.http-build-query.php to do this however I have a little

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.