-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2943 lines (1152 loc) · 71.7 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 class="theme-next gemini use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
<!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css">
<script src="/lib/pace/pace.min.js?v=1.0.2"></script>
<link rel="stylesheet" href="/lib/pace/pace-theme-bounce.min.css?v=1.0.2">
<link rel="stylesheet" href="/lib/Han/dist/han.min.css?v=3.3">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">
<link rel="stylesheet" href="/css/main.css?v=7.0.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.0.0">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.0.0">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.0.0">
<link rel="mask-icon" href="/images/logo.svg?v=7.0.0" color="#222">
<script id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Gemini',
version: '7.0.0',
sidebar: {"position":"left","width":300,"display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
fancybox: false,
fastclick: false,
lazyload: true,
tabs: true,
motion: {"enable":true,"async":true,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<meta name="description" content="远方与诗的存在">
<meta property="og:type" content="website">
<meta property="og:title" content="西西词">
<meta property="og:url" content="http://xixici.com/index.html">
<meta property="og:site_name" content="西西词">
<meta property="og:description" content="远方与诗的存在">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="西西词">
<meta name="twitter:description" content="远方与诗的存在">
<link rel="canonical" href="http://xixici.com/">
<script id="page.configurations">
CONFIG.page = {
sidebar: "",
};
</script>
<title>西西词 – 诗在远方</title>
<noscript>
<style>
.use-motion .motion-element,
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-title { opacity: initial; }
.use-motion .logo,
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">
<!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">西西词</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<h1 class="site-subtitle" itemprop="description">诗在远方</h1>
</div>
<div class="site-nav-toggle">
<button aria-label="切换导航栏">
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home menu-item-active">
<a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">22</span></a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">7</span></a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">41</span></a>
</li>
<li class="menu-item menu-item-search">
<a href="javascript:;" class="popup-trigger">
<i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
</li>
</ul>
<div class="site-search">
<div class="popup search-popup local-search-popup">
<div class="local-search-header clearfix">
<span class="search-icon">
<i class="fa fa-search"></i>
</span>
<span class="popup-btn-close">
<i class="fa fa-times-circle"></i>
</span>
<div class="local-search-input-wrapper">
<input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
</div>
</div>
<div id="local-search-result"></div>
</div>
</div>
</nav>
</div>
</header>
<a href="https://github.com/xixici" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewbox="0 0 250 250" style="fill: #222; color: #fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://xixici.com/2019/12/27/设计模式面试问答-2/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="博主">
<meta itemprop="description" content="远方与诗的存在">
<meta itemprop="image" content="/uploads/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="西西词">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2019/12/27/设计模式面试问答-2/" class="post-title-link" itemprop="url">设计模式面试问答-2</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2019-12-27 10:17:14 / 修改时间:10:24:51" itemprop="dateCreated datePublished" datetime="2019-12-27T10:17:14+08:00">2019-12-27</time>
</span>
</div>
</header>
<div class="post-body han-init-context" itemprop="articleBody">
<p><a href="https://cloud.githubusercontent.com/assets/11269635/23065273/1b7e5938-f515-11e6-8dd3-d0d58de6bb9a.png" target="_blank" rel="noopener"><img src="https://cloud.githubusercontent.com/assets/11269635/23065273/1b7e5938-f515-11e6-8dd3-d0d58de6bb9a.png" alt="Design Patterns For Humans"></a></p>
<hr>
<p>🎉 Ultra-simplified explanation to design patterns! 🎉</p>
<p>超简化的设计模式解释</p>
<p>A topic that can easily make anyone’s mind wobble. Here I try to make them stick in to your mind (and maybe mine) by explaining them in the <em>simplest</em> way possible.</p>
<p>这个话题很容易让任何人心神不宁。 在这里,我试图用尽可能简单的方式来解释它们,让它们牢牢地印在你(或者我)的脑海里。</p>
<hr>
<p>Check out my <a href="http://kamranahmed.info/" target="_blank" rel="noopener">blog</a> and say “hi” on <a href="https://twitter.com/kamranahmedse" target="_blank" rel="noopener">Twitter</a>.</p>
<p>看看我的博客,在推特上打个招呼。</p>
<h1 id="Introduction-引言"><a href="#Introduction-引言" class="headerlink" title="Introduction 引言"></a>Introduction 引言</h1><p>Design patterns are solutions to recurring problems; <strong>guidelines on how to tackle certain problems</strong>. They are not classes, packages or libraries that you can plug into your application and wait for the magic to happen. These are, rather, guidelines on how to tackle certain problems in certain situations.</p>
<p>设计模式是对反复出现的问题的解决方案; 是处理某些问题的指导方针。 它们不是类、包或库,您可以将它们插入到应用程序中,然后等待奇迹发生。 相反,这些是在某些情况下如何处理某些问题的指导方针。</p>
<blockquote>
<p>Design patterns are solutions to recurring problems; guidelines on how to tackle certain problems</p>
<p>设计模式是对反复出现的问题的解决方案; 是处理某些问题的指导方针</p>
</blockquote>
<p>Wikipedia describes them as</p>
<p>维基百科将其描述为</p>
<blockquote>
<p>In software engineering, a software design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine code. It is a description or template for how to solve a problem that can be used in many different situations.</p>
<p>在软件工程中,软件设计模式是针对软件设计中在给定上下文中经常出现的问题的一种通用的可重用解决方案。 它不是一个可以直接转换成源代码或机器代码的成品设计。 它是一个描述或模板,用于说明如何解决一个问题,这个问题可以用于许多不同的情况。</p>
</blockquote>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2019/12/27/设计模式面试问答-2/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://xixici.com/2019/12/27/设计模式面试问答-1/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="博主">
<meta itemprop="description" content="远方与诗的存在">
<meta itemprop="image" content="/uploads/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="西西词">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2019/12/27/设计模式面试问答-1/" class="post-title-link" itemprop="url">设计模式面试问答-1</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2019-12-27 10:10:45 / 修改时间:10:24:44" itemprop="dateCreated datePublished" datetime="2019-12-27T10:10:45+08:00">2019-12-27</time>
</span>
</div>
</header>
<div class="post-body han-init-context" itemprop="articleBody">
<h1 id="Design-Pattern-Interview-Questions"><a href="#Design-Pattern-Interview-Questions" class="headerlink" title="Design Pattern - Interview Questions"></a>Design Pattern - Interview Questions</h1><h1 id="设计模式-面试问题"><a href="#设计模式-面试问题" class="headerlink" title="设计模式-面试问题"></a>设计模式-面试问题</h1><hr>
<p><a href="https://www.tutorialspoint.com/design_pattern/design_pattern_questions_answers.htm" target="_blank" rel="noopener">https://www.tutorialspoint.com/design_pattern/design_pattern_questions_answers.htm</a>)</p>
<p>Dear readers, these <strong>Design Pattern Interview Questions</strong> have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of <strong>Design Pattern</strong>. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer:</p>
<p>亲爱的读者,这些设计模式面试问题是专门为了让你熟悉的性质,你可能会遇到的问题,在你的面试的主题设计模式。 根据我的经验,好的面试官在面试过程中几乎不会问任何特定的问题,通常问题都是从主题的一些基本概念开始,然后根据进一步的讨论和你的回答继续下去:</p>
<p>What are Design Patterns? 什么是设计模式?</p>
<p>Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time.</p>
<p>设计模式代表了经验丰富的面向对象软件开发人员使用的最佳实践。 设计模式是软件开发人员在软件开发过程中面临的一般问题的解决方案。 这些解决方案是由许多软件开发人员在相当长的一段时间内通过尝试和错误获得的。</p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2019/12/27/设计模式面试问答-1/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://xixici.com/2019/12/17/Linux面试常见30问答/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="博主">
<meta itemprop="description" content="远方与诗的存在">
<meta itemprop="image" content="/uploads/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="西西词">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2019/12/17/Linux面试常见30问答/" class="post-title-link" itemprop="url">Linux面试常见30问答</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2019-12-17 17:19:11" itemprop="dateCreated datePublished" datetime="2019-12-17T17:19:11+08:00">2019-12-17</time>
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">更新于</span>
<time title="修改时间:2019-12-18 10:00:49" itemprop="dateModified" datetime="2019-12-18T10:00:49+08:00">2019-12-18</time>
</span>
</div>
</header>
<div class="post-body han-init-context" itemprop="articleBody">
<h1 id="30-Linux-Questions-One-Should-Know-for-Interview"><a href="#30-Linux-Questions-One-Should-Know-for-Interview" class="headerlink" title="30 Linux Questions One Should Know for Interview"></a>30 Linux Questions One Should Know for Interview</h1><h1 id="面试时应该知道的30个-Linux-问题"><a href="#面试时应该知道的30个-Linux-问题" class="headerlink" title="面试时应该知道的30个 Linux 问题"></a>面试时应该知道的30个 Linux 问题</h1><p><a href="https://www.techbeamers.com/linux-tutorials/" target="_blank" rel="noopener">Linux Tutorials 教程</a> | By Meenakshi Agarwal 米纳克什 · 阿加瓦尔</p>
<p>Greetings! Today, we are listing down <strong>thirty essential Linux questions</strong> every beginner should know. It’s our attempt to unravel the core Linux areas so that even a beginner can feel a bit confident during a faceoff in a Linux interview.</p>
<p>你好! 今天,我们列出了三十个每个 Linux 初学者都应该知道的基本问题。 我们试图揭开 Linux 核心领域的面纱,这样即使是一个初学者也可以在面对面的 Linux 采访中感受到一点自信。</p>
<p>For some of us, since our college times, learning Linux has been a nightmare. But now is the time when you can’t ignore it anymore. It’s one of the areas where most IT companies look for candidates with solid Linux skills. Also, you may have a dozen of interviews lined up, so you are already short of time.</p>
<p>对于我们中的一些人来说,从大学时代开始,学习 Linux 就像是一场噩梦。 但是现在是你不能再忽视它的时候了。 这是大多数 It 公司寻找具有扎实 Linux 技能的候选人的领域之一。 此外,你可能有一打的面试排队,所以你已经很短的时间。</p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2019/12/17/Linux面试常见30问答/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://xixici.com/2019/12/17/Docker面试常见50问答-2/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="博主">
<meta itemprop="description" content="远方与诗的存在">
<meta itemprop="image" content="/uploads/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="西西词">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2019/12/17/Docker面试常见50问答-2/" class="post-title-link" itemprop="url">Docker面试常见50问答-2</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2019-12-17 15:30:05 / 修改时间:15:31:17" itemprop="dateCreated datePublished" datetime="2019-12-17T15:30:05+08:00">2019-12-17</time>
</span>
</div>
</header>
<div class="post-body han-init-context" itemprop="articleBody">
<h2 id="问:Docker-和-传统的虚拟机有什么差别?"><a href="#问:Docker-和-传统的虚拟机有什么差别?" class="headerlink" title="问:Docker 和 传统的虚拟机有什么差别?"></a>问:Docker 和 传统的虚拟机有什么差别?</h2><p><strong>答:</strong> 我们知道inux系统将自身划分为两部分,一部分为核心软件,也称作内核空间(<code>kernel</code>),另一部分为普通应用程序,这部分称为用户空间(<code>userland</code>)。<br>容器内的进程是直接运行于宿主内核的,这点和宿主进程一致,只是容器的 <code>userland</code> 不同,容器的 <code>userland</code> 由容器镜像提供,也就是说镜像提供了 <code>rootfs</code>。<br>假设宿主是 <code>Ubuntu</code>,容器是 <code>CentOS</code>。<code>CentOS</code> 容器中的进程会直接向 <code>Ubuntu</code> 宿主内核发送 <code>syscall</code>,而不会直接或间接的使用任何 <code>Ubuntu</code> 的 <code>userland</code> 的库。<br>这点和虚拟机有本质的不同,虚拟机是虚拟环境,在现有系统上虚拟一套物理设备,然后在虚拟环境内运行一个虚拟环境的操作系统内核,在内核之上再跑完整系统,并在里面调用进程。<br>还以上面的例子去考虑,虚拟机中,<code>CentOS</code> 的进程发送 <code>syscall</code> 内核调用,该请求会被虚拟机内的 <code>CentOS</code> 的内核接到,然后 <code>CentOS</code> 内核访问虚拟硬件时,由虚拟机的服务软件截获,并使用宿主系统,也就是 <code>Ubuntu</code> 的内核及 <code>userland</code> 的库去执行。<br>而且,Linux 和 Windows 在这点上非常不同。Linux 的进程是直接发 <code>syscall</code> 的,而 Windows 则把 <code>syscall</code> 隐藏于一层层的 <code>DLL</code> 服务之后,因此 Windows 的任何一个进程如果要执行,不仅仅需要 Windows 内核,还需要一群服务来支撑,所以如果 Windows 要实现类似的机制,容器内将不会像 Linux 这样轻量级,而是非常臃肿。看一下微软移植的 Docker 就非常清楚了。<br>所以不要把 Docker 和虚拟机弄混,Docker 容器只是一个进程而已,只不过利用镜像提供的 <code>rootfs</code> 提供了调用所需的 <code>userland</code> 库支持,使得进程可以在受控环境下运行而已,它并没有虚拟出一个机器出来。</p>
<p><strong>Linux 容器不是模拟一个完整的操作系统,而是对进程进行隔离。</strong></p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2019/12/17/Docker面试常见50问答-2/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>