一、ipcs命令(显示进程间通信信息)
ipcs - provide information on ipc facilities
-m shared memory segments
-q message queues
-s semaphore arrays
-a all (this is the default)
显示共享内存信息
[root@ebs-19233 ~]#ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 1638400 root 600 524288 16 dest
二、ipcrm命令(删除进程间通信信息)
ipcrm [ -M key | -m id | -Q key | -q id | -S key | -s id ] ...
-m shmid:removes the shared memory segment identified by shmid after the last detach is performed.
-q msgid:removes the message queue identified by msgid.
-s semid:removes the semaphore identified by semid.
[root@ebs-19233 ~]# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 1638400 root 600 524288 16 dest
0x28a11375 1671169 root 644 1000 0
[root@ebs-19233 ~]# ipcrm -m 1671169
[root@ebs-19233 ~]# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 1638400 root 600 524288 16 dest
三、/proc/sys/vm/drop_caches管理缓存
操作系统可用内存:free memory
应用进程可用内存:free memory+buffers+cached(buffers和cached可以被很快回收)
buffers:磁盘io写缓存
cached:频繁访问的文件缓存,如果值很大说明缓存的文件内容很多。
To free pagecache, use echo 1 > /proc/sys/vm/drop_caches;
To free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 > /proc/sys/vm/drop_caches.
Because this is a non-destructive operation and dirty objects are not freeable, the user should run sync first.
#sync //同步到磁盘
#echo 3 >/proc/sys/vm/drop_caches //刷新缓存