{"id":490722,"date":"2026-08-12T16:43:53","date_gmt":"2026-08-12T16:43:53","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=490722"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=490722","title":{"rendered":"\u041a\u0430\u043a \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b PID 1 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435: x86-64 \u0438 ARM64"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u0438\u0434\u0435\u044f: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 PID 1 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435.<\/h3>\n<p>\u041d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u043e\u043c\u0443 \u043c\u0438\u0440\u0443 \u0441\u0440\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u0435\u043d \u0435\u0449\u0451 \u043e\u0434\u0438\u043d init. \u0415\u0441\u0442\u044c Tini, \u0435\u0441\u0442\u044c <code>docker run --init<\/code>, \u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 production-\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u044f \u0431\u044b \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0430\u0447\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043d\u0438\u0445.<\/p>\n<p>\u041c\u043d\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f: \u0431\u0435\u0437 libc, \u0431\u0435\u0437 runtime, \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 Linux syscalls. \u0417\u0430\u043e\u0434\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 x86-64 \u0438 ARM64.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0438\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f <code>mini-init-asm<\/code>: PID 1, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 process group, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0432\u0441\u0435\u0439 \u0433\u0440\u0443\u043f\u043f\u0435, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 zombie-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438 \u0443\u043c\u0435\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 exit code \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u0437\u0436\u0435 \u0442\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c subreaper mode \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 restart-on-crash. \u0410 \u0441\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u0435\u0445\u0430\u043b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e Debian unstable, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438 \u0434\u043e testing.<\/p>\n<p>\u041d\u043e \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430: \u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 PID 1 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430?<\/p>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f init<\/h3>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code>container\u2514\u2500\u2500 application    PID 1    \u251c\u2500\u2500 worker    \u2514\u2500\u2500 helper<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439\u0441\u044f child \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f zombie \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043d\u0435 \u0437\u0430\u0431\u0435\u0440\u0451\u0442 \u0435\u0433\u043e status \u0447\u0435\u0440\u0435\u0437 <code>wait*()<\/code>. \u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 orphaned \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 init. \u0412 PID namespace \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u044d\u0442\u0443 \u0440\u043e\u043b\u044c \u0438\u0433\u0440\u0430\u0435\u0442 \u0435\u0433\u043e PID 1.<\/p>\n<p>\u0421 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u044e\u0430\u043d\u0441\u044b. \u0423 namespace init \u043e\u0441\u043e\u0431\u0430\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430, \u0438 \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0432 namespace.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 Docker \u0443\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 init:<\/p>\n<pre><code>docker run --init image<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 &#8212; Tini. \u041e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 child, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f reaping \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u044b. \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435. \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0439 \u0438 \u044f\u0434\u0440\u043e\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 assembly<\/h3>\n<p>\u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0432\u044b\u0431\u043e\u0440 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0434\u0430\u0451\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>PID 1 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u0436\u0434\u0451\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e. Assembly \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435: \u043e\u043d \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044f\u0432\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438 Linux kernel.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>signalfd<\/code>, \u0442\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0448\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 libc. \u0422\u044b \u043a\u043b\u0430\u0434\u0451\u0448\u044c \u043d\u043e\u043c\u0435\u0440 syscall \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440, \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0448\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e ABI \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0448\u044c \u0432 kernel. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441 <code>clone<\/code>, <code>execve<\/code>, <code>wait4<\/code>, <code>kill<\/code>, <code>setsid<\/code>, <code>epoll<\/code>, <code>timerfd<\/code>.<\/p>\n<p>\u0411\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0438 \u043b\u0438\u043d\u043a\u0443\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437:<\/p>\n<pre><code>ld -nostdlib<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u043b\u044f x86-64 Linux syscall ABI \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code>syscall number: raxarg1: rdiarg2: rsiarg3: rdxarg4: r10arg5: r8arg6: r9instruction: syscall<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>mov rax, SYS_killmov rdi, rbxmov rsi, SIGTERMsyscall<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 AArch64 \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b:<\/p>\n<pre><code>syscall number: x8arg1: x0arg2: x1arg3: x2arg4: x3arg5: x4arg6: x5instruction: svc #0<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u043e \u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code>mov x8, #SYS_killmov x0, x19mov x1, #SIGTERMsvc #0<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b ARM64-\u0432\u0435\u0440\u0441\u0438\u044e, \u043e\u0436\u0438\u0434\u0430\u043b, \u0447\u0442\u043e \u0434\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u043e\u0439\u0434\u0443\u0442\u0441\u044f. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0435\u043c \u0436\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043c, \u0433\u0434\u0435 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c: syscall numbers, register ABI \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e architecture-specific \u0434\u0435\u0442\u0430\u043b\u0435\u0439. \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0432\u043d\u043e:<\/p>\n<pre><code>src\/\u251c\u2500\u2500 amd64\/\u2514\u2500\u2500 arm64\/include\/\u251c\u2500\u2500 macros.inc\u251c\u2500\u2500 macros_arm64.inc\u251c\u2500\u2500 syscalls_amd64.inc\u2514\u2500\u2500 syscalls_aarch64.inc<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>syscall<\/code> \u0438\u043b\u0438 <code>svc #0<\/code>. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0448\u043b\u043e \u043d\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0438\u0434\u0443\u0442 \u0432 process group<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 entrypoint:<\/p>\n<pre><code>mini-init      PID 1\u2514\u2500\u2500 shell    \u251c\u2500\u2500 worker A    \u2514\u2500\u2500 worker B<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <code>SIGTERM<\/code>. \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<pre><code>kill(child_pid, SIGTERM);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0441\u0438\u0433\u043d\u0430\u043b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 child. \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0441 <code>worker A<\/code> \u0438 <code>worker B<\/code>, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0443\u0436\u0435 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 init \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u0435\u0435 \u044f\u0432\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 target \u0432 <code>mini-init-asm<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u0439 session \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e process group:<\/p>\n<pre><code>mini-init              PID 1application            PGID 42\u251c\u2500\u2500 worker A\u2514\u2500\u2500 worker B<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0410 forwarding \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437:<\/p>\n<pre><code>kill(-pgid, signal);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 PID \u0437\u0434\u0435\u0441\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 process group. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438 <code>SIGTERM<\/code> \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code>SIGTERM   \u2502   \u25bcmini-init   \u2502   \u2514\u2500\u2500 kill(-pgid, SIGTERM)                \u2502                \u251c\u2500\u2500 application                \u251c\u2500\u2500 worker A                \u2514\u2500\u2500 worker B<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430: group forwarding \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0446\u0438\u0435\u0439, \u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0440\u0435\u0436\u0438\u043c\u043e\u043c. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, process group \u043d\u0435 \u0434\u0430\u0451\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u043b\u044e\u0431\u044b\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e session \u0438\u043b\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u044e process topology. \u041d\u043e \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e container entrypoint PGID-first \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0439.<\/p>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e signal handlers \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b signalfd<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c main loop.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 signal handlers, \u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c child \u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430\u043c\u0438. \u041d\u043e Linux \u0434\u0430\u0451\u0442 <code>signalfd(2)<\/code>, \u0438 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e init \u043e\u043d \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u041d\u0443\u0436\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 signal mask, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437 file descriptor. \u0410 \u0440\u0430\u0437 \u044d\u0442\u043e fd, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 <code>epoll<\/code>.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d event loop:<\/p>\n<pre><code>                \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510signals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25ba\u2502 signalfd \u2502                \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518                     \u2502                     \u25bc                \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510                \u2502  epoll  \u2502                \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2518                     \u2502              \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2510              \u2502             \u2502           SIGCHLD       TERM\/INT\/...              \u2502             \u2502              \u25bc             \u25bc            wait4       kill(-pgid)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u0443\u0434\u0430 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>timerfd<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 graceful shutdown timeout. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0430\u044f state machine. \u0412 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u043c pseudo-C \u043e\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code>for (;;) {    int n = epoll_wait(epfd, events, MAX_EVENTS, -1);    for (int i = 0; i &lt; n; i++) {        if (events[i].data.fd == signal_fd) {            struct signalfd_siginfo si;            read(signal_fd, &amp;si, sizeof(si));            if (is_shutdown_signal(si.ssi_signo)) {                kill(-child_pgid, si.ssi_signo);                arm_grace_timer();            } else if (si.ssi_signo == SIGCHLD) {                reap_children();            } else {                kill(-child_pgid, si.ssi_signo);            }        }        if (events[i].data.fd == timer_fd) {            kill(-child_pgid, SIGKILL);        }    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439: \u043d\u0443\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c main child, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u043c\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 <code>read<\/code>, \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 syscall \u0438 race conditions \u0432\u043e\u043a\u0440\u0443\u0433 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443. \u0418 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <code>signalfd<\/code> signal handling \u0434\u0430\u0436\u0435 \u0432 assembly \u043d\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u044b\u0436\u043a\u043e\u0432 \u0438\u0437 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 handlers.<\/p>\n<h3>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 docker stop<\/h3>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 soft shutdown signal &#8212; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>SIGTERM<\/code> &#8212; \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0439 process group. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f grace timer. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e 10 \u0441\u0435\u043a\u0443\u043d\u0434:<\/p>\n<pre><code>EP_GRACE_SECONDS=10<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u043e\u0441\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f, init \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0435\u0433\u043e status \u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442:<\/p>\n<pre><code>SIGTERM   \u2502   \u25bckill(-pgid, SIGTERM)   \u2502   \u25bcgrace period   \u2502   \u251c\u2500\u2500 application exited   \u2502         \u2502   \u2502         \u2514\u2500\u2500\u25ba return child status   \u2502   \u2514\u2500\u2500 still alive             \u2502             \u2514\u2500\u2500\u25ba kill(-pgid, SIGKILL)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 happy path \u043d\u0435 \u0434\u0443\u043c\u0430\u0435\u0448\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: child \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f, \u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 timerfd \u0442\u043e\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0418\u043b\u0438 <code>SIGCHLD<\/code> \u0438 shutdown signal \u043f\u0440\u0438\u0448\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0418\u043b\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f main process, \u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u0435\u0449\u0451 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b. \u0418\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0431\u044b\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u043e assembly \u0438 \u0441\u0442\u0430\u043b \u0441\u043a\u043e\u0440\u0435\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u043e Linux process semantics.<\/p>\n<h3>Zombie reaping<\/h3>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 <code>SIGCHLD<\/code>, \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>wait4<\/code> \u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0439. \u041c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0430\u043c\u0438 event loop \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code>while ((pid = waitpid(-1, &amp;status, WNOHANG)) &gt; 0) {    ...}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 libc \u0432\u043c\u0435\u0441\u0442\u043e <code>waitpid()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>wait4(2)<\/code> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. Main child \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c. \u0415\u0441\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f target, \u0435\u0433\u043e status \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f status \u0441\u0430\u043c\u043e\u0433\u043e init. \u0414\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f exit code \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 child \u0431\u044b\u043b \u0443\u0431\u0438\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f shell-\u0441\u0445\u0435\u043c\u0430:<\/p>\n<pre><code>128 + signal_number<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>SIGTERM \u2192 143SIGKILL \u2192 137<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Base \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>EP_EXIT_CODE_BASE<\/code>, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u0447\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u043e\u0438\u0442 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. \u0415\u0441\u0442\u044c \u0438 subreaper mode:<\/p>\n<pre><code>EP_SUBREAPER=1<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 <code>PR_SET_CHILD_SUBREAPER<\/code>. \u042d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434 target \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0438 orphaned descendants \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0442\u044c init \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e reaping.<\/p>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e supervisor: restart-on-crash<\/h3>\n<p>\u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0435\u0439 PID 1. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 restart:<\/p>\n<pre><code>EP_RESTART_ENABLED=1<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>EP_RESTART_ENABLED=1 \\EP_MAX_RESTARTS=3 \\EP_RESTART_BACKOFF_SECONDS=5 \\mini-init-asm -- .\/my-app<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c systemd \u0432 assembly. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c. \u0415\u0441\u0442\u044c restart, \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438 backoff. \u041d\u0435\u0442 dependencies, health checks, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0441\u043b\u043e\u0436\u043d\u044b\u0445 policies \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e supervisor.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e shutdown \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 restart. \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b termination signal \u0438 \u043d\u0430\u0447\u0430\u043b \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, child \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0441\u043d\u043e\u0432\u0430. \u0418 \u0435\u0449\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f, \u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f:<\/p>\n<pre><code>EP_MAX_RESTARTS=0EP_RESTART_BACKOFF_SECONDS=0<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c tight loop. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 backoff \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c.<\/p>\n<h3>ARM64: \u0441\u0431\u043e\u0440\u043a\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0449\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>ARM64 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430. Cross-build \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0431\u044b\u0447\u043d\u043e:<\/p>\n<pre><code>make build-arm64<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0410 \u043d\u0430 x86-\u0445\u043e\u0441\u0442\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437:<\/p>\n<pre><code>qemu-aarch64-static -- .\/build\/mini-init-arm64 -- \/bin\/sh<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418 \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>QEMU user-mode \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u043e\u0441\u0442\u0430\u0445 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>epoll + signalfd + timerfd<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 smoke test \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, child \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0448\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c timing, signals \u0438 event loop, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0439\u0447\u0430\u0441 ARM64 testing \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d. QEMU \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f smoke-\u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c <code>EP_ARM64_FALLBACK=1<\/code> &#8212; \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0439 CI mode, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c spawn \u0438 exit propagation \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a production mode. \u0410 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e \u043d\u0430 ARM64 GitHub runners. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434: &#171;\u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 QEMU&#187; \u0438 &#171;\u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 process semantics \u043d\u0430 \u044d\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435&#187; &#8212; \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435.<\/p>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 Tini<\/h3>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0437\u0434\u0435\u0441\u044c &#8212; \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c benchmark, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>\u0418 Tini, \u0438 <code>mini-init-asm<\/code> \u0440\u0435\u0448\u0430\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 container init: \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442 child, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f reaping \u0438 signal forwarding. \u041d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0446\u0435\u043b\u0438 \u0440\u0430\u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f.<\/p>\n<p>\u0423 <code>mini-init-asm<\/code> process-group forwarding \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 direct Linux syscalls \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 libc. \u0415\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 restart mode.<\/p>\n<p>Tini \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0448\u0435, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0448\u0451\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 workloads. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 &#171;\u0447\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 production?&#187; \u043e\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f <code>mini-init-asm<\/code> \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f:<\/p>\n<p>\u0435\u0441\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043d\u0435\u0442 &#8212; Tini \u0438\u043b\u0438 Docker <code>--init<\/code> \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043c.<\/p>\n<p>\u0410 <code>mini-init-asm<\/code> \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u0433\u0434\u0435 \u043d\u0443\u0436\u0435\u043d \u0438\u043c\u0435\u043d\u043d\u043e PGID-first \u043f\u043e\u0434\u0445\u043e\u0434, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 libc-free static binary \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e container init \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 syscall \u0437\u0430 syscall.<\/p>\n<h3>\u041a\u0430\u043a \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c<\/h3>\n<p>\u0418\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432:<\/p>\n<pre><code>git clone https:\/\/github.com\/roots666\/mini-init-asm.gitcd mini-init-asmmake<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code>.\/build\/mini-init-amd64 -- \/bin\/sh -c 'echo hello; sleep 5'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435:<\/p>\n<pre><code>.\/build\/mini-init-amd64 -- \\  bash -c 'trap \"echo got TERM; exit 0\" TERM; sleep 1000'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e terminal.<\/p>\n<p>\u0414\u043b\u044f Docker \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 Dockerfiles, \u0432\u043a\u043b\u044e\u0447\u0430\u044f multi-arch \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f <code>amd64<\/code> \u0438 <code>arm64<\/code>.<\/p>\n<h3>\u0418 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e &#8212; Debian<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044d\u0442\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0431\u044b\u043b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442. \u042f \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u043b, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 Debian packaging. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0448\u0451\u043b \u0447\u0435\u0440\u0435\u0437 Debian unstable \u0438 \u043f\u043e\u0437\u0436\u0435 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0432 testing.<\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 <code>mini-init-asm<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432:<\/p>\n<pre><code>Debian testing (forky)Debian unstable (sid)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f <code>amd64<\/code> \u0438 <code>arm64<\/code>. \u041d\u0430 testing \u0438\u043b\u0438 sid \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e:<\/p>\n<pre><code>sudo apt updatesudo apt install mini-init-asm<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0438\u0434\u0438\u0442 APT:<\/p>\n<pre><code>apt-cache policy mini-init-asm<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0438\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u0432 Debian archive \u0447\u0435\u0440\u0435\u0437 <code>rmadison<\/code>:<\/p>\n<pre><code>rmadison mini-init-asm<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c: <strong>\u0432 Debian stable \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442<\/strong>.<\/p>\n<p>\u042f \u0431\u044b \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b testing \u043a stable-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0434\u0438 \u044d\u0442\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 stable \u043f\u0440\u043e\u0449\u0435 \u0432\u0437\u044f\u0442\u044c upstream binary, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\/VM.<\/p>\n<p>\u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 Debian \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0435\u0449\u0451 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435: packaging \u0438 review \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0430\u0447\u0435, \u0447\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u043c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 GitHub CI.<\/p>\n<h3>\u0427\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u0435\u043d\u044f \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043f\u0440\u043e\u0441\u0438\u043b\u0438, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u044f \u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u043b: ARM64 assembly. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c &#8212; \u043d\u0435\u0442. \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c syscall \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 <code>SIGCHLD<\/code> \u0438 <code>SIGTERM<\/code> \u043f\u0440\u0438\u0448\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u0433\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c grace period \u043d\u0430\u0447\u0430\u0432\u0448\u0438\u043c\u0441\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 descendants \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f main child;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c restart \u0432\u043e \u0432\u0440\u0435\u043c\u044f shutdown;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c process group \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0439;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 QEMU;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c status, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0448\u0451\u043b \u0438\u0437 <code>wait4<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u043b \u043f\u0440\u043e &#171;\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, PID 1 \u043d\u0430 assembly&#187; \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 &#8212; \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Linux process model. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u044d\u0442\u043e \u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c.<\/p>\n<p><code>syscall<\/code> \u043d\u0430 x86-64 \u0438 <code>svc #0<\/code> \u043d\u0430 ARM64 &#8212; \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u0410 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0438\u0445 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f process groups, sessions, signals, zombies, reparenting, <code>epoll<\/code>, <code>signalfd<\/code>, timers \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 race conditions. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u043e\u0435\u043a\u0442\u0430: \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0435\u0449\u0451 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u043d\u043e \u043f\u043e\u0434 \u043d\u0438\u043c\u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e Linux internals, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435.<\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/tracker.debian.org\/pkg\/mini-init-asm\" rel=\"noopener noreferrer nofollow\">Debian Package Tracker<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/salsa.debian.org\/debian\/mini-init-asm\" rel=\"noopener noreferrer nofollow\">Debian packaging<\/a><\/p>\n<\/li>\n<\/ul>\n<\/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\/articles\/1069824\/\">https:\/\/habr.com\/ru\/articles\/1069824\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u0438\u0434\u0435\u044f: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 PID 1 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435.\u041d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u043e\u043c\u0443 \u043c\u0438\u0440\u0443 \u0441\u0440\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u0435\u043d \u0435\u0449\u0451 \u043e\u0434\u0438\u043d init. \u0415\u0441\u0442\u044c Tini, \u0435\u0441\u0442\u044c docker run &#8212;init, \u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 production-\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u044f \u0431\u044b \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0430\u0447\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043d\u0438\u0445.\u041c\u043d\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f: \u0431\u0435\u0437 libc, \u0431\u0435\u0437 runtime, \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 Linux syscalls. \u0417\u0430\u043e\u0434\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 x86-64 \u0438 ARM64.\u0412 \u0438\u0442\u043e\u0433\u0435 \u0438\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f mini-init-asm: PID 1, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 process group, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0432\u0441\u0435\u0439 \u0433\u0440\u0443\u043f\u043f\u0435, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 zombie-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438 \u0443\u043c\u0435\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 exit code \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.\u041f\u043e\u0437\u0436\u0435 \u0442\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c subreaper mode \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 restart-on-crash. \u0410 \u0441\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u0435\u0445\u0430\u043b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e Debian unstable, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438 \u0434\u043e testing.\u041d\u043e \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430: \u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 PID 1 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430?\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f init\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:container\u2514\u2500\u2500 application    PID 1    \u251c\u2500\u2500 worker    \u2514\u2500\u2500 helper\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439\u0441\u044f child \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f zombie \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043d\u0435 \u0437\u0430\u0431\u0435\u0440\u0451\u0442 \u0435\u0433\u043e status \u0447\u0435\u0440\u0435\u0437 wait*(). \u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 orphaned \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 init. \u0412 PID namespace \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u044d\u0442\u0443 \u0440\u043e\u043b\u044c \u0438\u0433\u0440\u0430\u0435\u0442 \u0435\u0433\u043e PID 1.\u0421 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u044e\u0430\u043d\u0441\u044b. \u0423 namespace init \u043e\u0441\u043e\u0431\u0430\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430, \u0438 \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0432 namespace.\u041f\u043e\u044d\u0442\u043e\u043c\u0443 Docker \u0443\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 init:docker run &#8212;init image\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 &#8212; Tini. \u041e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 child, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f reaping \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u044b. \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435. \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0439 \u0438 \u044f\u0434\u0440\u043e\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e.\u041f\u043e\u0447\u0435\u043c\u0443 assembly\u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0432\u044b\u0431\u043e\u0440 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0434\u0430\u0451\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.PID 1 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u0436\u0434\u0451\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e. Assembly \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435: \u043e\u043d \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044f\u0432\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438 Linux kernel.\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c signalfd, \u0442\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0448\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 libc. \u0422\u044b \u043a\u043b\u0430\u0434\u0451\u0448\u044c \u043d\u043e\u043c\u0435\u0440 syscall \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440, \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0448\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e ABI \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0448\u044c \u0432 kernel. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441 clone, execve, wait4, kill, setsid, epoll, timerfd.\u0411\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0438 \u043b\u0438\u043d\u043a\u0443\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437:ld -nostdlib\u0414\u043b\u044f x86-64 Linux syscall ABI \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439:syscall number: raxarg1: rdiarg2: rsiarg3: rdxarg4: r10arg5: r8arg6: r9instruction: syscall\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:mov rax, SYS_killmov rdi, rbxmov rsi, SIGTERMsyscall\u041d\u0430 AArch64 \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b:syscall number: x8arg1: x0arg2: x1arg3: x2arg4: x3arg5: x4arg6: x5instruction: svc #0\u0422\u043e \u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:mov x8, #SYS_killmov x0, x19mov x1, #SIGTERMsvc #0\u041a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b ARM64-\u0432\u0435\u0440\u0441\u0438\u044e, \u043e\u0436\u0438\u0434\u0430\u043b, \u0447\u0442\u043e \u0434\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u043e\u0439\u0434\u0443\u0442\u0441\u044f. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0435\u043c \u0436\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043c, \u0433\u0434\u0435 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c: syscall numbers, register ABI \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e architecture-specific \u0434\u0435\u0442\u0430\u043b\u0435\u0439. \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0432\u043d\u043e:src\/\u251c\u2500\u2500 amd64\/\u2514\u2500\u2500 arm64\/include\/\u251c\u2500\u2500 macros.inc\u251c\u2500\u2500 macros_arm64.inc\u251c\u2500\u2500 syscalls_amd64.inc\u2514\u2500\u2500 syscalls_aarch64.inc\u0421\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c syscall \u0438\u043b\u0438 svc #0. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0448\u043b\u043e \u043d\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0438\u0434\u0443\u0442 \u0432 process group\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 entrypoint:mini-init      PID 1\u2514\u2500\u2500 shell    \u251c\u2500\u2500 worker A    \u2514\u2500\u2500 worker B\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SIGTERM. \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:kill(child_pid, SIGTERM);\u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0441\u0438\u0433\u043d\u0430\u043b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 child. \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0441 worker A \u0438 worker B, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0443\u0436\u0435 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 init \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u0435\u0435 \u044f\u0432\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 target \u0432 mini-init-asm \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u0439 session \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e process group:mini-init              PID 1application            PGID 42\u251c\u2500\u2500 worker A\u2514\u2500\u2500 worker B\u0410 forwarding \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437:kill(-pgid, signal);\u041e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 PID \u0437\u0434\u0435\u0441\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 process group. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438 SIGTERM \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439:SIGTERM   \u2502   \u25bcmini-init   \u2502   \u2514\u2500\u2500 kill(-pgid, SIGTERM)                \u2502                \u251c\u2500\u2500 application                \u251c\u2500\u2500 worker A                \u2514\u2500\u2500 worker B\u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430: group forwarding \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0446\u0438\u0435\u0439, \u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0440\u0435\u0436\u0438\u043c\u043e\u043c. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, process group \u043d\u0435 \u0434\u0430\u0451\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u043b\u044e\u0431\u044b\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e session \u0438\u043b\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u044e process topology. \u041d\u043e \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e container entrypoint PGID-first \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0439.\u0412\u043c\u0435\u0441\u0442\u043e signal handlers \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b signalfd\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c main loop.\u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 signal handlers, \u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c child \u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430\u043c\u0438. \u041d\u043e Linux \u0434\u0430\u0451\u0442 signalfd(2), \u0438 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e init \u043e\u043d \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u041d\u0443\u0436\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 signal mask, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437 file descriptor. \u0410 \u0440\u0430\u0437 \u044d\u0442\u043e fd, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 epoll.\u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d event loop:                \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510signals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25ba\u2502 signalfd \u2502                \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518                     \u2502                     \u25bc                \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510                \u2502  epoll  \u2502                \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2518                     \u2502              \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2510              \u2502             \u2502           SIGCHLD       TERM\/INT\/&#8230;              \u2502             \u2502              \u25bc             \u25bc            wait4       kill(-pgid)\u0422\u0443\u0434\u0430 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f timerfd, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 graceful shutdown timeout. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0430\u044f state machine. \u0412 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u043c pseudo-C \u043e\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:for (;;) {    int n = epoll_wait(epfd, events, MAX_EVENTS, -1);    for (int i = 0; i &lt; n; i++) {        if (events[i].data.fd == signal_fd) {            struct signalfd_siginfo si;            read(signal_fd, &amp;si, sizeof(si));            if (is_shutdown_signal(si.ssi_signo)) {                kill(-child_pgid, si.ssi_signo);                arm_grace_timer();            } else if (si.ssi_signo == SIGCHLD) {                reap_children();            } else {                kill(-child_pgid, si.ssi_signo);            }        }        if (events[i].data.fd == timer_fd) {            kill(-child_pgid, SIGKILL);        }    }}\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439: \u043d\u0443\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c main child, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u043c\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 read, \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 syscall \u0438 race conditions \u0432\u043e\u043a\u0440\u0443\u0433 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443. \u0418 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f signalfd signal handling \u0434\u0430\u0436\u0435 \u0432 assembly \u043d\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u044b\u0436\u043a\u043e\u0432 \u0438\u0437 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 handlers.\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 docker stop\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 soft shutdown signal &#8212; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 SIGTERM &#8212; \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0439 process group. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f grace timer. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e 10 \u0441\u0435\u043a\u0443\u043d\u0434:EP_GRACE_SECONDS=10\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u043e\u0441\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f, init \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0435\u0433\u043e status \u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442:SIGTERM   \u2502   \u25bckill(-pgid, SIGTERM)   \u2502   \u25bcgrace period   \u2502   \u251c\u2500\u2500 application exited   \u2502         \u2502   \u2502         \u2514\u2500\u2500\u25ba return child status   \u2502   \u2514\u2500\u2500 still alive             \u2502             \u2514\u2500\u2500\u25ba kill(-pgid, SIGKILL)\u0417\u0434\u0435\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 happy path \u043d\u0435 \u0434\u0443\u043c\u0430\u0435\u0448\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: child \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f, \u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 timerfd \u0442\u043e\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0418\u043b\u0438 SIGCHLD \u0438 shutdown signal \u043f\u0440\u0438\u0448\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0418\u043b\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f main process, \u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u0435\u0449\u0451 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b. \u0418\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0431\u044b\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u043e assembly \u0438 \u0441\u0442\u0430\u043b \u0441\u043a\u043e\u0440\u0435\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u043e Linux process semantics.Zombie reaping\u041f\u043e\u043b\u0443\u0447\u0438\u0432 SIGCHLD, \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432\u044b\u0437\u0432\u0430\u0442\u044c wait4 \u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0439. \u041c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0430\u043c\u0438 event loop \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:while ((pid = waitpid(-1, &amp;status, WNOHANG)) &gt; 0) {    &#8230;}\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 libc \u0432\u043c\u0435\u0441\u0442\u043e waitpid() \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f wait4(2) \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. Main child \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c. \u0415\u0441\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f target, \u0435\u0433\u043e status \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f status \u0441\u0430\u043c\u043e\u0433\u043e init. \u0414\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f exit code \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 child \u0431\u044b\u043b \u0443\u0431\u0438\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f shell-\u0441\u0445\u0435\u043c\u0430:128 + signal_number\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:SIGTERM \u2192 143SIGKILL \u2192 137Base \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 EP_EXIT_CODE_BASE, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u0447\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u043e\u0438\u0442 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. \u0415\u0441\u0442\u044c \u0438 subreaper mode:EP_SUBREAPER=1\u041e\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 PR_SET_CHILD_SUBREAPER. \u042d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434 target \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0438 orphaned descendants \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0442\u044c init \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e reaping.\u041d\u0435\u043c\u043d\u043e\u0433\u043e supervisor: restart-on-crash\u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0435\u0439 PID 1. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 restart:EP_RESTART_ENABLED=1\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:EP_RESTART_ENABLED=1 \\EP_MAX_RESTARTS=3 \\EP_RESTART_BACKOFF_SECONDS=5 \\mini-init-asm &#8212; .\/my-app\u0417\u0434\u0435\u0441\u044c \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c systemd \u0432 assembly. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c. \u0415\u0441\u0442\u044c restart, \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438 backoff. \u041d\u0435\u0442 dependencies, health checks, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0441\u043b\u043e\u0436\u043d\u044b\u0445 policies \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e supervisor.\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e shutdown \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 restart. \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b termination signal \u0438 \u043d\u0430\u0447\u0430\u043b \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, child \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0441\u043d\u043e\u0432\u0430. \u0418 \u0435\u0449\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f, \u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f:EP_MAX_RESTARTS=0EP_RESTART_BACKOFF_SECONDS=0\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c tight loop. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 backoff \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c.ARM64: \u0441\u0431\u043e\u0440\u043a\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0449\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044fARM64 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430. Cross-build \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0431\u044b\u0447\u043d\u043e:make&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-490722","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/490722","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=490722"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/490722\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=490722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=490722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=490722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}