In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article Xiaobian for you to introduce in detail "what is the concept of php semaphores and shared memory", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what is the concept of php semaphores and shared memory" can help you solve your doubts.
Description
1. Semaphore: an atomic operation provided by the system, a number of signals, and only one process can operate.
A process obtains a signal and must be released by the process.
2. Shared memory: a common memory area opened by the system in memory, which can be accessed by any process.
Multiple processes can access the area at the same time, and the memory area needs to be locked or signaled in order to ensure the consistency of the data.
Example
Echo "parent progress pid: {$parentPid}\ n"; $childList = array (); / / create shared memory, create semaphores, define shared key$shm_id = ftok (_ _ FILE__,'m'); $sem_id = ftok (_ _ FILE__,'s'); $shareMemory = shm_attach ($shm_id); $signal = sem_get ($sem_id); const SHARE_KEY = 1tactic / producer function producer () {global $shareMemory; global $signal $pid = posix_getpid (); $repeatNum = 5; for ($I = 1; $I 0) {unset ($childList [$childPid]);}} / / release shared memory and semaphore shm_remove ($shareMemory); sem_remove ($signal); echo "({$parentPid}) main progress end!\ n" After reading this, the article "what is the concept of php semaphores and shared memory" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.