{"id":311111,"date":"2020-10-07T15:00:47","date_gmt":"2020-10-07T15:00:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311111"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311111","title":{"rendered":"\u0417\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u0430\u043c\u0438 \u0432 Linux"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/522418\/\"><b><i>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/kRX0\/\">\u00abAdministrator Linux.Basic\u00bb<\/a>.<br \/>  <\/i><\/b>  <\/p>\n<hr>\n<p>  \u0421\u0435\u043c\u0430\u0444\u043e\u0440 \u2013 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c \u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u0449\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0433\u043e\u043d\u043a\u0438, \u0434\u0435\u0434\u043b\u043e\u043a\u0438 (\u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438) \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u044f\u0434\u0440\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043a\u0430\u043a \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b, \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u044b, \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0438 \u0431\u0430\u0440\u044c\u0435\u0440\u044b.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u0442\u0440\u0438 \u0432\u0438\u0434\u0430 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432:<\/p>\n<ol>\n<li>\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u044b (binary semaphore)<\/li>\n<li>\u0421\u0435\u043c\u0430\u0444\u043e\u0440\u044b-\u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 (counting semaphore)<\/li>\n<li>\u041c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432 (semaphore set)<\/li>\n<\/ol>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f IPC<\/h3>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u043c\u0435\u0436\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (inter-process communication, IPC).<\/p>\n<pre><code class=\"bash\"># ipcs ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 65536 root 600 393216 2 dest 0x00000000 98305 root 600 393216 2 dest 0x00000000 131074 root 600 393216 2 dest 0x00000000 163843 root 600 393216 2 dest 0x00000000 196612 root 600 393216 2 dest 0x00000000 229381 root 600 393216 2 dest 0x00000000 262150 root 600 393216 2 dest 0x00000000 294919 root 600 393216 2 dest 0x00000000 327688 root 600 393216 2 dest ------ Semaphore Arrays --------  key semid owner perms nsems  ------ Message Queues -------- key msqid owner perms used-bytes messages<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432<\/h3>\n<p>  \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432.<\/p>\n<pre><code class=\"bash\"># ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/h3>\n<p>  \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<pre><code class=\"bash\"># ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 65536 root 600 393216 2 dest 0x00000000 98305 root 600 393216 2 dest<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041b\u0438\u043c\u0438\u0442\u044b<\/h3>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>ipcs -l<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043b\u0438\u043c\u0438\u0442\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"bash\"># ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 4194303 max total shared memory (kbytes) = 1073741824 min seg size (bytes) = 1  ------ Semaphore Limits -------- max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 32 semaphore max value = 32767  ------ Messages: Limits -------- max queues system wide = 16 max size of message (bytes) = 65536 default max size of queue (bytes) = 65536<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c<\/h3>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0438\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<pre><code class=\"bash\"># ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 65536 root 600 393216 2 dest 0x00000000 98305 root 600 393216 2 dest 0x00000000 131074 root 600 393216 2 dest 0x00000000 163843 root 600 393216 2 dest 0x00000000 196612 root 600 393216 2 dest 0x00000000 229381 root 600 393216 2 dest 0x00000000 262150 root 600 393216 2 dest 0x00000000 294919 root 600 393216 2 dest 0x00000000 327688 root 600 393216 2 dest<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/h3>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430.<\/p>\n<pre><code class=\"bash\"># ipcs -m -c  ------ Shared Memory Segment Creators\/Owners -------- shmid perms cuid cgid uid gid 65536 600 root root root root 98305 600 root root root root 131074 600 root root root root 163843 600 root root root root 196612 600 root root root root 229381 600 root root root root 262150 600 root root root root 294919 600 root root root root 327688 600 root root root root<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 IPC<\/h3>\n<p>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>-u<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0432\u043e\u0434\u043a\u0443 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 IPC.<\/p>\n<pre><code class=\"bash\"># ipcs -u  ------ Shared Memory Status -------- segments allocated 9 pages allocated 864 pages resident 477 pages swapped 0 Swap performance: 0 attempts 0 successes  ------ Semaphore Status -------- used arrays = 0 allocated semaphores = 0  ------ Messages: Status -------- allocated queues = 0 used headers = 0 used space = 0 bytes<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u044b \u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u044f\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f, \u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b ipcrm, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 IPC-\u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"bash\"># ipcs -a # ipcrm -s &lt; sem id&gt;<\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u0438\u043c\u0438\u0442\u044b \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>sysctl<\/code>.<\/p>\n<pre><code class=\"bash\"># \/sbin\/sysctl -w kernel.sem=250 <\/code><\/pre>\n<p>  <a href=\"https:\/\/otus.pw\/kRX0\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2a\/z8\/xk\/2az8xk2so48hq9b2ejyf3sjidzg.png\"><\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/522418\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/522418\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/522418\/\"><b><i>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/kRX0\/\">\u00abAdministrator Linux.Basic\u00bb<\/a>.<br \/>  <\/i><\/b>  <\/p>\n<hr>\n<p>  \u0421\u0435\u043c\u0430\u0444\u043e\u0440 \u2013 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c \u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u0449\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0433\u043e\u043d\u043a\u0438, \u0434\u0435\u0434\u043b\u043e\u043a\u0438 (\u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438) \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u044f\u0434\u0440\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043a\u0430\u043a \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b, \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u044b, \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0438 \u0431\u0430\u0440\u044c\u0435\u0440\u044b.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u0442\u0440\u0438 \u0432\u0438\u0434\u0430 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432:<\/p>\n<ol>\n<li>\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u044b (binary semaphore)<\/li>\n<li>\u0421\u0435\u043c\u0430\u0444\u043e\u0440\u044b-\u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 (counting semaphore)<\/li>\n<li>\u041c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432 (semaphore set)<\/li>\n<\/ol>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-311111","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311111"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311111\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}