{"id":289471,"date":"2018-09-16T22:55:02","date_gmt":"2018-09-16T18:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289471"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289471","title":{"rendered":"\u0418\u0437\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 Linux"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/w9\/tj\/yz\/w9tjyz5nyynb4zwy2kiikc0ckec.png\"><br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0435 \u041e\u0421 Linux. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0440\u043e\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u0443\u043c\u0438\u0440\u0430\u044e\u0442, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432. <\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0442\u0435\u0445, \u043a\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 Linux.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u0451 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0438\u0436\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043a Debian Linux \u0441 \u044f\u0434\u0440\u043e\u043c 4.15.0.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ol>\n<li> <a href=\"#intro\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <\/a> <\/li>\n<li> <a href=\"#definition\">\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <\/a> <\/li>\n<li> <a href=\"#lifecycle\">\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <\/a><br \/> \n<ol>\n<li> <a href=\"#fork\"> \u0420\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <\/a> <\/li>\n<li> <a href=\"#ready\"> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0433\u043e\u0442\u043e\u0432\u00bb <\/a> <\/li>\n<li> <a href=\"#running\"> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f\u00bb <\/a> <\/li>\n<li> <a href=\"#exec\"> \u041f\u0435\u0440\u0435\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <\/a> <\/li>\n<li> <a href=\"#waiting\"> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u00bb <\/a> <\/li>\n<li> <a href=\"#stopped\"> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u00bb <\/a> <\/li>\n<li> <a href=\"#exit\"> \u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <\/a> <\/li>\n<li> <a href=\"#zombie\"> \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0437\u043e\u043c\u0431\u0438\u00bb <\/a> <\/li>\n<li> <a href=\"#wait\"> \u0417\u0430\u0431\u044b\u0442\u044c\u0435 <\/a> <\/li>\n<\/ol>\n<\/li>\n<li> <a href=\"#thanks\">\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438 <\/a> <\/li>\n<\/ol>\n<p>  <a name=\"intro\"><\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u044f\u0434\u0440\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0412 \u0440\u0435\u0434\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 API, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, procfs \u0438\u043b\u0438 sysfs, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<p>  <a name=\"definition\"><\/a><\/p>\n<h2>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/h2>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 \u044f\u0434\u0440\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u0435\u0439 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/lxr.linux.no\/linux\/include\/linux\/sched.h#L520\">include\/linux\/sched.h<\/a>). <br \/>  \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0430 \u043d\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044f\u0434\u0440\u0430, \u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u0430\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043e\u043b\u044f\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<ul>\n<li> \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 (pid) <\/li>\n<li> \u041e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b (fd)<\/li>\n<li> \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 (signal handler) <\/li>\n<li> \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 (cwd) <\/li>\n<li> \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (enivron) <\/li>\n<li> \u041a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 <\/li>\n<\/ul>\n<p>  <a name=\"lifecycle\"><\/a><\/p>\n<h2>\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dw\/ru\/5n\/dwru5nbeoag7imroc_ki1qa9gba.png\"><\/p>\n<p>  <a name=\"fork\"><\/a><\/p>\n<h3>\u0420\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <\/h3>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u2014 <code>init<\/code> \u2014 \u043e\u043d \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u044f\u0434\u0440\u043e\u043c. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0443\u0442\u0451\u043c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>fork(2)<\/code>. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <code>fork(2)<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0432\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432:<\/p>\n<ol>\n<li> <code>fork(2)<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e PID \u0440\u0435\u0431\u0451\u043d\u043a\u0430, \u0440\u0435\u0431\u0451\u043d\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f 0;<\/li>\n<li> \u0423 \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f PPID (Parent Process Id) \u043d\u0430 PID \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f.<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <code>fork(2)<\/code> \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u043f\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u0434\u0435\u043b\u043e \u0434\u043e\u0440\u043e\u0433\u043e\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044f\u0434\u0440\u0435 Linux \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f Copy-On-Write. <br \/>  \u0412\u0441\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a read-only \u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e, \u0438 \u0440\u0435\u0431\u0451\u043d\u043a\u0443. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u044d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0430 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u043a\u043e\u043f\u0438\u044f. \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u00ab\u043e\u0442\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f\u00bb \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e read-only \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u00ab\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u00bb \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u043d\u043e\u0432\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0443\u0441 read-write. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 fork(2)<\/b><\/p>\n<div class=\"spoiler_text\">  <\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;errno.h&gt; #include &lt;sys\/wait.h&gt; #include &lt;sys\/types.h&gt;  int main() {     int pid = fork();     switch(pid) {         case -1:             perror(\"fork\");             return -1;         case 0:             \/\/ Child             printf(\"my pid = %i, returned pid = %i\\n\", getpid(), pid);             break;         default:             \/\/ Parent             printf(\"my pid = %i, returned pid = %i\\n\", getpid(), pid);             break;     }     return 0; } <\/code><\/pre>\n<pre><code class=\"bash\">$ gcc test.c &amp;&amp; .\/a.out my pid = 15594, returned pid = 15595 my pid = 15595, returned pid = 0 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"ready\"><\/a><\/p>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0433\u043e\u0442\u043e\u0432\u00bb<\/h3>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <code>fork(2)<\/code> \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0433\u043e\u0442\u043e\u0432\u00bb. <br \/>  \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0442\u043e\u0438\u0442 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0436\u0434\u0451\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a (scheduler) \u0432 \u044f\u0434\u0440\u0435 \u0434\u0430\u0441\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435. <\/p>\n<p>  <a name=\"running\"><\/a><\/p>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f\u00bb<\/h3>\n<p>  \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f\u00bb. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a (\u043a\u0432\u0430\u043d\u0442) \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0432\u044b\u0432\u043e\u0437\u043e\u043c <code>sched_yield<\/code>.<\/p>\n<p>  <a name=\"exec\"><\/a><\/p>\n<h3>\u041f\u0435\u0440\u0435\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/h3>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0437\u0430\u0434\u0430\u0447\u0438. \u0420\u0435\u0431\u0451\u043d\u043e\u043a \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043b\u0438\u0448\u044c \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0438\u043c \u0434\u0435\u0442\u044f\u043c \u0437\u0430\u0434\u0430\u0447\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0435\u043c\u0443.<br \/>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443 <code>execve(2)<\/code>:<\/p>\n<pre><code class=\"cpp\">int execve(const char *filename, char *const argv[], char *const envp[]); <\/code><\/pre>\n<p>  \u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u0430\u043c <code>execl(3), execlp(3), execle(3), execv(3), execvp(3), execvpe(3)<\/code>:<\/p>\n<pre><code class=\"cpp\">int execl(const char *path, const char *arg, ... \/* (char  *) NULL *\/); int execlp(const char *file, const char *arg, ...  \/* (char  *) NULL *\/); int execle(const char *path, const char *arg, ...                              \/*, (char *) NULL, char * const envp[] *\/); int execv(const char *path, char *const argv[]); int execvp(const char *file, char *const argv[]); int execvpe(const char *file, char *const argv[], char *const envp[]); <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0443\u0436\u0435 \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043a\u0440\u043e\u043c\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u043a <code>O_CLOEXEC<\/code>, \u043e\u043d\u0438 \u0437\u0430\u043a\u0440\u043e\u044e\u0442\u0441\u044f. <\/p>\n<p>  \u041a\u0430\u043a \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439? \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u0442\u0438\u0447\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li> \u0412\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 <code>exec<\/code> <\/li>\n<li> \u041f\u044f\u0442\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0438\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432: <br \/> \n<ul>\n<li><b>l<\/b> \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <b>list<\/b>, \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a <code>arg1, arg2, ..., NULL<\/code> <\/li>\n<li><b>v<\/b> \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <b>vector<\/b>, \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435; <\/li>\n<\/ul>\n<\/li>\n<li> \u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u043a\u0432\u0430 <b>p<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <b>path<\/b>. \u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>file<\/code> \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u0442 &#171;\/&#187;, \u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 <code>file<\/code> \u0438\u0449\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0445, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <code>PATH<\/code> <\/li>\n<li> \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0443\u043a\u0432\u0430 <b>e<\/b>, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0430\u044f <b>enivron<\/b>. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0438\u0434\u0451\u0442 \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0432\u0438\u0434\u0430 <code>key=value<\/code> \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. <\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0437\u043e\u0432\u0430 \/bin\/cat &#8212;help \u0447\u0435\u0440\u0435\u0437 execve<\/b><\/p>\n<div class=\"spoiler_text\">  <\/p>\n<pre><code class=\"cpp\">#define _GNU_SOURCE #include &lt;unistd.h&gt;  int main() {     char* args[] = { \"\/bin\/cat\", \"--help\", NULL };     execve(\"\/bin\/cat\", args, environ);     \/\/ Unreachable     return 1; } <\/code><\/pre>\n<pre><code class=\"bash\">$ gcc test.c &amp;&amp; .\/a.out Usage: \/bin\/cat [OPTION]... [FILE]... Concatenate FILE(s) to standard output.  *\u0412\u044b\u0432\u043e\u0434 \u043e\u0431\u0440\u0435\u0437\u0430\u043d* <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <code>exec*<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0448\u0435\u0431\u0430\u043d\u0433 (#!).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441 \u043f\u043e\u0434\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u043c PATH c \u043f\u043e\u043c\u043e\u0449\u044c\u044e execle<\/b><\/p>\n<div class=\"spoiler_text\">  <\/p>\n<pre><code class=\"cpp\">#define _GNU_SOURCE #include &lt;unistd.h&gt;  int main() {     char* e[] = {\"PATH=\/habr:\/rulez\", NULL};     execle(\"\/tmp\/test.sh\", \"test.sh\", NULL, e);     \/\/ Unreachable     return 1; } <\/code><\/pre>\n<pre><code class=\"bash\">$ cat test.sh #!\/bin\/bash echo $0 echo $PATH $ gcc test.c &amp;&amp; .\/a.out \/tmp\/test.sh \/habr:\/rulez <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0415\u0441\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442, \u0447\u0442\u043e argv[0] \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 exec*. \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 cat \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f dog \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e execlp<\/b><\/p>\n<div class=\"spoiler_text\">  <\/p>\n<pre><code class=\"cpp\">#define _GNU_SOURCE #include &lt;unistd.h&gt;  int main() {     execlp(\"cat\", \"dog\", \"--help\", NULL);     \/\/ Unreachable     return 1; } <\/code><\/pre>\n<pre><code class=\"bash\">$ gcc test.c &amp;&amp; .\/a.out Usage: dog [OPTION]... [FILE]...  *\u0412\u044b\u0432\u043e\u0434 \u043e\u0431\u0440\u0435\u0437\u0430\u043d* <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>int main(int argc, char* argv[])<\/code> \u0435\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u0432 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>exec*<\/code> \u043d\u0438\u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f. \u041f\u043e\u0447\u0435\u043c\u0443? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432 main. \u041f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 glibc, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0434\u0441\u0447\u0451\u0442 argc.<\/p>\n<p>  <a name=\"waiting\"><\/a><\/p>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u00bb<\/h3>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u043e\u043b\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0432\u043e\u0434-\u0432\u044b\u0432\u043e\u0434. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u00bb. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d, \u044f\u0434\u0440\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0433\u043e\u0442\u043e\u0432\u00bb.<br \/>  \u0412 Linux \u0442\u0430\u043a \u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u00bb, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u00ab\u043d\u0435\u0443\u0431\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u00bb, \u0430 \u0432\u0441\u0435 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0432\u0441\u0442\u0430\u044e\u0442 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<br \/>  \u042f\u0434\u0440\u043e \u0441\u0430\u043c\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442, \u0432 \u043a\u0430\u043a\u043e\u0435 \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0436\u0438\u0434\u0430\u0435\u0442 (\u0431\u0435\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439)\u00bb \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442 \u0432\u0432\u043e\u0434-\u0432\u044b\u0432\u043e\u0434. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 (NFS) \u0441 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u043e\u043c.<\/p>\n<p>  <a name=\"stopped\"><\/a><\/p>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u00bb<\/h3>\n<p>  \u0412 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0432 \u0435\u043c\u0443 \u0441\u0438\u0433\u043d\u0430\u043b SIGSTOP. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u00bb \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 (SIGCONT) \u0438\u043b\u0438 \u0443\u043c\u0435\u0440\u0435\u0442\u044c (SIGKILL). \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. <\/p>\n<p>  <a name=\"exit\"><\/a><\/p>\n<h3>\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/h3>\n<p>  \u041d\u0438 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u0430. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043b\u0438\u0448\u044c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0431 \u044d\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>_exit<\/code> \u0438\u043b\u0438 \u0431\u044b\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438. \u0414\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0448\u044c \u0447\u0438\u0441\u043b\u043e \u0438\u0437 <code>main()<\/code>, \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>_exit<\/code>.<br \/>  \u0425\u043e\u0442\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 int, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \u0447\u0438\u0441\u043b\u0430.<\/p>\n<p>  <a name=\"zombie\"><\/a><\/p>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0437\u043e\u043c\u0431\u0438\u00bb<\/h3>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f (\u043d\u0435\u0432\u0430\u0436\u043d\u043e, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0442), \u044f\u0434\u0440\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u0437\u043e\u043c\u0431\u0438\u00bb. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0437\u043e\u043c\u0431\u0438 \u2014 \u044d\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043d\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u043e \u043d\u0451\u043c \u0432\u0441\u0451 \u0435\u0449\u0451 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u044f\u0434\u0440\u0435. <br \/>  \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0441\u043c\u0435\u043b\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b SIGKILL, \u0432\u0435\u0434\u044c \u0447\u0442\u043e \u043c\u0435\u0440\u0442\u0432\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u043c\u0435\u0440\u0435\u0442\u044c \u0435\u0449\u0451 \u0440\u0430\u0437. <\/p>\n<p>  <a name=\"wait\"><\/a><\/p>\n<h3>\u0417\u0430\u0431\u044b\u0442\u044c\u0435<\/h3>\n<p>  \u041a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u044f\u0434\u0440\u0435 \u0438 \u0435\u0451 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0442\u0443\u0434\u0430 \u0437\u0430\u0431\u0440\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">pid_t wait(int *wstatus); \/* \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e waitpid(-1, wstatus, 0) *\/  pid_t waitpid(pid_t pid, int *wstatus, int options); <\/code><\/pre>\n<p>  \u0412\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0432 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 int. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441\u044b, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 man-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <code>waitpid(2)<\/code>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430<\/b><\/p>\n<div class=\"spoiler_text\">  <\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;errno.h&gt; #include &lt;sys\/wait.h&gt; #include &lt;sys\/types.h&gt;  int main() {     int pid = fork();     switch(pid) {         case -1:             perror(\"fork\");             return -1;         case 0:             \/\/ Child             return 13;         default: {             \/\/ Parent             int status;             waitpid(pid, &amp;status, 0);             printf(\"exit normally? %s\\n\", (WIFEXITED(status) ? \"true\" : \"false\"));             printf(\"child exitcode = %i\\n\", WEXITSTATUS(status));             break;         }     }     return 0; } <\/code><\/pre>\n<pre><code class=\"bash\">$ gcc test.c &amp;&amp; .\/a.out exit normally? true child exitcode = 13 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">  \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 argv[0] \u043a\u0430\u043a NULL \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e.<\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;errno.h&gt; #include &lt;sys\/wait.h&gt; #include &lt;sys\/types.h&gt;  int main() {     int pid = fork();     switch(pid) {         case -1:             perror(\"fork\");             return -1;         case 0:             \/\/ Child             execl(\"\/bin\/cat\", NULL);             return 13;         default: {             \/\/ Parent             int status;             waitpid(pid, &amp;status, 0);             if(WIFEXITED(status)) {                 printf(\"Exit normally with code %i\\n\", WEXITSTATUS(status));             }             if(WIFSIGNALED(status)) {                 printf(\"killed with signal %i\\n\", WTERMSIG(status));             }             break;         }     }     return 0; } <\/code><\/pre>\n<pre><code class=\"bash\">$ gcc test.c &amp;&amp; .\/a.out killed with signal 6 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0411\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0440\u0435\u0431\u0451\u043d\u043e\u043a. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 <code>init<\/code> \u0438 \u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 <code>wait(2)<\/code>, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0451\u0442 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0437\u0430\u0431\u0440\u0430\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043c\u0435\u0440\u0442\u0438 \u0440\u0435\u0431\u0451\u043d\u043a\u0430, \u044f\u0434\u0440\u043e \u0441\u0442\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0440\u0435\u0431\u0451\u043d\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u043e \u0432\u0441\u043a\u043e\u0440\u0435 \u043f\u0440\u0438\u0448\u0451\u043b \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<p>  <a name=\"thanks\"><\/a><\/p>\n<h2>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0421\u0430\u0448\u0435 \u00abAl\u00bb \u0437\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0443\u0440\u0443 \u0438 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438;<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0421\u0430\u0448\u0435 \u00abReisse\u00bb \u0437\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>  \u041e\u043d\u0438 \u0441\u0442\u043e\u0439\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0430\u0432\u0448\u0435\u0435 \u043d\u0430 \u043c\u0435\u043d\u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u043f\u0430\u0432\u0448\u0438\u0439 \u043d\u0430 \u043d\u0438\u0445 \u0448\u043a\u0432\u0430\u043b \u043c\u043e\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/post\/423049\/\"> https:\/\/habr.com\/post\/423049\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/w9\/tj\/yz\/w9tjyz5nyynb4zwy2kiikc0ckec.png\"><br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0435 \u041e\u0421 Linux. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0440\u043e\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u0443\u043c\u0438\u0440\u0430\u044e\u0442, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432. <\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0442\u0435\u0445, \u043a\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 Linux.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-289471","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289471","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=289471"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289471\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}