In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares with you is about the shared memory of big data's inter-process communication. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
Shared memory:
Data transfer between processes is the most efficient in the system v version, but it is not synchronized and mutually exclusive, so it is often used in conjunction with semaphores.
Nattch: indicates how many processes are attached to shared memory. To see its value, use the ipcs-m command
Delete key value with ipcrm-m + key value
Graphics understand shared memory:
# include
# include
1. Create a shared memory function:
Int shget (key_t key,size_t size, int shmflg* buf)
The second parameter is its size, which is generally 4k, or an integer multiple of 4096.
The third parameter is generally: IPC_CREAT | IPC_EXCL
two。 Function that destroys shared memory:
Int shmctl (int shm _ id,int cmd,int shmflg* buf)
The second parameter is generally: IPC_RMID
3. Hang on to shared memory:
Void * shmat (int shmid, const void * shmaddr, int shmflg)
4. Disassociate shared memory
Int shmdt (const void * shmaddr)
Shared memory implementation code:
/ / comm.h 1 # include 2 # include 3 # include 4 # include 5 # include 6 # define _ PATH_. "7 # define _ PROJ_ID_ 0X7777 8 # define _ SIZE_ 4096 9 int shm_create () 10 {11 key_t key=ftok (_ PATH_, _ PROJ_ID_); 12 if (key)
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.