{"id":298321,"date":"2020-02-06T15:00:31","date_gmt":"2020-02-06T15:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=298321"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=298321","title":{"rendered":"\u0415\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/487248\/\">\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043d\u0430 \u0433\u043b\u0430\u0437\u0430 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c RAM \u0432 \u0441\u0432\u043e\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u041a\u043e\u0434 \u044d\u0442\u043e\u0442 \u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443 (\u0442\u0430\u043c \u00ab\u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0430\u00bb) \u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435. \u0418\u0442\u0430\u043a, \u043a\u043e\u0442 \u0432 \u0441\u0442\u0443\u0434\u0438\u0438!<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"cpp\">#include &lt;sys\/time.h&gt; #include &lt;string.h&gt; #include &lt;iostream&gt;  #define CNT 1024 #define SIZE (1024*1024)  int main() { \tstruct timeval start; \tstruct timeval end; \tlong millis; \tdouble gbs; \tchar ** buffers; \tbuffers = new char*[CNT]; \tfor (int i=0;i&lt;CNT;i++) { \t\tbuffers[i] = new char[SIZE]; \t} \tgettimeofday(&amp;start, NULL); \tfor (int i=0;i&lt;CNT;i++) { \t\tmemset(buffers[i], 0, SIZE); \t} \tgettimeofday(&amp;end, NULL); \tmillis = (end.tv_sec - start.tv_sec) * 1000 + \t\t(end.tv_usec - start.tv_usec) \/ 1000; \tgbs = 1000.0 \/ millis; \tstd::cout &lt;&lt; gbs &lt;&lt; &quot; GB\/s\\n&quot;; \tfor (int i=0;i&lt;CNT;i++) { \t\tdelete buffers[i]; \t} \tdelete buffers; \treturn 0; }<\/code><\/pre>\n<p>  \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u0451 \u043e\u0434\u0438\u043d \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442. \u0418 \u0447\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442?<\/p>\n<p>  <b>$ .\/memtest <br \/>  4.06504 GB\/s<\/b><\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 4GB\/s.<\/p>\n<p>  \u0427\u0442\u043e?!?!<\/p>\n<p>  \u041a\u0430\u043a?!?!?<\/p>\n<p>  \u042d\u0442\u043e Core i7 (\u043f\u0443\u0441\u0442\u044c \u0438 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043d\u043e\u0432\u044b\u0439), DDR4, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d \u2014 \u041f\u041e\u0427\u0415\u041c\u0423?!?!<\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u0435\u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0439.<\/p>\n<p>  \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 new (\u043a\u0430\u043a \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f malloc, \u043a\u0441\u0442\u0430\u0442\u0438) \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u0432 \u0432 \u043f\u0443\u043b\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 \u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 sbrk() \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043a\u0430.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439. \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b.<\/p>\n<p>  \u0418 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, MMU \u00ab\u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0435\u0442\u00bb page fault, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0448\u0438\u043d\u044b \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 RAM, \u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c MMU \u0438 VMM \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0410 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">#include &lt;sys\/time.h&gt; #include &lt;string.h&gt; #include &lt;iostream&gt;  #define CNT 1024 #define SIZE (1024*1024)  int main() { \tstruct timeval start; \tstruct timeval end; \tlong millis; \tdouble gbs; \tchar ** buffers; \tbuffers = new char*[CNT]; \tfor (int i=0;i&lt;CNT;i++) {                 \/\/ FIXED HERE!!! \t\tbuffers[i] = new char[SIZE](); \/\/ Add brackets, &amp;$# !!! \t} \tgettimeofday(&amp;start, NULL); \tfor (int i=0;i&lt;CNT;i++) { \t\tmemset(buffers[i], 0, SIZE); \t} \tgettimeofday(&amp;end, NULL); \tmillis = (end.tv_sec - start.tv_sec) * 1000 + \t\t(end.tv_usec - start.tv_usec) \/ 1000; \tgbs = 1000.0 \/ millis; \tstd::cout &lt;&lt; gbs &lt;&lt; &quot; GB\/s\\n&quot;; \tfor (int i=0;i&lt;CNT;i++) { \t\tdelete buffers[i]; \t} \tdelete buffers; \treturn 0; }<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (char 0).<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<p>  <b>$ .\/memtest <br \/>  28.5714 GB\/s<\/b><\/p>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0435 \u0434\u0435\u043b\u043e.<\/p>\n<p>  \u041c\u043e\u0440\u0430\u043b\u044c \u2014 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e-\u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/487248\/\"> https:\/\/habr.com\/ru\/post\/487248\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/487248\/\">\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043d\u0430 \u0433\u043b\u0430\u0437\u0430 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c RAM \u0432 \u0441\u0432\u043e\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u041a\u043e\u0434 \u044d\u0442\u043e\u0442 \u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443 (\u0442\u0430\u043c \u00ab\u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0430\u00bb) \u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435. \u0418\u0442\u0430\u043a, \u043a\u043e\u0442 \u0432 \u0441\u0442\u0443\u0434\u0438\u0438!  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-298321","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298321","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=298321"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298321\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}