{"id":359,"date":"2020-04-22T19:37:20","date_gmt":"2020-04-22T11:37:20","guid":{"rendered":"https:\/\/blog.inhowe.com\/?p=359"},"modified":"2020-04-22T19:46:21","modified_gmt":"2020-04-22T11:46:21","slug":"%e5%90%8c%e6%ad%a5%e6%9c%ba%e5%88%b6%e7%9a%84%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/blog.inhowe.com\/index.php\/2020\/04\/22\/%e5%90%8c%e6%ad%a5%e6%9c%ba%e5%88%b6%e7%9a%84%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95\/","title":{"rendered":"\u540c\u6b65\u673a\u5236\u7684\u6027\u80fd\u6d4b\u8bd5"},"content":{"rendered":"\n<p>\u8fd9\u51e0\u5929\u7814\u7a76\u4e86\u4e00\u4e0b\u591a\u6838\u5e73\u53f0\u7684\u540c\u6b65\u673a\u5236\u7684\u6027\u80fd\u6d4b\u8bd5\u3002\u4e3b\u8981\u662f\u5bf9\u6bd4\u4e86\u81ea\u65cbCAS\u9501\u548c\u4e92\u65a5\u9501\u7684\u6027\u80fd\u5dee\u8ddd\u3002<\/p>\n\n\n\n<p>\u81ea\u65cb\u9501\u662f\u4e00\u79cd\u4e50\u89c2\u9501\uff0c\u5b83\u8ba4\u4e3a\u5171\u4eab\u7684\u53d8\u91cf\u88ab\u5176\u4ed6\u7ebf\u7a0b\u5360\u636e\u65f6\u4e0d\u4f1a\u5360\u636e\u592a\u957f\u7684\u65f6\u95f4\uff0c\u56e0\u6b64\uff0c\u81ea\u65cb\u9501\u4f1a\u5728\u6b7b\u5faa\u73af\u91cc\u4e0d\u65ad\u68c0\u67e5\u9501\u72b6\u6001\uff0c\u800c\u4e0d\u662f\u50cf\u4e92\u65a5\u9501\u4e00\u6837\u5c06\u5f53\u524d\u4efb\u52a1\u6302\u8d77\uff08\u4e92\u65a5\u9501\u662f\u4e00\u79cd\u60b2\u89c2\u9501\uff09\u3002\u901a\u5e38\u6765\u8bb2\uff0c\u5207\u6362\u8fdb\u7a0b\u9700\u8981\u6d88\u8017\u7684\u8d44\u6e90\u8981\u5927\u4e8e\u5728while\u91cc\u591a\u5faa\u73af\u51e0\u6b21\uff0c\u56e0\u6b64\u4ece\u7406\u8bba\u4e0a\u6765\u8bb2\uff0c\u81ea\u65cb\u9501\u5bf9\u4e8e\u5171\u4eab\u8d44\u6e90\u4e0d\u4f1a\u88ab\u957f\u65f6\u95f4\u5360\u636e\u7684\u60c5\u51b5\u4e0b\uff0c\u6027\u80fd\u4f1a\u4f18\u4e8e\u4e92\u65a5\u9501\u3002<\/p>\n\n\n\n<p>\u81ea\u65cb\u9501\u7684\u4e00\u79cd\u5b9e\u73b0\u65b9\u5f0f\u662fCAS\uff08compare and swap\uff09\u64cd\u4f5c\uff0cCAS\u6307\u4ee4\u6267\u884c\u65f6\uff0c\u5f53\u4e14\u4ec5\u5f53\u5185\u5b58\u5730\u5740V\u7684\u503c\u4e0e\u9884\u671f\u503cA\u76f8\u7b49\u65f6\uff0c\u5c06\u5185\u5b58\u5730\u5740V\u7684\u503c\u4fee\u6539\u4e3aB\uff0c\u5426\u5219\u5c31\u4ec0\u4e48\u90fd\u4e0d\u505a\u3002\u6574\u4e2a\u6bd4\u8f83\u5e76\u66ff\u6362\u7684\u64cd\u4f5c\u662f\u4e00\u4e2a\u539f\u5b50\u64cd\u4f5c\u3002GNU\u63d0\u4f9b\u4e86\u73b0\u6210\u7684\u51fd\u6570<code>__sync_bool_compare_and_swap<\/code>\u3002\u5f53\u7136\uff0cC++\u3001Windows\u3001Java\u7b49\u4e5f\u63d0\u4f9b\u4e86\u5404\u81ea\u7684\u7c7b\u4f3c\u51fd\u6570\u3002\uff09<\/p>\n\n\n\n<p>CAS\u65b9\u5f0f\u8bbe\u8ba1\u7684\u81ea\u65cb\u9501\u7684\u4f18\u70b9\u5728\u4e8e\u5341\u5206\u8f7b\u91cf\uff0c\u4e0d\u65ad\u7684while\u5faa\u73af\u68c0\u67e5\u5373\u53ef\uff0c\u4f46\u4e5f\u6709\u4e00\u4e2a\u81f4\u547d\u7f3a\u70b9\uff0c\u5c31\u662fABA\u95ee\u9898\uff0c\u5982\u679c\u5728\u4e0b\u4e00\u6b21\u68c0\u67e5\u524d\uff0c\u539f\u6765\u7684\u6570\u636eA\u88ab\u6362\u4e3aB\u53c8\u6362\u4e3aA\u540e\uff0c\u4fbf\u4f1a\u9519\u8bef\u7684\u8ba4\u4e3a\u68c0\u67e5\u7ed3\u679c\u548c\u9884\u671f\u503c\u4e00\u81f4\uff0c\u5b9e\u9645\u4e0a\u6570\u636e\u53d1\u751f\u8fc7\u4e86\u66f4\u6539\u3002\u5bf9\u4e8e\u65e0\u9501\u94fe\u8868\u5f88\u5bb9\u6613\u9047\u5230\u8fd9\u7c7b\u95ee\u9898\uff0c\u89e3\u51b3\u529e\u6cd5\u53ef\u4ee5\u662f\u6dfb\u52a0\u201c\u7248\u672c\u53f7\u201d\u8fdb\u884c\u989d\u5916\u68c0\u67e5\uff0c\u4efb\u4f55\u64cd\u4f5c\u90fd\u4f1a\u4f7f\u7248\u672c\u53f7\u52a0\u4e00\uff0c\u8fd9\u6837\u5373\u4f7f\u8fd8\u662fA\uff0c\u4f46\u662f\u7248\u672c\u53f7\u4e0d\u540c\u4e86\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u4e92\u65a5\u9501\uff0cGNU\u7684\u7ebf\u7a0b\u76f8\u5173\u7684\u7c7b\u4e5f\u63d0\u4f9b\u4e86\u7c7b\u4f3c\u7684\u73b0\u6210\u64cd\u4f5c\uff1a<code>pthread_mutex_lock<\/code>\u548c<code>pthread_mutex_unlock<\/code>\u3002\u5728\u8d44\u6e90\u88ab\u5f53\u524d\u7ebf\u7a0b\u4e0a\u9501\u540e\uff0c\u5176\u4ed6\u7ebf\u7a0b\u8bbf\u95ee\u8be5\u8d44\u6e90\u65f6\u4f1a\u83b7\u53d6\u9501\u5931\u8d25\uff0c\u5e76\u88ab\u6302\u8d77\u3002<\/p>\n\n\n\n<p>\u5f71\u54cd\u540c\u6b65\u6027\u80fd\u7684\u9664\u4e86\u9501\u7684\u590d\u6742\u6027\u4ee5\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a\u91cd\u8981\u56e0\u7d20\u5c31\u662fCACHE\u547d\u4e2d\u3002CACHE\u662fCPU\u548c\u5185\u5b58\u4e4b\u95f4\u6570\u636e\u4ea4\u6362\u7684\u4e00\u4e2a\u9ad8\u901f\u4e2d\u95f4\u7f13\u51b2\u3002\u5f53CPU\u9700\u8981\u6570\u636e\u7684\u65f6\u5019\uff0c\u6570\u636e\u4f1a\u9996\u5148\u4ece\u5185\u5b58\u62f7\u8d1d\u5230CACHE\u4e2d\uff0cCPU\u4e2dCACHE\u4e2d\u53d6\u6570\u636e\u3002\u4e3a\u4e86\u6548\u7387\uff0c\u901a\u5e38\u4f1a\u628a\u6240\u9700\u6570\u636e\u5468\u56f4\u7684\u5185\u5b58\u4e00\u5757\u62f7\u8d1d\u5230CACHE\u4e2d\u3002\u4e3e\u4f8b\uff0c\u5047\u8bbeCPU\u9700\u8981\u53d8\u91cfA\uff0c\u6b64\u65f6\u5305\u542b\u53d8\u91cf\u7684A\u7684\u5185\u5b58\u5757\u88ab\u62f7\u8d1d\u5230CACHE\uff0cCPU\u7528\u5b8c\u53d8\u91cfA\u540e\u63a5\u4e0b\u6765\u9700\u8981\u53d8\u91cfB\uff0c\u5982\u679c\u53d8\u91cfB\u6b63\u597d\u6328\u7740\u53d8\u91cfA\u5b58\u653e\uff0c\u90a3\u4e48CPU\u53ef\u4ee5\u76f4\u63a5\u4eceCACHE\u4e2d\u53d6\u51fa\u53d8\u91cfB\uff0c\u8fd9\u53eb\u505a\u7f13\u5b58\u547d\u4e2d\uff0c\u7a0b\u5e8f\u7684\u6267\u884c\u6548\u7387\u5c31\u4f1a\u6bd4\u8f83\u9ad8\u3002\u5982\u679c\u4e0d\u5e78\uff0c\u53d8\u91cfB\u7684\u4f4d\u7f6e\u548c\u53d8\u91cfA\u95f4\u9694\u592a\u8fdc\uff0c\u8d85\u8fc7\u4e86CACHE\u7684\u5927\u5c0f\uff0c\u90a3\u4e48CPU\u4e0d\u5f97\u4e0d\u53d1\u51fa\u8bf7\u6c42\uff0c\u4ece\u4e8c\u7ea7\u7f13\u5b58\u3001\u4e09\u7ea7\u7f13\u5b58\u751a\u81f3\u5185\u5b58\u4e2d\uff0c\u53bb\u5bfb\u627e\u53d8\u91cfB\uff0c\u628a\u53d8\u91cfB\u590d\u5236\u5230CACHE\u4e2d\u6765\uff0c\u8fd9\u5c31\u662f\u7f13\u5b58MISS\u3002\u4e24\u79cd\u60c5\u51b5\u4e00\u6bd4\u8f83\uff0c\u5f88\u660e\u663e\uff0cAB\u76f8\u90bb\u7684\u60c5\u51b5\u7a0b\u5e8f\u6267\u884c\u6548\u7387\u9ad8\uff0c\u8fd9\u5c31\u662f\u7f13\u5b58\u53cb\u597d\u578b\u4ee3\u7801\u3002\u4e00\u4e2a\u5f88\u7ecf\u5178\u7684\u4f8b\u5b50\u5c31\u662f\u7ed9\u4e8c\u7ef4\u6570\u7ec4\u8d4b\u503c\uff0c\u5f53\u6570\u7ec4\u5927\u5c0f\u8d85\u8fc7CACHE\u5927\u5c0f\u540e\uff0c\u6309\u884c\u8d4b\u503c\u7684\u6548\u7387\u4f1a\u6bd4\u6309\u5217\u8d4b\u503c\u7684\u901f\u5ea6\u8981\u5feb\uff0c\u5c31\u662f\u56e0\u4e3a\uff0c\u6240\u53d6\u7684\u4e00\u884c\u6570\u636e\uff0c\u603b\u662f\u76f8\u90bb\u7684\uff0c\u56e0\u6b64\u53d1\u751fmiss\u7684\u6982\u7387\u5c31\u8981\u4f4e\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f\u540c\u6b65\u673a\u5236\u7684\u6d4b\u8bd5\u4ee3\u7801\u548c\u6d4b\u8bd5\u7ed3\u679c\u3002\u6d4b\u8bd5\u601d\u8def\u5c31\u662f\u591a\u4e2a\u7ebf\u7a0b\u5bf9\u540c\u4e00\u4e2a\u77e9\u9635\u8fdb\u884c\u7ffb\u8f6c\uff0c\u56e0\u6b64\u9700\u8981\u4e0a\u9501\u3002\u5982\u679c\u8981\u6d4b\u8bd5\u7f13\u5b58miss\u60c5\u51b5\u4e0b\u7684\u540c\u6b65\u6548\u7387\u5219\u4e0d\u505a\u771f\u5b9e\u7ffb\u8f6c\uff0c\u53ea\u5bf9\u6570\u7ec4\u524d\u51e0\u4e2a\u5143\u7d20\u505a\u7b80\u5355\u7684\u8d4b\u503c\u64cd\u4f5c\uff0c\u4f7f\u603b\u64cd\u4f5c\u6b21\u6570\u4e0e\u771f\u5b9e\u7ffb\u8f6c\u6240\u9700\u8981\u7684\u6b21\u6570\u4e00\u81f4\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">#ifndef _GNU_SOURCE\n    #define _GNU_SOURCE\n#endif\n\n#include &lt;stdio.h>\n#include &lt;pthread.h>\n#include &lt;unistd.h>\n#include &lt;stdlib.h>\n#include &lt;sched.h>\n#include &lt;linux\/unistd.h>\n#include &lt;sys\/syscall.h>\n#include &lt;errno.h>\n#include &lt;linux\/types.h>\n#include &lt;sys\/time.h>\n#include &lt;stdbool.h>\n\n#define INC_TO          10000        \/\/ \u7d2f\u52a0\u6b21\u6570\n#define USE_MUTEX       0           \/\/\u4f7f\u7528mutex\u52a0\u9501\u6d4b\u8bd5\u8fd8\u662f\u4f7f\u7528CAS\u6d4b\u8bd5\n#define CACHE_MISS      0           \/\/\u662f\u5426miss\u7f13\u5b58\n\nint global_int = 0;\npthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER;\n\n\/\/\u77e9\u9635\u7ffb\u8f6c\n#define MATSIZE 128\nint mat[MATSIZE][MATSIZE];\nvoid transpose()\n{\n    for (int i = 0; i &lt; MATSIZE; i++)\n        for (int j = 0; j &lt; MATSIZE; j++)\n        {\n#if CACHE_MISS\n            \/\/\u771f\u7684\u7ffb\u8f6c\u77e9\u9635\n            int aux = mat[i][j];\n            mat[i][j] = mat[j][i];\n            mat[j][i] = aux;\n#else\n            \/\/\u5047\u7684\u7ffb\u8f6c\u77e9\u9635\uff0c\u968f\u4fbf\u505a\u4e9b\u65e0\u610f\u4e49\u64cd\u4f5c\uff0c\u4fdd\u8bc1\u64cd\u4f5c\u6b21\u6570\u76f8\u540c\n            int aux = mat[0][0];\n            mat[0][2] = mat[0][1];\n            mat[0][3] = aux;\n#endif\n        }\n}\n\n\/\/\u83b7\u53d6\u5f53\u524dCPU\u65f6\u95f4\n__u64 rdtsc()\n{\n    __u32 lo, hi;\n\n    __asm__ __volatile__(\n        \"rdtsc\"\n        : \"=a\"(lo), \"=d\"(hi));\n\n    return (__u64)hi &lt;&lt; 32 | lo;\n}\n\n\/\/\u83b7\u53d6\u7ebf\u7a0bID\npid_t gettid( void )\n{\n    return syscall( __NR_gettid );\n}\n\n\/\/CAS\u65e0\u9501\u64cd\u4f5c\nint mutex = 0;\nint lock = 0;\nint unlock = 1;\nvoid *thread_routine_cas( void *arg )\n{\n    int i;\n    int proc_num = (int)(long)arg;\n    __u64 begin, end;\n    struct timeval tv_begin,tv_end;\n    __u64 timeinterval;\n    cpu_set_t set;\n\n    \/\/\u7ebf\u7a0b\u7ed1\u5b9aCPU\n    CPU_ZERO( &amp;set );\n    CPU_SET( proc_num, &amp;set );\n    if (sched_setaffinity( gettid(), sizeof( cpu_set_t ), &amp;set ))\n    {\n        perror( \"sched_setaffinity\" );\n        return NULL;\n    }\n\n    \/\/\u8ba1\u65f6\n    begin = rdtsc();\n    gettimeofday(&amp;tv_begin,NULL);\n\n    for (int i = 0; i &lt; INC_TO; i++)\n    {\n        while (!__sync_bool_compare_and_swap(&amp;mutex, lock, 1))\n            usleep(100); \/\/\u4e3a\u5565\u4e0d\u52a0\u5ef6\u65f6\u53cd\u800ccache miss\u7684\u65f6\u95f4\u8981\u4f4e\uff1f\n        \/\/ {}\n        global_int++; \n        transpose();\n        __sync_bool_compare_and_swap(&amp;mutex, unlock, 0);\n    }\n\n    gettimeofday(&amp;tv_end,NULL);\n    end = rdtsc();\n    timeinterval =(tv_end.tv_sec - tv_begin.tv_sec)*1000000 +(tv_end.tv_usec - tv_begin.tv_usec);\n    \n    \/\/\u8f93\u51fa\n    fprintf(stderr, \"\u5904\u7406\u6838\u5fc3 %d \u7684 __sync_bool_compare_and_swap \u64cd\u4f5c\u82b1\u8d39 %llu CPU cycle\uff0c\u82b1\u8d39 %llu us\\n\",\n            proc_num, end - begin, timeinterval);\n\n    return NULL;\n}\n\n\/\/\u4f7f\u7528\u4e92\u65a5pthread_mutex_lock\u7684\u7684\u52a0\u9501\u64cd\u4f5c\nvoid *thread_routine_mutex( void *arg )\n{\n    int i;\n    int proc_num = (int)(long)arg;\n    __u64 begin, end;\n\n    struct timeval tv_begin,tv_end;\n    __u64 timeinterval;\n    cpu_set_t set;\n\n    \/\/\u7ebf\u7a0b\u7ed1\u5b9aCPU\n    CPU_ZERO( &amp;set );\n    CPU_SET( proc_num, &amp;set );\n    if (sched_setaffinity( gettid(), sizeof( cpu_set_t ), &amp;set ))\n    {\n        perror( \"sched_setaffinity\" );\n        return NULL;\n    }\n\n    \/\/\u8ba1\u65f6\n    begin = rdtsc();\n    gettimeofday(&amp;tv_begin,NULL);\n\n    for (int i = 0; i &lt; INC_TO; i++){\n        pthread_mutex_lock(&amp;count_lock);\n        global_int++;\n        transpose();\n        pthread_mutex_unlock(&amp;count_lock);\n    }\n\n    gettimeofday(&amp;tv_end,NULL);\n    end = rdtsc();\n    timeinterval =(tv_end.tv_sec - tv_begin.tv_sec)*1000000 +(tv_end.tv_usec - tv_begin.tv_usec);\n    \n    \/\/\u8f93\u51fa\n    fprintf(stderr, \"\u5904\u7406\u6838\u5fc3 %d \u7684 pthread lock \u64cd\u4f5c\u82b1\u8d39 %llu CPU cycle\uff0c\u82b1\u8d39 %llu us\\n\",\n            proc_num, end - begin, timeinterval);\n\n    return NULL;\n}\n\nint main()\n{\n    int procs = 0;\n    pthread_t *thrs;\n\n    \/\/ \u83b7\u53d6CPU\u6570\u91cf\n    procs = (int)sysconf( _SC_NPROCESSORS_ONLN );\n    if (procs &lt; 0)\n    {\n        perror( \"sysconf\" );\n        return -1;\n    }\n    \/\/ \u53ea\u4f7f\u7528\u5176\u4e2d2\u4e2a\u6838\u5fc3\n    if (procs>2)\n    {\n        procs = 2;\n    }\n\n    \/\/\u6309CPU\u6570\u91cf\u4e3a\u7ebf\u7a0b\u7533\u8bf7\u5185\u5b58\n    thrs = (pthread_t* )malloc(sizeof(pthread_t) * procs);\n    if (thrs == NULL)\n    {\n        perror( \"malloc\" );\n        return -1;\n    }\n\n    \/\/CACHE\u6a21\u5f0f\u63d0\u793a\n#if CACHE_MISS     \n    printf(\"CACHE MISS TEST\\n\");\n#else\n    printf(\"CACHE HIT TEST\\n\");\n#endif\n\n    \/\/\u4f7f\u7528\u52a0\u9501\u8fd8\u662fCAS\n#if USE_MUTEX\n    printf(\"Mutex Test\\n\");\n    \/\/\u521b\u5efa\u7ebf\u7a0b\u5e76\u6267\u884c\n    printf(\"Starting %d threads...\\n\", procs);\n    for (int i = 0; i &lt; procs; i++)\n    {\n        if (pthread_create( &amp;thrs[i], NULL, thread_routine_mutex,\n            (void *)(long)i ))\n        {\n            perror( \"pthread_create\" );\n            procs = i;\n            break;\n        }\n    }\n#else\n    printf(\"CAS Test\\n\");\n    \/\/\u521b\u5efa\u7ebf\u7a0b\u5e76\u6267\u884c\n    printf(\"Starting %d threads...\\n\", procs);\n    for (int i = 0; i &lt; procs; i++)\n    {\n        if (pthread_create(&amp;thrs[i], NULL, thread_routine_cas,\n                           (void *)(long)i))\n        {\n            perror(\"pthread_create\");\n            procs = i;\n            break;\n        }\n    }\n#endif\n\n    \/\/\u7b49\u5f85\u6240\u6709\u7ebf\u7a0b\u6267\u884c\u5b8c\u6bd5\u540e\u91ca\u653e\u5185\u5b58\n    for (int i = 0; i &lt; procs; i++)\n    {\n        pthread_join(thrs[i], NULL);\n    }\n    free( thrs );\n\n    \/\/\u6253\u5370\u8f93\u51fa\u7ed3\u679c\n    printf(\"\u5b9e\u9645\u7d2f\u52a0\u7ed3\u679c\u4e3a: %d\\n\", global_int );\n    printf(\"\u671f\u671b\u7d2f\u52a0\u7ed3\u679c\u4e3a: %d\\n\", procs * INC_TO);\n\n    return 0;\n}\n<\/pre>\n\n\n\n<p>\u6d4b\u8bd5\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n<div class=\"ead-preview\"><div class=\"ead-document\" style=\"position: relative;padding-top: 90%;\"><iframe src=\"\/\/view.officeapps.live.com\/op\/embed.aspx?src=http%3A%2F%2Fblog.inhowe.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fsync_test_result.xlsx\" title=\"Embedded Document\" class=\"ead-iframe\" style=\"width: 100%;height: 100%;border: none;position: absolute;left: 0;top: 0;\"><\/iframe><\/div><p class=\"embed_download\"><a href=\"http:\/\/blog.inhowe.com\/wp-content\/uploads\/2020\/04\/sync_test_result.xlsx\" download >Download [13.30 KB] <\/a><\/p><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u51e0\u5929\u7814\u7a76\u4e86\u4e00\u4e0b\u591a\u6838\u5e73\u53f0\u7684\u540c\u6b65\u673a\u5236\u7684\u6027\u80fd\u6d4b\u8bd5\u3002\u4e3b\u8981\u662f\u5bf9\u6bd4\u4e86\u81ea\u65cbCAS\u9501\u548c\u4e92\u65a5\u9501\u7684\u6027\u80fd\u5dee\u8ddd\u3002 \u81ea\u65cb\u9501\u662f\u4e00\u79cd\u4e50\u89c2\u9501&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/blog.inhowe.com\/index.php\/2020\/04\/22\/%e5%90%8c%e6%ad%a5%e6%9c%ba%e5%88%b6%e7%9a%84%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95\/\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/posts\/359"}],"collection":[{"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":3,"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":363,"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/posts\/359\/revisions\/363"}],"wp:attachment":[{"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.inhowe.com\/index.php\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}