{"id":435964,"date":"2024-10-18T21:00:27","date_gmt":"2024-10-18T21:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=435964"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=435964","title":{"rendered":"<span>Rust IPC Ping-Pong<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0430\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430\u0441\u044c \u0441\u00a0\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0432\u00a0\u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c IPC \u0432\u00a0Rust. \u041f\u043e\u0438\u0441\u043a \u043f\u0440\u0438\u0432\u0435\u043b \u043d\u0430\u0441 \u043a\u00a0\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0442 3tilley \u00ab<a href=\"https:\/\/3tilley.github.io\/posts\/simple-ipc-ping-pong\/\"><u>IPC in Rust\u00a0\u2014 a Ping Pong Comparison<\/u><\/a>\u00bb, \u0447\u0442\u043e\u00a0\u0441\u0442\u0430\u043b\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u00a0\u043d\u0430\u0448\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0412\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u044f\u0441\u044c \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043a\u043e\u043f\u043d\u0443\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u00a0\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043d\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0438\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a iceoryx2. \u0412\u0437\u044f\u0432 \u0437\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u00a0\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c UNIX Domain Sockets (\u043a\u0430\u043a stream, \u0442\u0430\u043a \u0438 datagram), Memory Mapped Files \u0438 Shared Memory \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c<a href=\"https:\/\/crates.io\/crates\/iceoryx2\"><u>iceoryx2<\/u><\/a> \u0434\u043b\u044f\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 IPC \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430.<\/p>\n<h2>\u0421\u0435\u0442\u0430\u043f  <\/h2>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 \u00ab\u0437\u0430\u043f\u0440\u043e\u0441\u2011\u043e\u0442\u0432\u0435\u0442\u00bb \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438, \u043e\u0431\u0449\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e IPC. \u0412\u0441\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441\u0445\u043e\u0436\u0438 \u0441\u00a0\u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u00a0\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435: 1. \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c x KB 2. \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e\u00a0\u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 x KB 3. \u041c\u044b \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c \u0432\u0440\u0435\u043c\u044f, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u00a0\u043e\u0431\u043c\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438<\/p>\n<p>\u0414\u043b\u044f\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0442\u00a0\u0436\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442<a href=\"https:\/\/github.com\/nvzqz\/divan\"> <u>Divan<\/u><\/a>.<\/p>\n<h3>\u0416\u0435\u043b\u0435\u0437\u043e \u0438 \u041e\u0421  <\/h3>\n<ul>\n<li>\n<p><strong>Env<\/strong>: Linux Cloud VM<\/p>\n<\/li>\n<li>\n<p><strong>Arch<\/strong>: x86_64<\/p>\n<\/li>\n<li>\n<p><strong>CPU<\/strong>: 32 cores<\/p>\n<\/li>\n<li>\n<p><strong>Model Name<\/strong>: AMD EPYC 7B13<\/p>\n<\/li>\n<li>\n<p><strong>L1d cache<\/strong>: 512 KiB<\/p>\n<\/li>\n<li>\n<p><strong>L1i cache<\/strong>: 512 KiB<\/p>\n<\/li>\n<li>\n<p><strong>L2 cache<\/strong>: 8 MiB<\/p>\n<\/li>\n<li>\n<p><strong>L3 cache<\/strong>: 64 MiB<\/p>\n<\/li>\n<li>\n<p><strong>Memory<\/strong>: 128GB<\/p>\n<\/li>\n<li>\n<p><strong>OS<\/strong>: Ubuntu 20.04.1<\/p>\n<\/li>\n<li>\n<p><strong>Kernel<\/strong>: 5.15.0<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f  <\/h3>\n<ol>\n<li>\n<p>CPU Affinity: \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043a\u00a0\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u044f\u0434\u0440\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u044f\u0434\u0440\u0430\u043c\u0438, \u0438\u0437\u2011\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u00a0\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0414\u043b\u044f\u00a0\u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<a href=\"https:\/\/crates.io\/crates\/core_affinity\/0.6.1\"> <u>core_affinity<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>CPU Warmup: \u0427\u0442\u043e\u0431\u044b \u0443\u0447\u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0435\u0440\u0438\u043e\u0434 \u00ab\u043f\u0440\u043e\u0433\u0440\u0435\u0432\u0430\u00bb \u0432 1\u00a0\u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043c\u0435\u0440\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0438 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 IPC.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"rust\">pub fn cpu_warmup() {     let warmup = std::time::Instant::now();     loop {         if warmup.elapsed() &gt; std::time::Duration::from_millis(1000) {             break;         }     } }<\/code><\/pre>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430  <\/h2>\n<p>\u0412\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0438\u0437\u00a0\u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u0445 \u0431\u0443\u043a\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438 \u0446\u0438\u0444\u0440.<\/p>\n<pre><code class=\"rust\">pub fn generate_random_data(data_size: usize, seed: u64) -&gt; Vec&lt;u8&gt; {     const CHARSET: &amp;[u8] = b\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\\                             abcdefghijklmnopqrstuvwxyz\\                             0123456789\";     let mut rng = StdRng::seed_from_u64(seed);     (0..data_size)         .map(|_| {             let idx = rng.gen_range(0..CHARSET.len());             CHARSET[idx]         })         .collect() }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u043e, \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u043a\u00a0\u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0431\u0430\u0439\u0442 (<code>Vec&lt;u8&gt;<\/code>) \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. <code>seed<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u044d\u0439\u043b\u043e\u0430\u0434 \u0434\u043b\u044f\u00a0\u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e <code>data_size<\/code>, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. <\/p>\n<pre><code class=\"rust\">pub fn get_payload(data_size: usize) -&gt; (Vec&lt;u8&gt;, Vec&lt;u8&gt;) {     let request_data = generate_random_data(data_size, 1);     let response_data = generate_random_data(data_size, 2);     (request_data, response_data) }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>get_payload<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430. <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 1 &#8212; UNIX Domain Stream Socket<\/h2>\n<p>UNIX Domain Sockets(UDS) \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u043b\u044f\u00a0\u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u0439 UNIX\u2011\u043c\u0430\u0448\u0438\u043d\u0435 \u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0IP\u2011\u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438. \u041e\u043d\u0438 \u0437\u0430\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0431\u043e\u043b\u0435\u0435 \u043b\u0435\u0433\u043a\u0438\u0435 \u0438\u00a0\u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0440\u044f\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 \u0434\u043b\u044f\u00a0\u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f UNIX Domain Stream Socket:<\/p>\n<pre><code class=\"rust\">... \/\/ Producer const UNIX_SOCKET_PATH: &amp;str = \"\/tmp\/unix_stream.sock\";  impl UnixStreamRunner {     pub fn new(start_child: bool, data_size: usize) -&gt; Self {         let unix_listener = UnixListener::bind(UNIX_SOCKET_PATH).unwrap();         let exe = crate::executable_path(\"unix_stream_consumer\");         let child_proc = if start_child {             Some(Command::new(exe).args(&amp;[data_size.to_string()]).spawn().unwrap())         } else {             None         };          let wrapper = UnixStreamWrapper::from_listener(unix_listener);         let (request_data, response_data) = get_payload(data_size);          Self { child_proc, wrapper, data_size, request_data, response_data }     }      pub fn run(&amp;mut self, n: usize) {         let mut buf = vec![0; self.data_size];         for _ in 0..n {             self.wrapper.stream.write(&amp;self.request_data).unwrap();             self.wrapper.stream.read_exact(&amp;mut buf).unwrap();         }     } } ...  \/\/ Cosumer fn main() {     let args: Vec&lt;String&gt; = std::env::args().collect();     let data_size = usize::from_str(&amp;args[1]).unwrap();      core_affinity::set_for_current(core_affinity::CoreId { id: 0 });      let mut wrapper = ipc::unix_stream::UnixStreamWrapper::unix_connect();     let (request_data, response_data) = get_payload(data_size);     cpu_warmup();      let mut buf = vec![0; data_size];     while let Ok(_) = wrapper.stream.read_exact(&amp;mut buf) {         wrapper.stream.write(&amp;response_data).unwrap();     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f\u00a0\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u0442\u044c \u0432\u00a0\u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u043e\u043a\u0435\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u00a0\u0441\u043e\u043a\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>request_data<\/code>, \u0430\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u00a0\u0431\u0443\u0444\u0435\u0440, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>response_message<\/code>. <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 2 &#8212; Unix Datagram Socket<\/h2>\n<p>\u0412\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 UNIX domain datagram socket \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441\u00a0\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0432\u00a0\u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435:<\/p>\n<ol>\n<li>\n<p>\u00abAddress already in use\u00bb: \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0443\u0442\u044c \u0441\u043e\u043a\u0435\u0442\u0430 <code>\/tmp\/unix_datagram.sock<\/code> \u0434\u043b\u044f\u00a0\u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u043c \u0441\u043e\u043a\u0435\u0442\u0430\u043c. \u041c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043e\u0431\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043a\u00a0\u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u0447\u0442\u043e\u00a0\u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a\u00a0\u043e\u0448\u0438\u0431\u043a\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u00abAddress already in use\u00bb. \u041f\u043e\u0442\u043e\u043c \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e\u00a0\u0432\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u0434\u0430\u0442\u0430\u0433\u0440\u0430\u043c\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043b\u044f\u00a0\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u043e\u043a\u0435\u0442\u044b \u0434\u0440\u0443\u0433 \u0441\u00a0\u0434\u0440\u0443\u0433\u043e\u043c \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>connect()<\/code>, \u0447\u0442\u043e\u00a0\u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442 \u0430\u0434\u0440\u0435\u0441 \u043f\u0438\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u00abMessage too big\u00bb: \u0414\u0430\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437\u2011\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430\u00a0\u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u0442\u0430\u0433\u0440\u0430\u043c\u043c\u044b UDP. \u0414\u043b\u044f\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u00abNo buffer space available\u00bb: \u0412\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438, \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043d\u0430<a href=\"https:\/\/stackoverflow.com\/questions\/65261295\/udp-datagram-sockets-what-are-the-possible-causes-of-failure-of-send-for-no\"> <u>stackoverflow<\/u><\/a>, \u0447\u0442\u043e\u00a0\u0434\u0430\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u044f\u0434\u0440\u043e \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0434\u00a0\u0431\u0443\u0444\u0435\u0440 \u0441\u043e\u043a\u0435\u0442\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0439\u2011\u043b\u0438\u0431\u043e \u0438\u0437\u00a0\u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0443\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438. \u041c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u00a0\u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u0434\u043e\u0431\u044c\u0435\u043c\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u0435\u0440\u044f \u0434\u0430\u043d\u043d\u044b\u0445: \u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0441\u044f\u00a0\u0431\u044b \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u043d\u0430\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u0435 UDP, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044c \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u0438\u00a0\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 IPC \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438, \u043c\u044b \u043f\u043e\u043a\u0430 \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0414\u043b\u044f\u00a0\u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043f\u0430\u043d\u0438\u043a \u0432\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0442\u0435\u0440\u0438 \u0438\u043b\u0438\u00a0\u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0447\u0430\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u0430 \u0438\u043b\u0438\u00a0\u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442 \u0432\u00a0\u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0438\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"rust\">... \/\/ Producer const MAX_CHUNK_SIZE: usize = 64 * KB; const UNIX_DATAGRAM_SOCKET_1: &amp;str = \"\/tmp\/unix_datagram1.sock\"; const UNIX_DATAGRAM_SOCKET_2: &amp;str = \"\/tmp\/unix_datagram2.sock\";  impl UnixDatagramWrapper {     pub fn new(is_child: bool, data_size: usize) -&gt; Self {         let (socket_path, peer_socket_path) = if is_child {             (UNIX_DATAGRAM_SOCKET_1, UNIX_DATAGRAM_SOCKET_2)         } else {             (UNIX_DATAGRAM_SOCKET_2, UNIX_DATAGRAM_SOCKET_1)         };         let socket = UnixDatagram::bind(socket_path).unwrap();         Self { socket, peer_socket_path, data_size, }     }      pub fn connect_to_peer(&amp;self) {         self.socket.connect(&amp;self.peer_socket_path).unwrap();     }      pub fn send(&amp;self, data: &amp;Vec&lt;u8&gt;) {         \/\/ Send data in chunks         for chunk in data.chunks(MAX_CHUNK_SIZE) {             \/\/ Retry until we have a successful write             loop {                 match self.socket.send(chunk) {                     Ok(_) =&gt; break,                     Err(_) =&gt; continue,                 }             }         }     }      pub fn recv(&amp;self) -&gt; Vec&lt;u8&gt; {         let mut received_data = Vec::new();         \/\/ Read till we receive all chunks         loop {             let mut buf = vec![0; MAX_CHUNK_SIZE];             let size = self.socket.recv(&amp;mut buf).unwrap();             received_data.extend_from_slice(&amp;buf[..size]);             if received_data.len() == self.data_size {                 break;             }         }         received_data     } }  impl UnixDatagramRunner {     pub fn new(start_child: bool, data_size: usize) -&gt; Self {         let is_child = false;         let wrapper = UnixDatagramWrapper::new(is_child, data_size);         let (request_data, response_data) = get_payload(data_size);          let exe = crate::executable_path(\"unix_datagram_consumer\");         let child_proc = if start_child {             Some(Command::new(exe).args(&amp;[data_size.to_string()]).spawn().unwrap(),)         } else {             None         };         \/\/ Awkward sleep to make sure the child proc is ready         sleep(Duration::from_millis(500));         wrapper.connect_to_peer();          Self { child_proc, wrapper, request_data, response_data, }     }      pub fn run(&amp;mut self, n: usize, print: bool) {         let start = Instant::now();         for _ in 0..n {             self.wrapper.send(&amp;self.request_data);             let _response = self.wrapper.recv();         }     } } ...  \/\/ Consumer fn main() {     let args: Vec&lt;String&gt; = std::env::args().collect();     let data_size = usize::from_str(&amp;args[1]).unwrap();      core_affinity::set_for_current(core_affinity::CoreId { id: 0 });      let is_child = true;     let socket_wrapper = ipc::unix_datagram::UnixDatagramWrapper::new(is_child, data_size);     socket_wrapper.connect_to_peer();      let (request_data, response_data) = get_payload(data_size);      cpu_warmup();     loop {         let _request = socket_wrapper.recv();         socket_wrapper.send(&amp;response_data);     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u044b \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u043a\u0435\u0442\u044b \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>bind()<\/code> \u043a <code>socket_path<\/code> \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0438\u0445 \u043a\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c <code>peer_socket_path<\/code>. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c <code>request_data<\/code> \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u043a\u0438, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u00a0\u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438 \u043d\u0435\u00a0\u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>response_data<\/code>. <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 3 &#8212; Memory Mapped Files <\/h2>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u00a0\u043f\u0430\u043c\u044f\u0442\u044c \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0438\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044f \u0438\u0445 \u043d\u0430\u00a0\u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u00a0\u0430\u0434\u0440\u0435\u0441\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u0438\u043c \u0438\u0437\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>mmap()<\/code> \u0441\u00a0\u0444\u043b\u0430\u0433\u043e\u043c <code>MAP_SHARED<\/code>. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c<a href=\"https:\/\/crates.io\/crates\/raw_sync\/0.1.5\"> <u>raw_sync<\/u><\/a>, \u043a\u0430\u043a\u00a0\u0438 \u0432\u00a0\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. <\/p>\n<pre><code class=\"rust\">\/\/ Shared memory layout \/\/|    0    |    1    |    2    |    3    |    4    |    5    |    6    |    7    | \/\/|   producer lock   |   consumer lock   |      data buffer (ping or pong)       | pub struct MmapWrapper {     pub mmap: MmapMut,     pub owner: bool,     pub our_event: Box&lt;dyn EventImpl&gt;,     pub their_event: Box&lt;dyn EventImpl&gt;,     pub data_start: usize,     pub data_size: usize, }  impl MmapWrapper {     pub fn new(owner: bool) -&gt; Self {         let path: PathBuf = \"\/tmp\/mmap_data.txt\".into();         let file = OpenOptions::new()             .read(true)             .write(true)             .create(true)             .open(&amp;path)             .unwrap();         file.set_len(8).unwrap();          let mut mmap = unsafe { MmapMut::map_mut(&amp;file).unwrap() };         let bytes = mmap.as_mut();          \/\/ The two events are locks - one for each side. Each side activates the lock while it's         \/\/ writing, and then unlocks when the data can be read         let ((our_event, lock_bytes_ours), (their_event, lock_bytes_theirs)) = unsafe {             if owner {                 (                     BusyEvent::new(bytes.get_mut(0).unwrap(), true).unwrap(),                     BusyEvent::new(bytes.get_mut(2).unwrap(), true).unwrap(),                 )             } else {                 (                     \/\/ If we're not the owner, the events have been created already                     BusyEvent::from_existing(bytes.get_mut(2).unwrap()).unwrap(),                     BusyEvent::from_existing(bytes.get_mut(0).unwrap()).unwrap(),                 )             }         };          \/\/ Confirm that we've correctly indexed two bytes for each lock         assert!(lock_bytes_ours &lt;= 2);         assert!(lock_bytes_theirs &lt;= 2);         if owner {             our_event.set(EventState::Clear).unwrap();             their_event.set(EventState::Clear).unwrap();         }          Self {             mmap,             owner,             our_event,             their_event,             data_start: 4,             data_size,         }     }      pub fn signal_start(&amp;mut self) {         self.our_event.set(EventState::Clear).unwrap()     }      pub fn signal_finished(&amp;mut self) {         self.our_event.set(EventState::Signaled).unwrap()     }      pub fn write(&amp;mut self, data: &amp;[u8]) {         (&amp;mut self.mmap[self.data_start..]).write(data).unwrap();     }      pub fn read(&amp;self) -&gt; &amp;[u8] {         &amp;self.mmap.as_ref()[self.data_start..self.data_size]     } }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>MmapMut::map_mut()<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u00a0\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u0444\u0430\u0439\u043b\u0430. \u041f\u0435\u0440\u0432\u044b\u0435 4\u00a0\u0431\u0430\u0439\u0442\u0430 \u0432\u00a0\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e\u0434\u00a0\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438, \u0430\u00a0\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 4\u00a0\u2014 \u0434\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<pre><code class=\"rust\">pub fn run(&amp;mut self, n: usize, print: bool) {     for _ in 0..n {         \/\/ Activate our lock in preparation for writing         self.wrapper.signal_start();         self.wrapper.write(&amp;self.request_data);         \/\/ Unlock after writing         self.wrapper.signal_finished();         \/\/ Wait for their lock to be released so we can read         if self.wrapper.their_event.wait(Timeout::Infinite).is_ok() {             let str = self.wrapper.read();         }     } }<\/code><\/pre>\n<p>\u041c\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c, \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u0438 \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. <\/p>\n<h3>\u041f\u043e\u0434\u0445\u043e\u0434 4 &#8212; \u043e\u0431\u0449\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c iceoryx2<\/h3>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<a href=\"https:\/\/crates.io\/crates\/iceoryx2\"> <u>iceoryx2<\/u><\/a> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0431\u0435\u0437\u00a0\u043b\u043e\u043a\u043e\u0432 \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u00a0\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0435\u00a0\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u2011\u043e\u0442\u0432\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438\u2011\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f\u00a0\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0446\u0438\u043a\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u2011\u043e\u0442\u0432\u0435\u0442.<\/p>\n<p>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"rust\">... \/\/ Producer pub struct IceoryxWrapper {     pub publisher: Publisher&lt;ipc::Service, [u8], ()&gt;,     pub subscriber: Subscriber&lt;ipc::Service, [u8], ()&gt;, }  impl IceoryxWrapper {     pub fn new(is_producer: bool, data_size: usize) -&gt; IceoryxWrapper {         let node = NodeBuilder::new().create::&lt;ipc::Service&gt;().unwrap();         let request_name = ServiceName::new(&amp;format!(\"Request\")).unwrap();         let request_service = node             .service_builder(&amp;request_name)             .publish_subscribe::&lt;[u8]&gt;()             .open_or_create()             .unwrap();          let response_name = ServiceName::new(&amp;format!(\"Respose\")).unwrap();         let response_service = node             .service_builder(&amp;response_name)             .publish_subscribe::&lt;[u8]&gt;()             .open_or_create()             .unwrap();          let (publisher, subscriber) = if is_producer {             (                 request_service                     .publisher_builder()                     .max_slice_len(data_size)                     .create()                     .unwrap(),                 response_service.subscriber_builder().create().unwrap(),             )         } else {             (                 response_service                     .publisher_builder()                     .max_slice_len(data_size)                     .create()                     .unwrap(),                 request_service.subscriber_builder().create().unwrap(),             )         };          IceoryxWrapper {             publisher,             subscriber,         }     } }  impl IceoryxRunner {     pub fn run(&amp;mut self, n: usize, print: bool) {         for _ in 0..n {             let sample = self                 .wrapper                 .publisher                 .loan_slice_uninit(self.data_size)                 .unwrap();             let sample = sample.write_from_slice(self.request_data.as_slice());             sample.send().unwrap();              \/\/ Waiting for response             loop {                 if let Some(recv_payload) = self.wrapper.subscriber.receive().unwrap() {                     break;                 }             }         }     } } ...  \/\/ Consumer fn main() {     let args: Vec&lt;String&gt; = std::env::args().collect();     let data_size = usize::from_str(&amp;args[1]).unwrap();      core_affinity::set_for_current(core_affinity::CoreId { id: 0 });      let wrapper = ipc::iceoryx::IceoryxWrapper::new(false, data_size);     let (request_data, response_data) = get_payload(data_size);      cpu_warmup();     loop {         if let Some(recv_payload) = wrapper.subscriber.receive().unwrap() {             let sample = wrapper.publisher.loan_slice_uninit(data_size).unwrap();             let sample = sample.write_from_slice(response_data.as_slice());             sample.send().unwrap();         }     } }<\/code><\/pre>\n<p>\u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0434\u0432\u0430 publish-subscribe \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e. \u041f\u043e\u0441\u043b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <code>request_data<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 <code>response_data<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0438 \u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.  <\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b  <\/h2>\n<h3>\u0426\u0438\u043a\u043b Ping-Pong  <\/h3>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a40\/36a\/eee\/a4036aeee6a1dd0f0edca3f6bae1b5eb.png\" width=\"807\" height=\"403\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a40\/36a\/eee\/a4036aeee6a1dd0f0edca3f6bae1b5eb.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/679\/ad1\/18a\/679ad118adac9d03d49a329c944d50d8.png\" width=\"2959\" height=\"969\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/679\/ad1\/18a\/679ad118adac9d03d49a329c944d50d8.png\"\/><\/figure>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0446\u0438\u043a\u043b\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438-\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434\u044b \u043e\u0431\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p>iceoryx2 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u044b\u0433\u043e\u0434\u043d\u043e \u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 IPC, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043f\u0430\u0439\u043f\u044b, \u0441\u043e\u043a\u0435\u0442\u044b \u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043a\u0435\u0442\u044b Unix.<\/p>\n<\/li>\n<li>\n<p>\u0425\u043e\u0442\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043d\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f, \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043a\u0435\u0442\u044b Unix \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0435\u0431\u044f \u043b\u0443\u0447\u0448\u0435 IP-\u0441\u043e\u043a\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439  <\/h3>\n<h4>\u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e (\u0432 \u00b5s)  <\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/df4\/399\/c45\/df4399c457a8fdfa2405ebdecdc6e8f5.png\" width=\"913\" height=\"339\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df4\/399\/c45\/df4399c457a8fdfa2405ebdecdc6e8f5.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6ba\/175\/8e1\/6ba1758e1653661d0ff713457c6671d5.png\" width=\"1653\" height=\"884\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6ba\/175\/8e1\/6ba1758e1653661d0ff713457c6671d5.png\"\/><\/figure>\n<h4>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u0432 \u0442\u044b\u0441\u044f\u0447\u0430\u0445)  <\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0e9\/dfc\/f7a\/0e9dfcf7a508165f9593624c2e3ff510.png\" width=\"910\" height=\"337\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0e9\/dfc\/f7a\/0e9dfcf7a508165f9593624c2e3ff510.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3ae\/849\/adc\/3ae849adcd22bc6c5f9aa84a1bbdf3d4.png\" width=\"1653\" height=\"884\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ae\/849\/adc\/3ae849adcd22bc6c5f9aa84a1bbdf3d4.png\"\/><\/figure>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 \u044f\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 IPC.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 (\u043e\u0442 1 \u041a\u0411 \u0434\u043e 8 \u041a\u0411) \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0444\u0430\u0439\u043b\u044b \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. iceoryx2 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u043e 8 \u041a\u0411.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 iceoryx2 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438\/\u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 IPC \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0435 \u0441\u043e\u043a\u0435\u0442\u044b Unix \u0438\u043c\u0435\u044e\u0442 \u043b\u0443\u0447\u0448\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0435 64 \u041a\u0411 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0434\u0430\u0442\u0430\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0444\u0430\u0439\u043b\u044b, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>iceoryx2 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0443\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b IPC \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u0443\u044e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0443\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441 \u0441\u0438\u043b\u044c\u043d\u044b\u043c \u0435\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ol>\n<h2>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433\u0438  <\/h2>\n<p>iceoryx2 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438. \u0418 \u0445\u043e\u0442\u044f \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0443\u0447\u043d\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443 \u0431\u0430\u043b\u0430\u043d\u0441\u0443 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0434\u0435\u043b\u0430\u044f \u0435\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 IPC \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 Rust.<\/p>\n<p>\u041e\u0441\u043e\u0431\u0430\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c<a href=\"https:\/\/github.com\/elBoberido\"> <u>elBoberido<\/u><\/a> and<a href=\"https:\/\/www.abhirag.com\/\"> <u>Abhirag<\/u><\/a> \u0437\u0430 \u0440\u0435\u0432\u044c\u044e \u043f\u043e\u0441\u0442\u0430 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430<a href=\"https:\/\/github.com\/sattva9\/rust-ipc\"><u>Github<\/u><\/a> \u0438 \u043e\u0442\u043a\u0440\u044b\u0442 \u043a \u043a\u0440\u0438\u0442\u0438\u043a\u0435 \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c ?<\/p>\n<\/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\/851788\/\"> https:\/\/habr.com\/ru\/articles\/851788\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0430\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430\u0441\u044c \u0441\u00a0\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0432\u00a0\u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c IPC \u0432\u00a0Rust. \u041f\u043e\u0438\u0441\u043a \u043f\u0440\u0438\u0432\u0435\u043b \u043d\u0430\u0441 \u043a\u00a0\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0442 3tilley \u00ab<a href=\"https:\/\/3tilley.github.io\/posts\/simple-ipc-ping-pong\/\"><u>IPC in Rust\u00a0\u2014 a Ping Pong Comparison<\/u><\/a>\u00bb, \u0447\u0442\u043e\u00a0\u0441\u0442\u0430\u043b\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u00a0\u043d\u0430\u0448\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0412\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u044f\u0441\u044c \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043a\u043e\u043f\u043d\u0443\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u00a0\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043d\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0438\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a iceoryx2. \u0412\u0437\u044f\u0432 \u0437\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u00a0\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c UNIX Domain Sockets (\u043a\u0430\u043a stream, \u0442\u0430\u043a \u0438 datagram), Memory Mapped Files \u0438 Shared Memory \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c<a href=\"https:\/\/crates.io\/crates\/iceoryx2\"><u>iceoryx2<\/u><\/a> \u0434\u043b\u044f\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 IPC \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430.<\/p>\n<h2>\u0421\u0435\u0442\u0430\u043f  <\/h2>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 \u00ab\u0437\u0430\u043f\u0440\u043e\u0441\u2011\u043e\u0442\u0432\u0435\u0442\u00bb \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438, \u043e\u0431\u0449\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e IPC. \u0412\u0441\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441\u0445\u043e\u0436\u0438 \u0441\u00a0\u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u00a0\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435: 1. \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c x KB 2. \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e\u00a0\u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 x KB 3. \u041c\u044b \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c \u0432\u0440\u0435\u043c\u044f, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u00a0\u043e\u0431\u043c\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438<\/p>\n<p>\u0414\u043b\u044f\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0442\u00a0\u0436\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442<a href=\"https:\/\/github.com\/nvzqz\/divan\"> <u>Divan<\/u><\/a>.<\/p>\n<h3>\u0416\u0435\u043b\u0435\u0437\u043e \u0438 \u041e\u0421  <\/h3>\n<ul>\n<li>\n<p><strong>Env<\/strong>: Linux Cloud VM<\/p>\n<\/li>\n<li>\n<p><strong>Arch<\/strong>: x86_64<\/p>\n<\/li>\n<li>\n<p><strong>CPU<\/strong>: 32 cores<\/p>\n<\/li>\n<li>\n<p><strong>Model Name<\/strong>: AMD EPYC 7B13<\/p>\n<\/li>\n<li>\n<p><strong>L1d cache<\/strong>: 512 KiB<\/p>\n<\/li>\n<li>\n<p><strong>L1i cache<\/strong>: 512 KiB<\/p>\n<\/li>\n<li>\n<p><strong>L2 cache<\/strong>: 8 MiB<\/p>\n<\/li>\n<li>\n<p><strong>L3 cache<\/strong>: 64 MiB<\/p>\n<\/li>\n<li>\n<p><strong>Memory<\/strong>: 128GB<\/p>\n<\/li>\n<li>\n<p><strong>OS<\/strong>: Ubuntu 20.04.1<\/p>\n<\/li>\n<li>\n<p><strong>Kernel<\/strong>: 5.15.0<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f  <\/h3>\n<ol>\n<li>\n<p>CPU Affinity: \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043a\u00a0\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u044f\u0434\u0440\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u044f\u0434\u0440\u0430\u043c\u0438, \u0438\u0437\u2011\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u00a0\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0414\u043b\u044f\u00a0\u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<a href=\"https:\/\/crates.io\/crates\/core_affinity\/0.6.1\"> <u>core_affinity<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>CPU Warmup: \u0427\u0442\u043e\u0431\u044b \u0443\u0447\u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0435\u0440\u0438\u043e\u0434 \u00ab\u043f\u0440\u043e\u0433\u0440\u0435\u0432\u0430\u00bb \u0432 1\u00a0\u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043c\u0435\u0440\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0438 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 IPC.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"rust\">pub fn cpu_warmup() {     let warmup = std::time::Instant::now();     loop {         if warmup.elapsed() &gt; std::time::Duration::from_millis(1000) {             break;         }     } }<\/code><\/pre>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430  <\/h2>\n<p>\u0412\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u044d\u0439\u043b\u043e\u0430\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0438\u0437\u00a0\u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u0445 \u0431\u0443\u043a\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438 \u0446\u0438\u0444\u0440.<\/p>\n<pre><code class=\"rust\">pub fn generate_random_data(data_size: usize, seed: u64) -&gt; Vec&lt;u8&gt; {     const CHARSET: &amp;[u8] = b\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\\                             abcdefghijklmnopqrstuvwxyz\\                             0123456789\";     let mut rng = StdRng::seed_from_u64(seed);     (0..data_size)         .map(|_| {             let idx = rng.gen_range(0..CHARSET.len());             CHARSET[idx]         })         .collect() }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u043e, \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u043a\u00a0\u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0431\u0430\u0439\u0442 (<code>Vec&lt;u8&gt;<\/code>) \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. <code>seed<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u044d\u0439\u043b\u043e\u0430\u0434 \u0434\u043b\u044f\u00a0\u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e <code>data_size<\/code>, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. <\/p>\n<pre><code class=\"rust\">pub fn get_payload(data_size: usize) -&gt; (Vec&lt;u8&gt;, Vec&lt;u8&gt;) {     let request_data = generate_random_data(data_size, 1);     let response_data = generate_random_data(data_size, 2);     (request_data, response_data) }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>get_payload<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430. <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 1 &#8212; UNIX Domain Stream Socket<\/h2>\n<p>UNIX Domain Sockets(UDS) \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u043b\u044f\u00a0\u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u0439 UNIX\u2011\u043c\u0430\u0448\u0438\u043d\u0435 \u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0IP\u2011\u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438. \u041e\u043d\u0438 \u0437\u0430\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0431\u043e\u043b\u0435\u0435 \u043b\u0435\u0433\u043a\u0438\u0435 \u0438\u00a0\u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0440\u044f\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 \u0434\u043b\u044f\u00a0\u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f UNIX Domain Stream Socket:<\/p>\n<pre><code class=\"rust\">... \/\/ Producer const UNIX_SOCKET_PATH: &amp;str = \"\/tmp\/unix_stream.sock\";  impl UnixStreamRunner {     pub fn new(start_child: bool, data_size: usize) -&gt; Self {         let unix_listener = UnixListener::bind(UNIX_SOCKET_PATH).unwrap();         let exe = crate::executable_path(\"unix_stream_consumer\");         let child_proc = if start_child {             Some(Command::new(exe).args(&amp;[data_size.to_string()]).spawn().unwrap())         } else {             None         };          let wrapper = UnixStreamWrapper::from_listener(unix_listener);         let (request_data, response_data) = get_payload(data_size);          Self { child_proc, wrapper, data_size, request_data, response_data }     }      pub fn run(&amp;mut self, n: usize) {         let mut buf = vec![0; self.data_size];         for _ in 0..n {             self.wrapper.stream.write(&amp;self.request_data).unwrap();             self.wrapper.stream.read_exact(&amp;mut buf).unwrap();         }     } } ...  \/\/ Cosumer fn main() {     let args: Vec&lt;String&gt; = std::env::args().collect();     let data_size = usize::from_str(&amp;args[1]).unwrap();      core_affinity::set_for_current(core_affinity::CoreId { id: 0 });      let mut wrapper = ipc::unix_stream::UnixStreamWrapper::unix_connect();     let (request_data, response_data) = get_payload(data_size);     cpu_warmup();      let mut buf = vec![0; data_size];     while let Ok(_) = wrapper.stream.read_exact(&amp;mut buf) {         wrapper.stream.write(&amp;response_data).unwrap();     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f\u00a0\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u0442\u044c \u0432\u00a0\u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u043e\u043a\u0435\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u00a0\u0441\u043e\u043a\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>request_data<\/code>, \u0430\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u00a0\u0431\u0443\u0444\u0435\u0440, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>response_message<\/code>. <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 2 &#8212; Unix Datagram Socket<\/h2>\n<p>\u0412\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 UNIX domain datagram socket \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441\u00a0\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0432\u00a0\u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435:<\/p>\n<ol>\n<li>\n<p>\u00abAddress already in use\u00bb: \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0443\u0442\u044c \u0441\u043e\u043a\u0435\u0442\u0430 <code>\/tmp\/unix_datagram.sock<\/code> \u0434\u043b\u044f\u00a0\u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u043c \u0441\u043e\u043a\u0435\u0442\u0430\u043c. \u041c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043e\u0431\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043a\u00a0\u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u0447\u0442\u043e\u00a0\u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a\u00a0\u043e\u0448\u0438\u0431\u043a\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u00abAddress already in use\u00bb. \u041f\u043e\u0442\u043e\u043c \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e\u00a0\u0432\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u0434\u0430\u0442\u0430\u0433\u0440\u0430\u043c\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043b\u044f\u00a0\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u043e\u043a\u0435\u0442\u044b \u0434\u0440\u0443\u0433 \u0441\u00a0\u0434\u0440\u0443\u0433\u043e\u043c \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>connect()<\/code>, \u0447\u0442\u043e\u00a0\u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442 \u0430\u0434\u0440\u0435\u0441 \u043f\u0438\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u00abMessage too big\u00bb: \u0414\u0430\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437\u2011\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430\u00a0\u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u0442\u0430\u0433\u0440\u0430\u043c\u043c\u044b UDP. \u0414\u043b\u044f\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u00abNo buffer space available\u00bb: \u0412\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438, \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043d\u0430<a href=\"https:\/\/stackoverflow.com\/questions\/65261295\/udp-datagram-sockets-what-are-the-possible-causes-of-failure-of-send-for-no\"> <u>stackoverflow<\/u><\/a>, \u0447\u0442\u043e\u00a0\u0434\u0430\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u044f\u0434\u0440\u043e \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0434\u00a0\u0431\u0443\u0444\u0435\u0440 \u0441\u043e\u043a\u0435\u0442\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0439\u2011\u043b\u0438\u0431\u043e \u0438\u0437\u00a0\u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0443\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438. \u041c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u00a0\u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u0434\u043e\u0431\u044c\u0435\u043c\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u0435\u0440\u044f \u0434\u0430\u043d\u043d\u044b\u0445: \u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0441\u044f\u00a0\u0431\u044b \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u043d\u0430\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u0435 UDP, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044c \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u0438\u00a0\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 IPC \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438, \u043c\u044b \u043f\u043e\u043a\u0430 \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0414\u043b\u044f\u00a0\u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043f\u0430\u043d\u0438\u043a \u0432\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0442\u0435\u0440\u0438 \u0438\u043b\u0438\u00a0\u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0447\u0430\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u0430 \u0438\u043b\u0438\u00a0\u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442 \u0432\u00a0\u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0438\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"rust\">... \/\/ Producer const MAX_CHUNK_SIZE: usize = 64 * KB; const UNIX_DATAGRAM_SOCKET_1: &amp;str = \"\/tmp\/unix_datagram1.sock\"; const UNIX_DATAGRAM_SOCKET_2: &amp;str = \"\/tmp\/unix_datagram2.sock\";  impl UnixDatagramWrapper {     pub fn new(is_child: bool, data_size: usize) -&gt; Self {         let (socket_path, peer_socket_path) = if is_child {             (UNIX_DATAGRAM_SOCKET_1, UNIX_DATAGRAM_SOCKET_2)         } else {             (UNIX_DATAGRAM_SOCKET_2, UNIX_DATAGRAM_SOCKET_1)         };         let socket = UnixDatagram::bind(socket_path).unwrap();         Self { socket, peer_socket_path, data_size, }     }      pub fn connect_to_peer(&amp;self) {         self.socket.connect(&amp;self.peer_socket_path).unwrap();     }      pub fn send(&amp;self, data: &amp;Vec&lt;u8&gt;) {         \/\/ Send data in chunks         for chunk in data.chunks(MAX_CHUNK_SIZE) {             \/\/ Retry until we have a successful write             loop {                 match self.socket.send(chunk) {                     Ok(_) =&gt; break,                     Err(_) =&gt; continue,                 }             }         }     }      pub fn recv(&amp;self) -&gt; Vec&lt;u8&gt; {         let mut received_data = Vec::new();         \/\/ Read till we receive all chunks         loop {             let mut buf = vec![0; MAX_CHUNK_SIZE];             let size = self.socket.recv(&amp;mut buf).unwrap();             received_data.extend_from_slice(&amp;buf[..size]);             if received_data.len() == self.data_size {                 break;             }         }         received_data     } }  impl UnixDatagramRunner {     pub fn new(start_child: bool, data_size: usize) -&gt; Self {         let is_child = false;         let wrapper = UnixDatagramWrapper::new(is_child, data_size);         let (request_data, response_data) = get_payload(data_size);          let exe = crate::executable_path(\"unix_datagram_consumer\");         let child_proc = if start_child {             Some(Command::new(exe).args(&amp;[data_size.to_string()]).spawn().unwrap(),)         } else {             None         };         \/\/ Awkward sleep to make sure the child proc is ready         sleep(Duration::from_millis(500));         wrapper.connect_to_peer();          Self { child_proc, wrapper, request_data, response_data, }     }      pub fn run(&amp;mut self, n: usize, print: bool) {         let start = Instant::now();         for _ in 0..n {             self.wrapper.send(&amp;self.request_data);             let _response = self.wrapper.recv();         }     } } ...  \/\/ Consumer fn main() {     let args: Vec&lt;String&gt; = std::env::args().collect();     let data_size = usize::from_str(&amp;args[1]).unwrap();      core_affinity::set_for_current(core_affinity::CoreId { id: 0 });      let is_child = true;     let socket_wrapper = ipc::unix_datagram::UnixDatagramWrapper::new(is_child, data_size);     socket_wrapper.connect_to_peer();      let (request_data, response_data) =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-435964","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/435964","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=435964"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/435964\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}