-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1036 lines (613 loc) · 35.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Hugo 0.54.0 with theme Tranquilpeak 0.4.3-SNAPSHOT">
<meta name="author" content="cicirori">
<meta name="keywords" content="">
<meta name="description" content="cicirori's blog">
<meta property="og:description" content="cicirori's blog">
<meta property="og:type" content="website">
<meta property="og:title" content="Noumenon">
<meta name="twitter:title" content="Noumenon">
<meta property="og:url" content="https://cicirori.github.io/">
<meta property="twitter:url" content="https://cicirori.github.io/">
<meta property="og:site_name" content="Noumenon">
<meta property="og:description" content="cicirori's blog">
<meta name="twitter:description" content="cicirori's blog">
<meta property="og:locale" content="zh-cn">
<meta name="twitter:card" content="summary">
<meta property="og:image" content="https://www.gravatar.com/avatar/ae723617c5cb9abcd2b4505a2ffdd322?s=640">
<meta property="twitter:image" content="https://www.gravatar.com/avatar/ae723617c5cb9abcd2b4505a2ffdd322?s=640">
<title>Noumenon</title>
<link rel="icon" href="https://cicirori.github.io/img/favicon-96x96.png">
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://cicirori.github.io/index.xml">
<link rel="canonical" href="https://cicirori.github.io/">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css" integrity="sha256-vuXZ9LGmmwtjqFX1F+EKin1ThZMub58gKULUyf0qECk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" integrity="sha256-SEa4XYAHihTcEP1f5gARTB2K26Uk8PsndQYHQC1f4jU=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cicirori.github.io/css/style-nnm2spxvve8onlujjlegkkytaehyadd4ksxc1hyzzq9a2wvtrgbljqyulomn.min.css" />
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-134593056-1', 'auto');
ga('send', 'pageview');
}
</script>
</head>
<body>
<div id="blog">
<header id="header" data-behavior="2">
<i id="btn-open-sidebar" class="fa fa-lg fa-bars"></i>
<div class="header-title">
<a class="header-title-link" href="https://cicirori.github.io/">Noumenon</a>
</div>
<a class="header-right-picture "
href="https://cicirori.github.io/#about">
<img class="header-picture" src="https://www.gravatar.com/avatar/ae723617c5cb9abcd2b4505a2ffdd322?s=90" alt="作者的图片" />
</a>
</header>
<nav id="sidebar" data-behavior="2">
<div class="sidebar-container">
<div class="sidebar-profile">
<a href="https://cicirori.github.io/#about">
<img class="sidebar-profile-picture" src="https://www.gravatar.com/avatar/ae723617c5cb9abcd2b4505a2ffdd322?s=110" alt="作者的图片" />
</a>
<h4 class="sidebar-profile-name">cicirori</h4>
<h5 class="sidebar-profile-bio">九级激光莲座巫师</h5>
</div>
<ul class="sidebar-buttons">
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://cicirori.github.io/">
<i class="sidebar-button-icon fa fa-lg fa-home"></i>
<span class="sidebar-button-desc">首页</span>
</a>
</li>
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://cicirori.github.io/categories">
<i class="sidebar-button-icon fa fa-lg fa-bookmark"></i>
<span class="sidebar-button-desc">分类</span>
</a>
</li>
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://cicirori.github.io/tags">
<i class="sidebar-button-icon fa fa-lg fa-tags"></i>
<span class="sidebar-button-desc">标签</span>
</a>
</li>
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://cicirori.github.io/archives">
<i class="sidebar-button-icon fa fa-lg fa-archive"></i>
<span class="sidebar-button-desc">归档</span>
</a>
</li>
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://cicirori.github.io/resume_liuyinghui.pdf">
<i class="sidebar-button-icon fa fa-lg fa-question"></i>
<span class="sidebar-button-desc">关于</span>
</a>
</li>
</ul>
<ul class="sidebar-buttons">
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://github.com/cicirori" target="_blank" rel="noopener">
<i class="sidebar-button-icon fa fa-lg fa-github"></i>
<span class="sidebar-button-desc">GitHub</span>
</a>
</li>
</ul>
<ul class="sidebar-buttons">
<li class="sidebar-button">
<a class="sidebar-button-link " href="https://cicirori.github.io/index.xml">
<i class="sidebar-button-icon fa fa-lg fa-rss"></i>
<span class="sidebar-button-desc">RSS</span>
</a>
</li>
</ul>
</div>
</nav>
<div id="main" data-behavior="2"
class="
hasCoverMetaIn
">
<section class="postShorten-group main-content-wrap">
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/05/%E6%AF%8F%E4%B8%AA%E7%A8%8B%E5%BA%8F%E5%91%98%E9%83%BD%E8%AF%A5%E7%9F%A5%E9%81%93%E7%9A%84%E6%95%B0%E5%AD%97-%E5%A6%82%E6%9E%9C-cpu-%E9%A2%91%E7%8E%87%E5%8F%98%E6%88%90-1-hz/">
每个程序员都该知道的数字 -- 如果 CPU 频率变成 1 Hz
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-05-05T14:13:37+08:00">
五月 5, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<blockquote>
<p>译自图片:<a href="https://imgur.com/8LIwV4C">https://imgur.com/8LIwV4C</a></p>
</blockquote>
<p>
<a href="https://cicirori.github.io/2019/05/%E6%AF%8F%E4%B8%AA%E7%A8%8B%E5%BA%8F%E5%91%98%E9%83%BD%E8%AF%A5%E7%9F%A5%E9%81%93%E7%9A%84%E6%95%B0%E5%AD%97-%E5%A6%82%E6%9E%9C-cpu-%E9%A2%91%E7%8E%87%E5%8F%98%E6%88%90-1-hz/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/%E8%99%9A%E6%8B%9F%E5%8C%96%E6%96%B9%E6%B3%95%E5%AF%B9%E6%AF%94/">
虚拟化方法对比
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-03-16T22:22:09+08:00">
三月 16, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<!--toc-->
<p>虽然经常和 KVM 打交道, 但是对 KVM 的印象仅限于 kvm.ko 和 kvm-intel.ko 这两个 kernel module 和 VMExit 指令还有 QEMU 和 virt-manager. 对 KVM, OpenVZ 和 Xen 区别的了解也仅限于, OpenVZ 容易超售, KVM 能跑 BBR, Xen么… 好像不怎么常见.</p>
<p>今天大概了解了一下三种虚拟化的实现方式, 真的是大吃一惊, 没有想到看起来最老旧的, 选购 VPS 的时候避而远之的OpenVZ, 居然和当下火热的 Docker 一样都是基于 Linux 的container 机制, 瞬间有种失敬的感觉.</p>
<p>
<a href="https://cicirori.github.io/2019/03/%E8%99%9A%E6%8B%9F%E5%8C%96%E6%96%B9%E6%B3%95%E5%AF%B9%E6%AF%94/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/mod-%E8%BF%90%E7%AE%97%E6%80%BB%E7%BB%93/">
Mod 运算总结
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-03-10T15:06:51+08:00">
三月 10, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<!--toc-->
<p>做一场笔试题的时候 case 只 pass 了 90%, 反复检查算法应该没有错, 但是题目要求对1000000007取余, 最后结果是<code>( a * 2^n) % 1000000007</code>, 我直觉是<code>(a * (2^n % 1000000007) ) % 1000000007 != ( a * 2^n) % 1000000007</code>的, 但是改了一下 pass 了. 做完和同学交流被告知<code>(a * (b % c) ) % c = (a * b) % c</code>, 讲道理这个抽代学过的(同学说他们高中就学过 :) 但是现在忘了, shame on me, 正好最近看了一下负数参与模运算的一些规则, 就想总结一下.</p>
<p>
<a href="https://cicirori.github.io/2019/03/mod-%E8%BF%90%E7%AE%97%E6%80%BB%E7%BB%93/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/%E5%8F%98%E9%87%8F%E5%88%9D%E5%A7%8B%E5%8C%96/">
变量初始化
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-03-06T14:21:22+08:00">
三月 6, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<!--toc-->
<h1 id="初始化">初始化</h1>
<p>总结一下, 就是非局部变量和线程局部变量先进行常量初始化, 没有的话进行零初始化. 分别发生在 main 执行前和 线程函数执行前.</p>
<p>非局部变量, 进行默认初始化, 除了非POD会调用默认构造函数, 和数组递归默认初始化一下元素, 其他的都是 do nothing, 结果上来看就是变量值是随机的.</p>
<p>另外构造函数列表初始化的时候, 初始化顺序和列表顺序无关, 处在同一个类内的变量和定义顺序有关, 处在不同类中的变量先基类.</p>
<p>另外, const变量必须在构造函数初始化列表中初始化. static 成员变量必须在类外初始化.</p>
<p>
<a href="https://cicirori.github.io/2019/03/%E5%8F%98%E9%87%8F%E5%88%9D%E5%A7%8B%E5%8C%96/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/%E5%8F%B3%E5%80%BC%E5%BC%95%E7%94%A8%E5%92%8Cstdmove/">
右值引用和std::move
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-03-02T22:50:39+08:00">
三月 2, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<!--toc-->
<h1 id="移动语义">移动语义</h1>
<p>移动语义也是比较直觉的概念, 我们常见复制构造函数和复制赋值函数, 但是很多时候资源是独享的, 比如 I/O, 或者资源需要传递而不是复制. 这时候我们就需要工具, 实现使用源对象的资源来新建一个对象. 右值引用和 std::move 因此被引入.</p>
<p>
<a href="https://cicirori.github.io/2019/03/%E5%8F%B3%E5%80%BC%E5%BC%95%E7%94%A8%E5%92%8Cstdmove/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/%E8%AF%BB%E5%A6%82%E4%BD%95%E9%AB%98%E6%95%88%E5%AD%A6%E4%B9%A0/">
读「如何高效学习」
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-02-26T13:08:47+08:00">
二月 26, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<!--toc-->
<h1 id="作者">作者</h1>
<blockquote>
<p> 斯科特·扬(Scott Young)1988年出生在加拿大,从高中开始放学后就几乎不学习,尽管如此,他还是以全班第二名的成绩毕业;读大学时,他每天学习一般不超过2个小时,但他的平均成绩保持在A以上;从加拿大马尼托巴大学商科毕业后,他用了一年时间,通过互联网完成了麻省理工学院计算机专业本科四年33门课程,节省了约合人民币150万元的大学学费,还登上了TED的讲台分享经验。</p>
<p> 这还不是最酷的。斯科特·扬还曾花一年时间去了4个国家,学习了4门外语,用30天学习肖像画。</p>
</blockquote>
<p>作者斯科特杨的履历着实吸引人,直接让我有了读「如何高效学习」这本书的欲望。总结一下看下来的感觉,其实类比、比喻这种方法我有一段是非常厌恶,特别是有人用它来论证自己的观点时,只要出现类比的手法,逻辑链条直接断掉,让人直接没了想进一步交流的兴趣。对这一方法的绝对排斥,可能是我既对唯理论深信不疑,又难以摆脱经验论影响的产生的虚无主义救赎,简而言之就是哲学理论太初级。后来读康德,解决了我很多疑惑,而斯科特杨的获取、理解、拓展、纠错和应用正好和康德对自然立法的理念相似,当然省略了绝大多数的细节,这也是一个理论想要得到合适的应用性而不得不妥协的。</p>
<p>
<a href="https://cicirori.github.io/2019/02/%E8%AF%BB%E5%A6%82%E4%BD%95%E9%AB%98%E6%95%88%E5%AD%A6%E4%B9%A0/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<article class="postShorten postShorten--thumbnailimg-bottom" itemscope itemType="http://schema.org/BlogPosting">
<div class="postShorten-wrap">
<div class="postShorten-header">
<h1 class="postShorten-title" itemprop="headline">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/%E5%AE%9E%E7%8E%B0%E6%99%BA%E8%83%BD%E6%8C%87%E9%92%88/">
实现智能指针
</a>
</h1>
<div class="postShorten-meta post-meta">
<time itemprop="datePublished" datetime="2019-02-25T16:11:31+08:00">
二月 25, 2019
</time>
<span>发布在</span>
<a class="category-link" href="https://cicirori.github.io/categories/blog">blog</a>
</div>
</div>
<div class="postShorten-excerpt" itemprop="articleBody">
<!--toc-->
<h1 id="思路">思路</h1>
<p>核心是引用计数, 使用一个自定义的类来保存和管理引用计数. 需要实现指针类型的赋值构造函数, 拷贝构造函数, 析构函数, <code>=,*,-></code>运算符, 为了管理不同的类型, 使用模板技术.</p>
<p>
<a href="https://cicirori.github.io/2019/02/%E5%AE%9E%E7%8E%B0%E6%99%BA%E8%83%BD%E6%8C%87%E9%92%88/" class="postShorten-excerpt_link link">阅读全文</a>
</p>
</div>
</div>
</article>
<div class="pagination-bar">
<ul class="pagination">
<li class="pagination-next">
<a class="btn btn--default btn--small" href="https://cicirori.github.io/page/2/">
<span>下一页</span>
<i class="fa fa-angle-right text-base icon-ml"></i>
</a>
</li>
<li class="pagination-number">第 1 页 共 3 页</li>
</ul>
</div>
</section>
<footer id="footer" class="main-content-wrap">
<span class="copyrights">
© 2019 cicirori. All Rights Reserved
</span>
</footer>
</div>
</div>
<div id="about">
<div id="about-card">
<div id="about-btn-close">
<i class="fa fa-remove"></i>
</div>
<img id="about-card-picture" src="https://www.gravatar.com/avatar/ae723617c5cb9abcd2b4505a2ffdd322?s=110" alt="作者的图片" />
<h4 id="about-card-name">cicirori</h4>
<div id="about-card-bio">九级激光莲座巫师</div>
<div id="about-card-job">
<i class="fa fa-briefcase"></i>
<br/>
Master Student
</div>
<div id="about-card-location">
<i class="fa fa-map-marker"></i>
<br/>
Beijing
</div>
</div>
</div>
<div id="algolia-search-modal" class="modal-container">
<div class="modal">
<div class="modal-header">
<span class="close-button"><i class="fa fa-close"></i></span>
<a href="https://algolia.com" target="_blank" rel="noopener" class="searchby-algolia text-color-light link-unstyled">
<span class="searchby-algolia-text text-color-light text-small">by</span>
<img class="searchby-algolia-logo" src="https://www.algolia.com/static_assets/images/press/downloads/algolia-light.svg">
</a>
<i class="search-icon fa fa-search"></i>
<form id="algolia-search-form">
<input type="text" id="algolia-search-input" name="search"
class="form-control input--large search-input" placeholder="搜索" />
</form>
</div>
<div class="modal-body">
<div class="no-result text-color-light text-center"></div>
<div class="results">
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/05/%E6%AF%8F%E4%B8%AA%E7%A8%8B%E5%BA%8F%E5%91%98%E9%83%BD%E8%AF%A5%E7%9F%A5%E9%81%93%E7%9A%84%E6%95%B0%E5%AD%97-%E5%A6%82%E6%9E%9C-cpu-%E9%A2%91%E7%8E%87%E5%8F%98%E6%88%90-1-hz/">
<h3 class="media-heading">每个程序员都该知道的数字 -- 如果 CPU 频率变成 1 Hz</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
May 5, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><blockquote>
<p>译自图片:<a href="https://imgur.com/8LIwV4C">https://imgur.com/8LIwV4C</a></p>
</blockquote></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/%E8%99%9A%E6%8B%9F%E5%8C%96%E6%96%B9%E6%B3%95%E5%AF%B9%E6%AF%94/">
<h3 class="media-heading">虚拟化方法对比</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Mar 3, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<p>虽然经常和 KVM 打交道, 但是对 KVM 的印象仅限于 kvm.ko 和 kvm-intel.ko 这两个 kernel module 和 VMExit 指令还有 QEMU 和 virt-manager. 对 KVM, OpenVZ 和 Xen 区别的了解也仅限于, OpenVZ 容易超售, KVM 能跑 BBR, Xen么… 好像不怎么常见.</p>
<p>今天大概了解了一下三种虚拟化的实现方式, 真的是大吃一惊, 没有想到看起来最老旧的, 选购 VPS 的时候避而远之的OpenVZ, 居然和当下火热的 Docker 一样都是基于 Linux 的container 机制, 瞬间有种失敬的感觉.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/mod-%E8%BF%90%E7%AE%97%E6%80%BB%E7%BB%93/">
<h3 class="media-heading">Mod 运算总结</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Mar 3, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<p>做一场笔试题的时候 case 只 pass 了 90%, 反复检查算法应该没有错, 但是题目要求对1000000007取余, 最后结果是<code>( a * 2^n) % 1000000007</code>, 我直觉是<code>(a * (2^n % 1000000007) ) % 1000000007 != ( a * 2^n) % 1000000007</code>的, 但是改了一下 pass 了. 做完和同学交流被告知<code>(a * (b % c) ) % c = (a * b) % c</code>, 讲道理这个抽代学过的(同学说他们高中就学过 :) 但是现在忘了, shame on me, 正好最近看了一下负数参与模运算的一些规则, 就想总结一下.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/%E5%8F%98%E9%87%8F%E5%88%9D%E5%A7%8B%E5%8C%96/">
<h3 class="media-heading">变量初始化</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Mar 3, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<h1 id="初始化">初始化</h1>
<p>总结一下, 就是非局部变量和线程局部变量先进行常量初始化, 没有的话进行零初始化. 分别发生在 main 执行前和 线程函数执行前.</p>
<p>非局部变量, 进行默认初始化, 除了非POD会调用默认构造函数, 和数组递归默认初始化一下元素, 其他的都是 do nothing, 结果上来看就是变量值是随机的.</p>
<p>另外构造函数列表初始化的时候, 初始化顺序和列表顺序无关, 处在同一个类内的变量和定义顺序有关, 处在不同类中的变量先基类.</p>
<p>另外, const变量必须在构造函数初始化列表中初始化. static 成员变量必须在类外初始化.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/03/%E5%8F%B3%E5%80%BC%E5%BC%95%E7%94%A8%E5%92%8Cstdmove/">
<h3 class="media-heading">右值引用和std::move</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Mar 3, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<h1 id="移动语义">移动语义</h1>
<p>移动语义也是比较直觉的概念, 我们常见复制构造函数和复制赋值函数, 但是很多时候资源是独享的, 比如 I/O, 或者资源需要传递而不是复制. 这时候我们就需要工具, 实现使用源对象的资源来新建一个对象. 右值引用和 std::move 因此被引入.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/%E8%AF%BB%E5%A6%82%E4%BD%95%E9%AB%98%E6%95%88%E5%AD%A6%E4%B9%A0/">
<h3 class="media-heading">读「如何高效学习」</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Feb 2, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<h1 id="作者">作者</h1>
<blockquote>
<p> 斯科特·扬(Scott Young)1988年出生在加拿大,从高中开始放学后就几乎不学习,尽管如此,他还是以全班第二名的成绩毕业;读大学时,他每天学习一般不超过2个小时,但他的平均成绩保持在A以上;从加拿大马尼托巴大学商科毕业后,他用了一年时间,通过互联网完成了麻省理工学院计算机专业本科四年33门课程,节省了约合人民币150万元的大学学费,还登上了TED的讲台分享经验。</p>
<p> 这还不是最酷的。斯科特·扬还曾花一年时间去了4个国家,学习了4门外语,用30天学习肖像画。</p>
</blockquote>
<p>作者斯科特杨的履历着实吸引人,直接让我有了读「如何高效学习」这本书的欲望。总结一下看下来的感觉,其实类比、比喻这种方法我有一段是非常厌恶,特别是有人用它来论证自己的观点时,只要出现类比的手法,逻辑链条直接断掉,让人直接没了想进一步交流的兴趣。对这一方法的绝对排斥,可能是我既对唯理论深信不疑,又难以摆脱经验论影响的产生的虚无主义救赎,简而言之就是哲学理论太初级。后来读康德,解决了我很多疑惑,而斯科特杨的获取、理解、拓展、纠错和应用正好和康德对自然立法的理念相似,当然省略了绝大多数的细节,这也是一个理论想要得到合适的应用性而不得不妥协的。</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/%E5%AE%9E%E7%8E%B0%E6%99%BA%E8%83%BD%E6%8C%87%E9%92%88/">
<h3 class="media-heading">实现智能指针</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Feb 2, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<h1 id="思路">思路</h1>
<p>核心是引用计数, 使用一个自定义的类来保存和管理引用计数. 需要实现指针类型的赋值构造函数, 拷贝构造函数, 析构函数, <code>=,*,-></code>运算符, 为了管理不同的类型, 使用模板技术.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/%E5%8A%A8%E6%80%81%E5%86%85%E5%AD%98raii%E5%92%8C%E6%99%BA%E8%83%BD%E6%8C%87%E9%92%88/">
<h3 class="media-heading">动态内存、RAII和智能指针</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Feb 2, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<h1 id="动态内存">动态内存</h1>
<p>除了静态内存和栈(stack), 程序还拥有一个内存池, 被称为动态内存或者堆(heap). 由程序在运行时进行动态的管理.</p>
<p>C++ 使用 new/delete 运算符进行动态内存上的对象管理. 使用 new/delete 直接对动态内存进行管理存在如下问题:</p>
<ul>
<li>忘记 delete 导致内存泄露.</li>
<li>使用已经释放的对象, 通过释放后将指针置空有时可以检测出这种错误.</li>
<li>同一块内存释放两次. 内存进行释放的时候会被归还给自由区域. 多次释放会破坏自由空间.</li>
</ul></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/i/o%E6%A8%A1%E5%9E%8B%E6%80%BB%E7%BB%93/">
<h3 class="media-heading">I/O模型总结</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Feb 2, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><!--toc-->
<h1 id="概览">概览</h1>
<p>最直觉的 I/O 模型是, 一个进程在同一时刻对一个文件描述符进行 I/O 操作, 每个 I/O 系统调用阻塞直至数据传输完成. 但是这种简单的阻塞式的 I/O 模型在很多场景下并不适用.</p>
<ul>
<li>尽可能不阻塞地检查一个文件描述符是能进行 I/O.</li>
<li>监视多个文件描述符.</li>
</ul>
<p>于是乎, 就有了本文要讨论的这三种模型 :</p>
<ul>
<li>I/O 多路复用 (select() 以及 poll() 系统调用)</li>
<li>信号驱动 I/O</li>
<li>Linux 特有的 epoll() API</li>
</ul>
<p>这三种方式实际上都是为了实现同一个目标, 同时检查多个文件描述符, 查看他们是否准备好了执行 I/O 操作. 这里的准备好, 实际上指的是在这个文件描述符上执行的 I/O 是非阻塞的(包括返回错误), 因为模型只是对文件描述符检查, 而不进行数据传输.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
<div class="media">
<div class="media-body">
<a class="link-unstyled" href="https://cicirori.github.io/2019/02/makefile%E8%A6%81%E7%82%B9%E6%80%BB%E7%BB%93%E4%B8%8B/">
<h3 class="media-heading">Makefile要点总结(下)</h3>
</a>
<span class="media-meta">
<span class="media-date text-small">
Feb 2, 2019
</span>
</span>
<div class="media-content hide-xs font-merryweather"><blockquote>
<p>本文来自阅读 “跟我一起写 Makefile” 一书时的摘抄, 有省略或者不明白的地方请参考原书.</p>
</blockquote>
<!--toc-->
<h1 id="使用条件判断">使用条件判断</h1>
<h2 id="示例">示例</h2>
<pre><code class="language-makefile">libs_for_gcc = -lgnu
normal_libs =
foo: $(objects)
ifeq ($(CC),gcc)
$(CC) -o foo $(objects) $(libs_for_gcc)
else
$(CC) -o foo $(objects) $(normal_libs)
endif
</code></pre>
<p>根据 $(CC) 是不是 gcc 来决定要使用的库.</p></div>
</div>
<div style="clear:both;"></div>
<hr>
</div>
</div>
</div>
<div class="modal-footer">
<p class="results-count text-medium"
data-message-zero=""
data-message-one=""
data-message-other="">
20 posts found
</p>
</div>
</div>
</div>
<div id="cover" style="background-image:url('https://cicirori.github.io/images/cover.jpg');"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.7/js/jquery.fancybox.min.js" integrity="sha256-GEAnjcTqVP+vBp3SSc8bEDQqvWAZMiHyUSIorrWwH50=" crossorigin="anonymous"></script>
<script src="https://cicirori.github.io/js/script-qi9wbxp2ya2j6p7wx1i6tgavftewndznf4v0hy2gvivk1rxgc3lm7njqb6bz.min.js"></script>