Linux operating commands for shared memory segments

Source: Internet
Author: User
Run ipcs-m to view the current shared memory usage. The sections are described as follows:

View shared memory segments

Run ipcs-m to view the current shared memory usage. Each part is explained as follows:

Key: The unique key value of the shared memory. the shared memory uses this key to determine which memory you are reading.
Shmid: when the key is used to obtain the memory, you get the value of this id. It is the identifier of the memory block you operate on.
Owner: The user who creates the shared memory block
Perms: the read and write permissions of the shared memory, which is forbidden by 8, can be 777, consistent with the read and write permissions of the file.
Bytes: size of the memory block
Nattch: number of processes connected to the memory block
Status: The current status, for example, dest, to be deleted.

Operation shared memory segments

Ipcrm can be used to delete the corresponding shared memory segments, semaphores, and message queues;
Command example:
Ipcrm-s semid deletes the corresponding semaphore set
Ipcrm-m shmid deletes the corresponding shared memory segment
Ipcrm-q msqid: delete the corresponding message queue
Ipcrm can only delete a single resource. you can use the following command to delete multiple resources in batches (zhangsj is copyrighted ):
1. ipcs-s | grep user name | cut-d ""-f2 | xargs-n1 ipcrm-s
2. ipcs-s | awk '/user name/{print $2}' | xargs-n1 ipcrm-s
3. ipcs-s | awk '/user name/{system ("ipcrm-s" $2 )}'
4. for I in echo 'ipcs | grep username | cut-d ""-f2'; do ipcrm-s $ I; done

This article reprinted from The http://2813385.blog.51cto.com/2803385/537415 | http://blog.csdn.net/zombee/article/details/6678787 hereby thank you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.