{"id":454308,"date":"2025-04-01T21:00:12","date_gmt":"2025-04-01T21:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=454308"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=454308","title":{"rendered":"<span>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Go<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/896102\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/8b\/l5\/5e\/8bl55e5uri2kceqzd7cm6cuuu_g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/8b\/l5\/5e\/8bl55e5uri2kceqzd7cm6cuuu_g.jpeg\" data-blurred=\"true\"\/><\/div>\n<p><\/a><br \/> \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u043d\u0430\u043c\u0438 \u041f\u041e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0448\u0438 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f, \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0435\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438? \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e. \u041c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u043d\u0435\u0441\u0451\u043d\u043d\u043e\u0435 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442 \u0432\u043d\u0435\u0441\u0451\u043d\u043d\u043e\u0435 \u0434\u0440\u0443\u0433\u0438\u043c. \u0421\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435: \u043c\u043e\u0436\u0435\u0442 \u00ab\u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c\u00bb \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u0418\u043b\u0438 \u043e\u0431\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u043c\u0443. \u041c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u00ab\u0433\u043e\u043d\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb \u2014 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u0432\u0430 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0435\u0437 \u0434\u043e\u043b\u0436\u043d\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p> \u0412\u0441\u0451 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u0438 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432. \u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u044d\u0442\u043e\u0439 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432.<a name=\"habracut\"><\/a><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u043e\u0442\u043e\u043a\u0438 \u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b<\/font><\/h2>\n<p> \u041f\u043e\u0442\u043e\u043a (thread) \u2014 \u044d\u0442\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041f\u043e\u0442\u043e\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0435\u0434\u0438\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 CPU \u043a\u043e\u043c\u0430\u043d\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041f\u043e\u0442\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043f\u043e \u0441\u0443\u0442\u0438, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u043e\u0434\u043d\u0443 \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u043b\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435), \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p> \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430, \u0432 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Go \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439 (goroutine). \u0425\u043e\u0442\u044c \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0432 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435 \u043e\u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u0421\u0440\u0435\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Go \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0432 \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438, \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u044f\u0434\u0440\u0430 \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0441\u0442\u0435\u043a\u043e\u043c \u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p> \u041e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0432 Go \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b, \u0447\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u0438 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0433\u043e\u0440\u0443\u0442\u0438\u043d, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p> \u0412 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0435 Go \u0440\u0430\u0437\u043c\u044b\u0432\u0430\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u043e\u043c. \u041a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c (concurrency) \u2014 \u044d\u0442\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430\u0434\u0430\u0447 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043c\u043e\u0433\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c \u0436\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0441 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u041a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0435\u0442 \u0443\u043f\u043e\u0440 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u041f\u041e \u0441 \u0446\u0435\u043b\u044c\u044e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0441 \u043e\u0434\u043d\u0438\u043c, \u0442\u0430\u043a \u0438 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u044f\u0434\u0440\u0430\u043c\u0438, \u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u0438 \u0434\u0432\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p> \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>go<\/code> \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"go\">go func() {     fmt.Println(\"Canada\") }()<\/code><\/pre>\n<p> \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430, \u043d\u043e \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Go \u0441\u0430\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f, \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b.<\/p>\n<p> \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u043b\u0438\u0448\u044c \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\" )  func main() {     go func() {         fmt.Println(\"Canada\")     }() }<\/code><\/pre>\n<p> \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>main<\/code> \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430. \u0412 Go \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e (\u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e), \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>main<\/code> (\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430) \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d. \u0415\u0441\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0442\u043e\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d. \u0427\u0442\u043e\u0431\u044b \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u0441 \u043f\u043e\u0440\u043e\u0436\u0434\u0451\u043d\u043d\u043e\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043a\u0430\u043d\u0430\u043b\u0430 \u0438\u043b\u0438 WaitGroup.<\/p>\n<p> \u041a\u0430\u043d\u0430\u043b (channel) \u0432 Go \u2014 \u044d\u0442\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c (\u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c) \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0451 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041a\u0430\u043d\u0430\u043b \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>make<\/code>:<\/p>\n<pre><code class=\"go\">ch := make(chan int) \/\/ \u043a\u0430\u043d\u0430\u043b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0441 integer<\/code><\/pre>\n<p> \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>chan<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430. \u0422\u0438\u043f \u043f\u043e\u0441\u043b\u0435 <code>chan<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>int<\/code>) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b.<\/p>\n<p> \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u043d\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>&lt;-<\/code>.<\/p>\n<pre><code class=\"go\">ch &lt;- 42 \/\/ \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u0430\u043d\u0430\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 42<\/code><\/pre>\n<p> \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>&lt;-<\/code>.<\/p>\n<pre><code class=\"go\">value := &lt;-ch \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432 'value'<\/code><\/pre>\n<p> \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>close<\/code>: <code>close(ch)<\/code>. \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0430\u043d\u0438\u043a\u0443.<\/p>\n<p> \u041f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u00abCanada\u00bb:<\/p>\n<pre><code class=\"go\">package main  import \"fmt\"  func main() {     ch := make(chan string) \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a      go func() {         ch &lt;- \"Canada\" \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u043d\u0430\u043b     }()      msg := &lt;-ch \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435     fmt.Println(msg) }<\/code><\/pre>\n<p> \u041a\u043e\u0434 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\" )  func main() {     channel := make(chan bool) \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438      go func() {         fmt.Println(\"Canada\")         channel &lt;- true \/\/ \u0421\u0438\u0433\u043d\u0430\u043b \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435     }()      &lt;-channel \/\/ \u041e\u0436\u0438\u0434\u0430\u0435\u043c, \u043f\u043e\u043a\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 }<\/code><\/pre>\n<p> \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043a\u0430\u043d\u0430\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<code>true<\/code>). \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>main<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430 <code>&lt;-done<\/code>, \u043e\u0436\u0438\u0434\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043e\u043d\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u044b\u0445\u043e\u0434, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430.<\/p>\n<p> \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 \u043a\u0430\u043d\u0430\u043b\u0430 \u043d\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u0430: \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0442\u043e \u043e\u043d \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"go\">ch := make(chan int, 2) ch &lt;- 1 \/\/ \u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 (\u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u043e) ch &lt;- 2 \/\/ \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 (\u0431\u0443\u0444\u0435\u0440 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u043e\u043d) ch &lt;- 3 \/\/ \u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e<\/code><\/pre>\n<p> \u0412 \u044f\u0437\u044b\u043a\u0435 Go \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041a\u0430\u043d\u0430\u043b\u044b \u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 Go, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0438\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p> \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0432\u0443\u043c URL:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"net\/http\"     \"time\" )  \/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Response \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f URL \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f type Response struct {     url    string     status string     err    error }  func fetchURL(url string, ch chan Response) {     \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c HTTP-\u043a\u043b\u0438\u0435\u043d\u0442 \u0441 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u043c     client := &amp;http.Client{         Timeout: 10 * time.Second,     }      \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 HTTP GET     resp, err := client.Get(url)     if err != nil {         ch &lt;- Response{url, \"\", err}         return     }     defer resp.Body.Close()      ch &lt;- Response{url, resp.Status, nil} }  func main() {     \/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430     startTime := time.Now()     \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432     ch := make(chan Response)      \/\/ URL \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f     urls := []string{         \"https:\/\/www.google.com\",         \"https:\/\/www.github.com\",     }      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e URL     for _, url := range urls {         go fetchURL(url, ch)     }      \/\/ \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b     for i := 0; i &lt; len(urls); i++ {         resp := &lt;-ch         if resp.err != nil {             fmt.Printf(\"Error fetching %s: %v\\n\", resp.url, resp.err)         } else {             fmt.Printf(\"Successfully fetched %s: %s\\n\", resp.url, resp.status)         }     }      \/\/ \u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u043d\u0430\u043b (\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f)     close(ch)      \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f     elapsed := time.Since(startTime)      fmt.Printf(\"\\nTotal time taken: %s\\n\", elapsed) }<\/code><\/pre>\n<p> \u042d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Response \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f URL, \u0435\u0433\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a. \u041e\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>fetchURL<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 URL \u0438 \u043a\u0430\u043d\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 HTTP-\u043a\u043b\u0438\u0435\u043d\u0442 \u0441 10-\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u044b\u043c \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 GET \u043a URL \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043d\u0430\u043b. \u041e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>defer<\/code>, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u0430\u043d\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043a\u0430\u043a <code>ch chan&lt;- Response<\/code>, \u0430 \u043d\u0435 <code>ch chan Response<\/code>. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main<\/code> \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0434\u0432\u0430 URL \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e URL, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.<\/p>\n<p> \u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u0430 URL \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e; \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u0430\u043d\u0430\u043b\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab200 OK\u00bb) \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e URL.<\/p>\n<p> \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0431\u0435\u0437 \u0433\u043e\u0440\u0443\u0442\u0438\u043d, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0449\u0435:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"net\/http\"     \"time\" )  \/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Response \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f URL \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f type Response struct {     url    string     status string     err    error }  func fetchURLSynchro(url string) Response {     \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c HTTP-\u043a\u043b\u0438\u0435\u043d\u0442 \u0441 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u043c     client := &amp;http.Client{         Timeout: 10 * time.Second,     }      \/\/ \u0414\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 HTTP GET     resp, err := client.Get(url)     if err != nil {         return Response{url, \"\", err}     }     defer resp.Body.Close()      return Response{url, resp.Status, nil} }  func main() {     \/\/ URL \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f     urls := []string{         \"https:\/\/www.google.com\",         \"https:\/\/www.github.com\",     }     startTime := time.Now()      for i := 0; i &lt; len(urls); i++ {         resp := fetchURLSynchro(urls[i])         if resp.err != nil {             fmt.Printf(\"Error fetching %s: %v\\n\", resp.url, resp.err)         } else {             fmt.Printf(\"Successfully fetched %s: %s\\n\", resp.url, resp.status)         }     }     elapsed := time.Since(startTime)     fmt.Printf(\"\\nTotal time taken: %s\\n\", elapsed) }<\/code><\/pre>\n<p> \u042d\u0442\u0438 \u0434\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0432\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b (\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435), \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430. \u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u044d\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435: \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0442\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b \u0438 \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u0442\u044c. \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438. \u041c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0434\u0432\u0443\u043c URL \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 250 \u043c\u0441, \u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f 400 \u043c\u0441.<\/p>\n<p> \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d, \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u041f\u041e. \u0427\u0430\u0441\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432, \u0447\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u041f\u041e. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u041f\u041e, \u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0443.<\/p>\n<p> \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432). \u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0441\u043e\u0431\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0441\u0435\u0442\u0438. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043c\u0435\u0441\u0442\u043d\u043e. \u041f\u0440\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u043d\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0437\u0430\u0434\u0430\u0447, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438.<\/p>\n<p> \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435. \u041c\u044b \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0434\u0432\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 (100 \u0442\u044b\u0441\u044f\u0447 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432), \u0430 \u043f\u043e\u0442\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0441 \u043e\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439), \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0440\u0443\u0442\u0438\u043d. \u0427\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0440\u0430\u0432\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u044f\u0437\u044b\u043a\u043e\u043c Go \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 (<code>runtime.NumCPU()<\/code>).<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"runtime\"     \"testing\" )  \/\/ sequentialSum \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e func sequentialSum(numbers []int) int {     sum := 0     for _, n := range numbers {         sum += n     }     return sum }  \/\/ goroutineSumWithChannels \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0438 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 func goroutineSumWithChannels(numbers []int) int {     numGoroutines := runtime.NumCPU() \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440 CPU     chunkSize := (len(numbers) + numGoroutines - 1) \/ numGoroutines     resultChan := make(chan int, numGoroutines) \/\/ \u0411\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c     activeGoroutines := 0     \/\/ \u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d     for i := 0; i &lt; numGoroutines; i++ {         start := i * chunkSize         end := start + chunkSize         if end &gt; len(numbers) {             end = len(numbers)         }         if start &gt;= end {             break         }          go func(slice []int) {             partialSum := 0             for _, n := range slice {                 partialSum += n             }             resultChan &lt;- partialSum         }(numbers[start:end])         activeGoroutines++     }      \/\/ \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u0443\u043c\u043c\u044b \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430     total := 0     for i := 0; i &lt; activeGoroutines; i++ {         total += &lt;-resultChan     }     close(resultChan)      return total }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432 func BenchmarkSequentialSum(b *testing.B) {     numbers := make([]int, 100000)     for i := range numbers {         numbers[i] = i     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         sequentialSum(numbers)     } }  func BenchmarkGoroutineSumWithChannels(b *testing.B) {     numbers := make([]int, 100000)     for i := range numbers {         numbers[i] = i     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         goroutineSumWithChannels(numbers)     } }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432 func BenchmarkSequentialSumLarge(b *testing.B) {     numbers := make([]int, 10000000)     for i := range numbers {         numbers[i] = i     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         sequentialSum(numbers)     } }  func BenchmarkGoroutineSumWithChannelsLarge(b *testing.B) {     numbers := make([]int, 10000000)     for i := range numbers {         numbers[i] = i     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         goroutineSumWithChannels(numbers)     } }  func main() {     fmt.Printf(\"Number of CPU cores: %d\\n\", runtime.NumCPU())      res := testing.Benchmark(BenchmarkGoroutineSumWithChannels)     fmt.Println(\"BenchmarkGoroutineSumWithChannels\", res)     ress := testing.Benchmark(BenchmarkSequentialSum)     fmt.Println(\"BenchmarkSequentialSum\", ress)      resl := testing.Benchmark(BenchmarkGoroutineSumWithChannelsLarge)     fmt.Println(\"BenchmarkGoroutineSumWithChannelsLarge\", resl)     ressl := testing.Benchmark(BenchmarkSequentialSumLarge)     fmt.Println(\"BenchmarkSequentialSumLarge\", ressl) }<\/code><\/pre>\n<p> \u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"plaintext\">\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440 CPU: 128 BenchmarkGoroutineSumWithChannels     4048      258798 \u043d\u0441\/\u043e\u043f. BenchmarkSequentialSum    23756      50516 \u043d\u0441\/\u043e\u043f. BenchmarkGoroutineSumWithChannelsLarge      744    1414114 \u043d\u0441\/\u043e\u043f. BenchmarkSequentialSumLarge      237       5030224 \u043d\u0441\/\u043e\u043f.<\/code><\/pre>\n<p> \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441 128 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043f\u044f\u0442\u044c \u0440\u0430\u0437 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0415\u0441\u043b\u0438 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 128 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432, \u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432 <code>128 * 5 = 640<\/code> \u0440\u0430\u0437 \u043c\u0435\u043d\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c! \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0430\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u044b\u0441\u044f\u0447 integer, \u0442\u043e \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b.<\/p>\n<p> \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c 10 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 integer, \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435: \u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 3,6 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e: \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0442\u0440\u0430\u0442\u0438\u0442 \u0432 3,6 \u0440\u0430\u0437 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0435\u043c \u043e\u0434\u043d\u0430 \u0441\u043e\u0442\u043d\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d.<\/p>\n<p> \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u043c\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0410 \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0438\u043d\u0443\u0441 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d (1, 2, \u2026). \u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043e\u0434\u0438\u043d \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"math\"     \"runtime\"     \"testing\" )  func computeSineSum(numbers []int) float64 {     sum := 0.0     for _, n := range numbers {         sum += math.Sin(float64(n))     }     return sum }  \/\/ computeSineSumWithGoroutines \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d func computeSineSumWithGoroutines(numbers []int, numGoroutines int) float64 {     chunkSize := (len(numbers) + numGoroutines - 1) \/ numGoroutines     resultChan := make(chan float64, numGoroutines)      for i := 0; i &lt; numGoroutines; i++ {         start := i * chunkSize         end := start + chunkSize         if end &gt; len(numbers) {             end = len(numbers)         }         if start &gt;= end {             break         }          go func(slice []int) {             partialSum := 0.0             for _, n := range slice {                 partialSum += math.Sin(float64(n))             }             resultChan &lt;- partialSum         }(numbers[start:end])     }      \/\/ \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b     total := 0.0     activeGoroutines := (len(numbers) + chunkSize - 1) \/ chunkSize     for i := 0; i &lt; activeGoroutines; i++ {         total += &lt;-resultChan     }     close(resultChan)     return total }  \/\/ \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 func BenchmarkSequential(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000 \/\/ \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430 \u043f\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSum(numbers)     } }  func Benchmark1Goroutines(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSumWithGoroutines(numbers, 1)     } }  func Benchmark2Goroutines(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSumWithGoroutines(numbers, 2)     } }  func Benchmark4Goroutines(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSumWithGoroutines(numbers, 4)     } }  func Benchmark8Goroutines(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSumWithGoroutines(numbers, 8)     } }  func Benchmark16Goroutines(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSumWithGoroutines(numbers, 16)     } }  func BenchmarkMaxGoroutines(b *testing.B) {     numbers := make([]int, 1000000)     for i := range numbers {         numbers[i] = i % 1000     }      b.ResetTimer()     for i := 0; i &lt; b.N; i++ {         computeSineSumWithGoroutines(numbers, runtime.NumCPU())     } }  func main() {      fmt.Printf(\"CPU cores: %d\\n\", runtime.NumCPU())     res1 := testing.Benchmark(BenchmarkSequential)     fmt.Println(\"BenchmarkSequential\", res1)     res11 := testing.Benchmark(Benchmark1Goroutines)     fmt.Println(\"Benchmark1Goroutines\", res11)     res2 := testing.Benchmark(Benchmark2Goroutines)     fmt.Println(\"Benchmark2Goroutines\", res2)     res4 := testing.Benchmark(Benchmark4Goroutines)     fmt.Println(\"Benchmark4Goroutines\", res4)     res8 := testing.Benchmark(Benchmark8Goroutines)     fmt.Println(\"Benchmark8Goroutines\", res8)     res16 := testing.Benchmark(Benchmark16Goroutines)     fmt.Println(\"Benchmark16Goroutines\", res16)     resmax := testing.Benchmark(BenchmarkMaxGoroutines)     fmt.Println(\"BenchmarkMaxGoroutines\", resmax) }<\/code><\/pre>\n<p> \u041d\u0430 \u043c\u043e\u0449\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u044f\u0434\u0435\u0440 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<pre><code class=\"plaintext\">\u042f\u0434\u0440\u0430 CPU cores: 128 Benchmark1Goroutines      114     13701908 \u043d\u0441\/\u043e\u043f. Benchmark2Goroutines      134      8913817 \u043d\u0441\/\u043e\u043f. Benchmark4Goroutines      253      4648170 \u043d\u0441\/\u043e\u043f. Benchmark8Goroutines      472      2272842 \u043d\u0441\/\u043e\u043f. Benchmark16Goroutines      835     1227975 \u043d\u0441\/\u043e\u043f. BenchmarkMaxGoroutines      916    1189217 \u043d\u0441\/\u043e\u043f.<\/code><\/pre>\n<p> \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043d\u0430 \u0434\u0432\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 1,5 \u0440\u0430\u0437\u0430. \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043d\u0430 16 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 11 \u0440\u0430\u0437. \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c 16 \u043d\u0435 \u0434\u0430\u0451\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430. \u0422\u0430\u043a\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0441\u0443\u0431\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430 \u0441 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0438\u043f\u0438\u0447\u0435\u043d.<\/p>\n<p> \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0438 \u043a\u0430\u043d\u0430\u043b\u044b \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043a\u0430\u043d\u0430\u043b\u043e\u0432. \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0435\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u043d\u0430\u043b. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u043d\u0430\u043b, \u043e\u043d\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u043d\u0430\u043b. \u041c\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0441\u043e\u0442\u043d\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"time\" )  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f relay \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 func relay(input &lt;-chan int, output chan&lt;- int) {     \/\/ \u041e\u0436\u0438\u0434\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430     value := &lt;-input     \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u043d\u0430\u043b     output &lt;- value }  func main() {     \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435     const chainLength = 10000      \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0440\u0435\u0437 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432     channels := make([]chan int, chainLength+1)      \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043a\u0430\u043d\u0430\u043b\u044b     for i := range channels {         channels[i] = make(chan int)     }      \/\/ \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043e\u0442\u0441\u0447\u0451\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438     startTime := time.Now()      \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0433\u043e\u0440\u0443\u0442\u0438\u043d     for i := 0; i &lt; chainLength; i++ {         go relay(channels[i], channels[i+1])     }      \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u0430\u043d\u0430\u043b\u0430     go func() {         channels[0] &lt;- 42     }()      \/\/ \u0416\u0434\u0451\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430     result := &lt;-channels[chainLength]      \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f     elapsed := time.Since(startTime)      \/\/ \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b     fmt.Printf(\"Value %d successfully passed through %d goroutines\\n\", result, chainLength)     fmt.Printf(\"Time taken: %v\\n\", elapsed)     fmt.Printf(\"Average time per hop: %v\\n\", elapsed\/time.Duration(chainLength)) }<\/code><\/pre>\n<p> \u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"plaintext\">\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 42 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u0447\u0435\u0440\u0435\u0437 10000 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u041f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438: 13,987416 \u043c\u0441 \u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434: 1,398 \u043c\u043a\u0441<\/code><\/pre>\n<p> \u041f\u043e \u0441\u0443\u0442\u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0413\u0440\u0443\u043f\u043f\u044b \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f<\/font><\/h2>\n<p> \u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>sync.WaitGroup<\/code>. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <code>defer<\/code>. \u0412 Go \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>defer<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0430\u044f \u0435\u0451 \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <code>defer<\/code>). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043d\u0438\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0432\u0435\u0434\u0435\u0442 Canada, \u0430 \u0437\u0430\u0442\u0435\u043c Mexico:<\/p>\n<pre><code class=\"go\">func() {         defer fmt.Println(\"Mexico\")         fmt.Println(\"Canada\")     }<\/code><\/pre>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0443, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u0438 (defer) \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"sync\" )  func main() {     var wg sync.WaitGroup     wg.Add(1) \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 WaitGroup \u043d\u0430 1      go func() {         defer wg.Done() \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435         fmt.Println(\"Canada\")     }()      wg.Wait() \/\/ \u0416\u0434\u0451\u043c, \u043f\u043e\u043a\u0430 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u0442 \u043d\u0443\u043b\u044f }<\/code><\/pre>\n<p> \u0414\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u043a\u0430\u043a \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0449\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u043a \u0438 \u0432 \u043d\u0451\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 import. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u043c\u043d\u043e\u0433\u043e, \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0410\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/font><\/h2>\n<p> \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d, \u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0415\u0441\u043b\u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442.<\/p>\n<p> \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0430\u043c \u0447\u0430\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0445 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d. \u0418\u043d\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b\u044b, \u043d\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p> \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440: \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u0438 integer, \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u0430 1000 \u0438 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0439 1000 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0431\u0430\u0433\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"math\/rand\"     \"sync\"     \"time\" )  func main() {      \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 10 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 100     arr := [10]int{100, 100, 100, 100, 100, 100, 100, 100, 100, 100}     var wg sync.WaitGroup      \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d     worker := func() {         defer wg.Done()         wg.Add(1)         r := rand.New(rand.NewSource(time.Now().UnixNano()))          \/\/ \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c 200000000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439         for i := 0; i &lt; 200000000; i++ {             \/\/ \u0411\u0435\u0440\u0451\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441             idx1 := r.Intn(10)             \/\/ \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &gt; 0             if arr[idx1] &gt; 0 {                 \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430                 arr[idx1]--                  \/\/ \u0411\u0435\u0440\u0451\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441                 idx2 := r.Intn(10)                 \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430                 arr[idx2]++              }         }     }      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0434\u0432\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b     go worker()     go worker()     fmt.Println(\"waiting...\")     wg.Wait()     fmt.Println(\"waiting...ok\")      fmt.Println(\"\\nFinal array state:\", arr)     \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u0449\u0430\u044f \u0441\u0443\u043c\u043c\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0440\u0430\u0432\u043d\u0430 1000 (10 * 100)     sum := 0     for _, val := range arr {         sum += val     }     fmt.Println(\"Total sum:\", sum) }<\/code><\/pre>\n<p> \u0412 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430: \u043e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u043e\u043d\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438 \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0431\u0435\u0437 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"plaintext\">Final array state: [3001 644 880 324 2319 2845 3664 160 232 1741] Total sum: 15810<\/code><\/pre>\n<p> \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439.<\/p>\n<p> \u0412 Go \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u0430\u0433\u0430 \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0435\u0439 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u043f\u0430\u043a\u0435\u0442\u043e\u043c <code>sync\/atomic<\/code>: \u043e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0434\u0435\u043b\u0438\u043c\u044b\u043c\u0438 \u0448\u0430\u0433\u0430\u043c\u0438, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0433\u043e\u043d\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>atomic.AddInt32(&amp;x, 1)<\/code> \u0438 <code>atomic.AddInt64(&amp;x, 1)<\/code> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430 (\u0447\u0442\u0435\u043d\u0438\u0435-\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435-\u0437\u0430\u043f\u0438\u0441\u044c) \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u0430 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f.<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"math\/rand\"     \"sync\"     \"sync\/atomic\"     \"time\" )  func main() {      \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 10 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 100     arr := [10]int32{100, 100, 100, 100, 100, 100, 100, 100, 100, 100}     var wg sync.WaitGroup      \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u0443\u0442\u0438\u043d     worker := func() {         defer wg.Done()         wg.Add(1)         r := rand.New(rand.NewSource(time.Now().UnixNano()))          \/\/ \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c 200000000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439         for i := 0; i &lt; 200000000; i++ {             \/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441             idx1 := r.Intn(10)             \/\/ \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &gt; 0             val := atomic.LoadInt32(&amp;arr[idx1])             if val &gt; 0 {                 if atomic.CompareAndSwapInt32(&amp;arr[idx1], val, val-1) {                     \/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441                     idx2 := r.Intn(10)                     \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430                     atomic.AddInt32(&amp;arr[idx2], 1)                 }              }         }     }      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0434\u0432\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b     go worker()     go worker()     fmt.Println(\"waiting...\")     wg.Wait()     fmt.Println(\"waiting...ok\")      fmt.Println(\"\\nFinal array state:\", arr)     \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u0449\u0430\u044f \u0441\u0443\u043c\u043c\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0440\u0430\u0432\u043d\u0430 1000 (10 * 100)     sum := 0     for _, val := range arr {         sum += int(val)     }     fmt.Println(\"Total sum:\", sum) }<\/code><\/pre>\n<p> \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>atomic.LoadInt32(&amp;arr[idx1])<\/code> \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>idx1<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 (<code>val<\/code>): \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0433\u043e\u043d\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e Compare-And-Swap (CAS): <code>atomic.CompareAndSwapInt32(&amp;arr[idx1], val, val-1)<\/code>. \u041e\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043b\u0438 <code>arr[idx1]<\/code> \u0440\u0430\u0432\u043d\u043e <code>val<\/code> (\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e) \u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 <code>arr[idx1]<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>val-1<\/code>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0438 false, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c. \u0412\u0430\u0436\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u0430\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>atomic.AddInt32(&amp;arr[idx2], 1)<\/code> \u0434\u043b\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f 1 \u043a <code>arr[idx2]<\/code>.<\/p>\n<p> \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u044d\u0442\u043e\u0439 \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u0443\u043c\u043c\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041c\u044c\u044e\u0442\u0435\u043a\u0441<\/font><\/h2>\n<p> \u0410\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>atomic.AddInt32<\/code> \u0438\u043b\u0438 <code>atomic.CompareAndSwapInt32<\/code>) \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u044b\u0445 \u043d\u0435\u0434\u0435\u043b\u0438\u043c\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0445 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p> \u0412 \u0442\u0430\u043a\u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u044c\u044e\u0442\u0435\u043a\u0441. \u041c\u044c\u044e\u0442\u0435\u043a\u0441 (mutex, \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u043e \u043e\u0442 \u00abmutual exclusion\u00bb, \u0442\u043e \u0435\u0441\u0442\u044c \u00ab\u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u00bb) \u2014 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e. \u041e\u043d \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043a \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a (\u0438\u043b\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0433\u043e\u043d\u043a\u0438 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e \u0441\u0443\u0442\u0438, \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043c\u043e\u0436\u0435\u0442 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u00ab\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u00bb (lock).<\/p>\n<p> \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0434\u0435\u043d\u0435\u0433 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u0447\u0435\u0442\u0430\u043c\u0438; \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u043d\u044f\u0442\u0438\u0435 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0447\u0451\u0442\u0430 \u0438 \u0434\u0435\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0431\u0435\u0437 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0443 \u043c\u043d\u043e\u0433\u043e\u044d\u0442\u0430\u043f\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043d\u0430 \u0447\u0442\u043e \u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"sync\"     \"time\" )  type Bank struct {     accounts map[string]int \/\/ Map ID \u0441\u0447\u0435\u0442\u043e\u0432 \u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u043e\u0432     mutex    sync.Mutex    \/\/ \u041c\u044c\u044e\u0442\u0435\u043a\u0441 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0432\u0441\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 }  func NewBank() *Bank {     return &amp;Bank{         accounts: map[string]int{             \"Alice\": 1000,             \"Bob\":   500,         },     } }  func (b *Bank) Transfer(from, to string, amount int, wg *sync.WaitGroup) {     defer wg.Done()      \/\/ \u0411\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u043c\u044c\u044e\u0442\u0435\u043a\u0441, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0432\u0441\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e     b.mutex.Lock()     defer b.mutex.Unlock() \/\/ \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u0430\u0436\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043f\u0430\u043d\u0438\u043a\u0438      \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u043d\u0430 \u0441\u0447\u0451\u0442\u0435-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435     if b.accounts[from] &gt;= amount {         \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e: \u0434\u0432\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438         b.accounts[from] -= amount         b.accounts[to] += amount         fmt.Printf(\"Transferred %d from %s to %s. New balances: %s=%d, %s=%d\\n\",             amount, from, to, from, b.accounts[from], to, b.accounts[to])     } else {         fmt.Printf(\"Failed transfer of %d from %s to %s: insufficient funds\\n\",             amount, from, to)     } }  func (b *Bank) GetBalance(account string) int {     b.mutex.Lock()     defer b.mutex.Unlock()     return b.accounts[account] }  func main() {     bank := NewBank()     var wg sync.WaitGroup      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439     wg.Add(4)     go bank.Transfer(\"Alice\", \"Bob\", 200, &amp;wg)     go bank.Transfer(\"Bob\", \"Alice\", 100, &amp;wg)     go bank.Transfer(\"Alice\", \"Bob\", 300, &amp;wg)     go bank.Transfer(\"Bob\", \"Alice\", 50, &amp;wg)      wg.Wait()      fmt.Printf(\"Final balances: Alice=%d, Bob=%d\\n\",         bank.GetBalance(\"Alice\"), bank.GetBalance(\"Bob\")) }<\/code><\/pre>\n<p> \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0432\u0435\u0440\u0445\u0435\u0434 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p> \u0412 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 (deadlock). \u0412\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u2014 \u044d\u0442\u043e \u0441\u0431\u043e\u0439 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u043b\u043e\u0432\u0443\u0448\u043a\u0443 \u0446\u0438\u043a\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043d\u0435 \u0438\u043c\u0435\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0437-\u0437\u0430 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e deadlock. \u0412\u043c\u0435\u0441\u0442\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0447\u0451\u0442\u0430. \u0415\u0441\u043b\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0441\u0447\u0451\u0442-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0447\u0451\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d deadlock.<\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"sync\"     \"time\" )  type Account struct {     balance int     mutex   sync.Mutex }  type Bank struct {     accounts map[string]*Account \/\/ Map ID \u0441\u0447\u0435\u0442\u043e\u0432 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0441\u0447\u0435\u0442\u043e\u0432 \u0441 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430\u043c\u0438 }  func NewBank() *Bank {     return &amp;Bank{         accounts: map[string]*Account{             \"Alice\": {balance: 1000},             \"Bob\":   {balance: 500},         },     } }  func (b *Bank) Transfer(from, to string, amount int, wg *sync.WaitGroup) {     defer wg.Done()      \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0447\u0435\u0442\u0430     fromAccount := b.accounts[from]     toAccount := b.accounts[to]      \/\/ \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u0441\u0447\u0451\u0442-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a     fromAccount.mutex.Lock()     fmt.Printf(\"Locked %s for transfer of %d to %s\\n\", from, amount, to)      \/\/ \u0421\u0438\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c deadlock (\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438)     time.Sleep(100 * time.Millisecond)      \/\/ \u0414\u0430\u043b\u0435\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0447\u0451\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f     toAccount.mutex.Lock()     fmt.Printf(\"Locked %s for transfer of %d from %s\\n\", to, amount, from)      \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e     if fromAccount.balance &gt;= amount {         fromAccount.balance -= amount         toAccount.balance += amount         fmt.Printf(\"Transferred %d from %s to %s. New balances: %s=%d, %s=%d\\n\",             amount, from, to, from, fromAccount.balance, to, toAccount.balance)     } else {         fmt.Printf(\"Failed transfer of %d from %s to %s: insufficient funds\\n\",             amount, from, to)     }      \/\/ \u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u0430 \u0441\u0447\u0451\u0442\u0430     toAccount.mutex.Unlock()     fromAccount.mutex.Unlock() }  func (b *Bank) GetBalance(account string) int {     acc := b.accounts[account]     acc.mutex.Lock()     defer acc.mutex.Unlock()     return acc.balance }  func main() {     bank := NewBank()     var wg sync.WaitGroup      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0434\u0432\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u043e\u0431\u043e\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c deadlock     wg.Add(2)     go bank.Transfer(\"Alice\", \"Bob\", 200, &amp;wg) \/\/ Alice -&gt; Bob     go bank.Transfer(\"Bob\", \"Alice\", 100, &amp;wg) \/\/ Bob -&gt; Alice      wg.Wait() \/\/ \u042d\u0442\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0438\u0437-\u0437\u0430 deadlock      fmt.Printf(\"Final balances: Alice=%d, Bob=%d\\n\",         bank.GetBalance(\"Alice\"), bank.GetBalance(\"Bob\")) }<\/code><\/pre>\n<p> \u0412\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0432\u0435 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b \u0432 \u0440\u0430\u0437\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043f\u0440\u0438\u0432\u043e\u0434\u044f \u043a \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044e. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a deadlock \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0441\u0447\u0435\u0442\u0430 \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u044b, \u0442\u043e \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u0441\u0447\u0451\u0442 \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p> \u041a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0433\u043e\u043d\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c, \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438. \u0413\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0438 \u043a\u0430\u043d\u0430\u043b\u044b Go \u2014 \u044d\u0442\u043e \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u0438 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u0430\u043a \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0437\u0431\u0435\u0433\u0430\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u0430, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u2014 \u0432 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438\u0437-\u0437\u0430 \u0438\u0437\u043b\u0438\u0448\u043d\u0435\u0433\u043e \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u0435, \u0430 \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e-\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0433\u043e\u0434\u044b, \u043e\u0442\u0434\u0430\u0447\u0430 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0447\u0442\u043e\u0436\u043d\u044b\u043c.<\/p>\n<p> \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>sync.WaitGroup<\/code>, \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u0437 <code>sync\/atomic<\/code> \u0438 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u043e\u0432 (<code>sync.Mutex<\/code>) \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u0441\u0431\u043e\u0435\u0432 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438. \u0410\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u043e\u043c, \u0430 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e\u044d\u0442\u0430\u043f\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430\u043c\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441\u0432\u043e\u0438 \u0440\u0438\u0441\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u0438\u0437-\u0437\u0430 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0435 \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u044b\u0431\u043e\u0440 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u0440\u0438\u0440\u043e\u0434\u044b \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430 \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Go \u043d\u0443\u0436\u0435\u043d \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<blockquote><p><b><font color=\"#3AC1EF\"><a href=\"https:\/\/t.me\/ruvds_community\">Telegram-\u043a\u0430\u043d\u0430\u043b \u0441\u043e \u0441\u043a\u0438\u0434\u043a\u0430\u043c\u0438, \u0440\u043e\u0437\u044b\u0433\u0440\u044b\u0448\u0430\u043c\u0438 \u043f\u0440\u0438\u0437\u043e\u0432 \u0438 \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438 IT \ud83d\udcbb<\/a><\/font><\/b><\/p><\/blockquote>\n<p><a href=\"https:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=perevod&amp;utm_content=parallelnoe_programmirovanie_na_go\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yo\/se\/km\/yosekm4h_f7y7oia-ghbbpc0phi.png\" data-src=\"https:\/\/habrastorage.org\/webt\/yo\/se\/km\/yosekm4h_f7y7oia-ghbbpc0phi.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/896102\/\"> https:\/\/habr.com\/ru\/articles\/896102\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/896102\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/8b\/l5\/5e\/8bl55e5uri2kceqzd7cm6cuuu_g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/8b\/l5\/5e\/8bl55e5uri2kceqzd7cm6cuuu_g.jpeg\" data-blurred=\"true\"\/><\/div>\n<p><\/a><br \/> \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u043d\u0430\u043c\u0438 \u041f\u041e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0448\u0438 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f, \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0435\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438? \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e. \u041c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u043d\u0435\u0441\u0451\u043d\u043d\u043e\u0435 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442 \u0432\u043d\u0435\u0441\u0451\u043d\u043d\u043e\u0435 \u0434\u0440\u0443\u0433\u0438\u043c. \u0421\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435: \u043c\u043e\u0436\u0435\u0442 \u00ab\u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c\u00bb \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u0418\u043b\u0438 \u043e\u0431\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u043c\u0443. \u041c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u00ab\u0433\u043e\u043d\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb \u2014 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u0432\u0430 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0435\u0437 \u0434\u043e\u043b\u0436\u043d\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p> \u0412\u0441\u0451 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u0438 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432. \u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u044d\u0442\u043e\u0439 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432.<\/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-454308","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454308","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=454308"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454308\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}