Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle Study-- IPCS manages shared memory

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle Study-- IPCS manages shared memory

Shared memory, semaphore and queue information management under Unix/linux

Under unix/linux, there are often some problems because shared memory, semaphores, queues and other shared information are not cleaned up cleanly.

The command to view memory for shared information is: ipcs [- m |-s |-Q].

Shared memory, semaphores, and queue information are listed by default

-m list shared memory

-s lists shared semaphores

-Q list shared queues

The clear command is: ipcrm [- m |-s |-Q] id.

-m delete shared memory

-s delete shared semaphore

-Q Delete the shared queue.

Case study:

[oracle@trade_as02] $ipcs-a-Shared Memory Segments-key shmid owner perms bytes nattch status 0x30024289 32768 futures 777 528384 1 0xca2fd414 491521 oracle 640 1730150400 16-Semaphore Arrays-key semid Owner perms nsems 0x00028009 0 futures 666 1 0x0002800c 32769 futures 666 1 0x30024003 262146 futures 777 3 0x3002428a 294915 futures 777 2 0x3002428b 327684 futures 777 2 0x3002428c 360453 futures 777 2 0x3002428d 393222 futures 777 2 0x3002428e 425991 Futures 777 2 0x52dff7d0 3964936 oracle 640151 0x52dff7d1 3997705 oracle 640151 0x52dff7d2 4030474 oracle 640151 0x52dff7d3 4063243 oracle 640151 0x52dff7d4 4096012 oracle 640151-Message Queues-key msqid owner perms used-bytes messages

Sometimes the shared memory segment cannot be deleted immediately, and it will only be released when all processes using this memory segment send detach commands to OS. At this time, you can consider deleting the semaphore used by the process to help release the shared memory segment.

Related knowledge: semaphore, resource release, ipcs, ipcrm

Semaphores, also known as semaphores, are used to coordinate data objects between different processes, and the main application is inter-process communication in shared memory. In essence, a semaphore is a counter that records access to a resource, such as shared memory, which is the fastest way to communicate between processes running on the same machine, because data does not need to be copied between different processes. Usually a shared memory area is created by one process, and the other processes read and write to this memory area. Under the Linux system, the common way is to use the shared memory to store through the shmXXX function family. Such as Shmget, similar to the malloc function

Ipcs can be used to display the usage of shared memory segments, semaphore sets, message queues, etc., in the current Linux system.

Command example: ipcs-an or ipc shows the usage of shared memory segments, semaphore sets, and message queues in the current system; ipcs-m shows the usage of shared memory segments; ipcs-s shows the usage of semaphore sets; ipcs-Q shows the usage of message queues

Ipcrm can be used to delete corresponding shared memory segments, semaphores, and message queues

Command example: ipcrm-s semid deletes corresponding semaphore set ipcrm-m shmid deletes corresponding shared memory segment ipcrm-Q msqid deletes corresponding message queue ipcrm itself can only delete a single resource Batch deletion can be achieved by using the following command: 1.ipcs-s | grep username | cut-d ""-f2 | xargs-N1 ipcrm-s2.ipcs-s | awk'/ username / {print $2}'| xargs-N1 ipcrm-s3.ipcs-s | awk'/ username / {system ("ipcrm-s" $2)} '4.for i in echo `ipcs | grep username | cut-d "- f2` Do ipcrm-s $I; done

Learn more about:

Oracle memory segment parameter setting: [root@rh7 ~] # sysctl-pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1error: "net.bridge.bridge-nf-call-ip6tables" is an unknown keyerror: "net.bridge.bridge-nf-call-iptables" is an unknown keyerror: "net.bridge.bridge- Nf-call-arptables "is an unknown keyfs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report