aboutsummaryrefslogtreecommitdiff
path: root/en_US.ISO8859-1/captions/2006/mckusick-kernelinternals/mckusick-kernelinternals-1.sbv
blob: 7f564d1d3338f0df9fee8683267013ed7095478f (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
0:00:09.469,0:00:11.309
Hello my name is Marshall Kirk McKusick

0:00:11.309,0:00:15.389
and I've been around as long as dinosaurs
and mainframes have ruled the world

0:00:15.389,0:00:18.429
which is to say the sixties and seventies

0:00:18.429,0:00:22.460
however by 1970s a new breed of mammals had began to show up on
the scene,

0:00:22.460,0:00:24.240
known as mini computers

0:00:24.240,0:00:28.230
although they were just toys in the 1970s they would soon grow

0:00:28.230,0:00:31.689
and take over most of the computing market

0:00:31.689,0:00:33.150
In 1970 

0:00:33.150,0:00:37.910
at AT&T Bell laboratories two researchers Ken
Thompson and Dennis Ritchie began developing the

0:00:37.910,0:00:39.900
UNIX operating system

0:00:39.900,0:00:42.040
Ken Thompson who had been an alumnus at Berkeley

0:00:42.040,0:00:46.100
came back on a sabbotical in 1975 bringing UNIX
with him

0:00:46.100,0:00:47.539
In the he was there

0:00:47.539,0:00:51.330
he managed to get a number of graduate students interested
in UNIX

0:00:51.330,0:00:53.940
and by the time he left in 1976


0:00:53.940,0:00:56.829
Bill Joy has taken over in running the UNIX system

0:00:56.829,0:01:00.470
and in fact continuing to develop software for it.

0:01:00.470,0:01:04.339
Bill began packaging up the software that have
been developed under Berkeley UNIX and

0:01:04.339,0:01:05.779
and distributing it

0:01:05.779,0:01:08.040
as the Berkeley Software Distribution

0:01:08.040,0:01:12.310
whose name was quickly shortened to simply BSD

0:01:12.310,0:01:16.330
BSD continued to be distributed with
yearly distribution for almost fifteen

0:01:16.330,0:01:17.490
years

0:01:17.490,0:01:21.920
initially under Bill Joy and later under others including
yours truly.

0:01:21.920,0:01:24.860
By the late 1980s interest had began to grow

0:01:24.860,0:01:27.400
in freely redistributable software

0:01:27.400,0:01:30.170
so a number of us at Berkeley began separating
out

0:01:30.170,0:01:32.649
the AT&T proprietary bits of BSD 

0:01:32.649,0:01:35.710
from those parts that were freely redistributable.

0:01:35.710,0:01:40.590
By the time of the final distribution at BSD
in 1992

0:01:40.590,0:01:43.620
the entire distribution was freely redistributable.

0:01:43.620,0:01:45.909
I live in a capsule history here

0:01:45.909,0:01:48.009
but if you're interested in the entire story

0:01:48.009,0:01:50.789
I have this three-and-an-half hour epic

0:01:50.789,0:01:54.590
which is available from my website www.mckusick.com 

0:01:54.590,0:01:58.200
that gives the entire history of Berkeley.

0:01:58.200,0:02:00.239
Following the final distribution from Berkeley

0:02:00.239,0:02:01.450
two groups sprung up

0:02:01.450,0:02:03.600
to continue supporting BSD

0:02:03.600,0:02:08.080
the first of this is the NetBSD whose primary
goal was to support

0:02:08.080,0:02:10.459
as many different architectures as possible

0:02:10.459,0:02:14.769
everything from your microwave oven all way
upto your cray XMP

0:02:14.769,0:02:19.409
In fact today NetBSD supports nearly
sixty architectures.

0:02:19.409,0:02:22.419
The other group that sprang up was FreeBSD.

0:02:22.419,0:02:28.239
Their goal was to bring up BSD and support
as wide set of devices as possible on the

0:02:28.239,0:02:29.719
PC architecture.

0:02:29.719,0:02:36.549
They also had a goal of trying to make the
the system as easy to install as possible to 

0:02:36.549,0:02:39.309
attract by a wide group of developers

0:02:39.309,0:02:42.319
I chose to primarily work with the FreeBSD
group

0:02:42.319,0:02:43.740
both doing software

0:02:43.740,0:02:46.140
and also together with George Neville

0:02:46.140,0:02:51.069
writing this book ""The Design and Implementation
of the FreeBSD Operating System"".

0:02:51.069,0:02:52.060
Together with this book

0:02:52.060,0:02:53.959
I developed a course

0:02:53.959,0:02:56.500
which runs for twelve chapters

0:02:56.500,0:02:58.179
and thirty hours.

0:02:58.179,0:02:59.749
The purpose of this video

0:02:59.749,0:03:01.089
is to give you a taste

0:03:01.089,0:03:02.819
of that course.

0:03:02.819,0:03:07.249
What follows are excerpts from the first lecture
of the course

0:03:07.249,0:03:11.139
which of course you can also get from my website
www.mckusick.com.

0:03:11.139,0:03:13.069


0:03:13.069,0:03:17.739
Enjoy.

0:03:17.739,0:03:22.239
This class is nominally about FreeBSD
because well

0:03:22.239,0:03:26.379
that's what I know best and that's what
the textbook is organized around

0:03:26.379,0:03:29.979
but the fact that the matter is back it's really

0:03:29.979,0:03:32.339
a class about your UNIX and that

0:03:32.339,0:03:36.539
really covers sort of the broad range of things
in the open source arena as its FreeBSD

0:03:36.539,0:03:37.689
in Linux

0:03:37.689,0:03:38.899
which of course

0:03:38.899,0:03:41.159
you use a lot out

0:03:41.159,0:03:41.550
and

0:03:41.550,0:03:44.349
it also covers a commercial systems

0:03:44.349,0:03:46.950
%uh Solaris, HP-UX,

0:03:46.950,0:03:49.279
AIX and so on.

0:03:49.279,0:03:52.419
I am going to tend more towards the open
side

0:03:52.419,0:03:56.389
open source side of things.So it's really
going to be more FreeBSD in Linux than it's

0:03:56.389,0:03:57.579
going to be

0:03:57.579,0:04:00.849
Solaris and HP-UX and so on.

0:04:00.849,0:04:06.959
For the most part at the level of this course
we're dealing with the interfaces to the system

0:04:06.959,0:04:07.329
and

0:04:07.329,0:04:11.599
the fact that the matter is a those interfaces are highly
standardized at this point

0:04:11.599,0:04:12.060
and

0:04:12.060,0:04:15.280
whether it's FreeBSD or Linux or Solaris
or whatever

0:04:15.280,0:04:19.460
the Socket system call has to do the same
thing, it has to have the same arguments

0:04:19.460,0:04:20.150
in that,

0:04:20.150,0:04:23.909
it has to have the same effect

0:04:23.909,0:04:27.319
and so until you get down to the really niddy 
details

0:04:27.319,0:04:29.600
of how they actually go about implementing
that

0:04:29.600,0:04:31.960
the differences are relatively minor.

0:04:31.960,0:04:35.830
So I would say that sixty to seventy percent
of the material that I'm covering

0:04:35.830,0:04:40.779
is just as true for FreeBSD as it would
be for Linux

0:04:40.779,0:04:42.580
or for Solaris

0:04:42.580,0:04:44.659
%uh AIX is a little bit

0:04:44.659,0:04:45.629
sort of off in the weeds

0:04:45.629,0:04:48.709
%uh as is HP-UX

0:04:48.709,0:04:51.099
but luckily we don't have to worry too much about
that.

0:04:51.099,0:04:54.569
Okay so

0:04:54.569,0:04:59.279
the other thing is I'm going to assume that
all of you have used the system. I get

0:04:59.279,0:05:00.910
really sort of worried when people

0:05:00.910,0:05:04.249
you know raise the hands and ""Hey, what's a Shell?""

0:05:04.249,0:05:07.990
or I don't 
put a lot of code up but a small piece of code and someone said ""Why

0:05:07.990,0:05:11.819
are there two pipe symbols in the middle of
that that If statement?"".

0:05:11.819,0:05:15.740
No we're not programming the Shell we're programming
in C.

0:05:15.740,0:05:19.970
So hopefully you can tell the difference between
Shell scripts and C code.

0:05:19.970,0:05:21.990
okay but I am but am gonna assume

0:05:21.990,0:05:24.610
you haven't really looked inside the system.

0:05:24.610,0:05:28.289
So I gonna start everything to at a very
high level.

0:05:28.289,0:05:32.969
The problem is I have already discovered you come
from a lot of different sort of

0:05:32.969,0:05:33.819
backgrounds

0:05:33.819,0:05:35.180
and 

0:05:35.180,0:05:36.280
levels of knowledge

0:05:36.280,0:05:37.900
and so

0:05:37.900,0:05:42.620
the way that I find works best the sort of
be useful to everybody is that three pass

0:05:42.620,0:05:43.860
algorithm

0:05:43.860,0:05:49.060
so what I will do is start the first pass a very
broad brush high level

0:05:49.060,0:05:50.569
description of what's going on

0:05:50.569,0:05:54.719
and then I will go back and i'll go through the
same material again but at a lower level of

0:05:54.719,0:05:55.300
detail

0:05:55.300,0:05:59.939
then i finally go back and go through a very neatly
low-level of detail

0:05:59.939,0:06:04.649
and the fact that is if you are learning new stuff
as I'm doing the high-level thing

0:06:04.649,0:06:08.649
you are gonna be utterly washed by the time I get to
low level nearly details

0:06:08.649,0:06:10.699
but since I'm going to do it topic by topic

0:06:10.699,0:06:14.190
when I get to the end of one of those nearly
low level details

0:06:14.190,0:06:17.900
i'll give you a clue as i will say ""Brain
reset, I'm starting a new topic"" so even if

0:06:17.900,0:06:19.330
you're completely lost

0:06:19.330,0:06:23.530
you can now start listening again plus am gonna get
the broad brush up again.

0:06:23.530,0:06:27.059
okay and for those of you that know a lot of
this stuff already

0:06:27.059,0:06:31.770
you'll probably find the broad brush rather boring

0:06:31.770,0:06:35.759
but by the time i get down nearly low level
details I think you'll actually

0:06:35.759,0:06:37.860
pick up some things that you will find

0:06:37.860,0:06:39.710
useful and interesting.

0:06:39.710,0:06:43.759
So in this way hopefully everybody will
get some

0:06:43.759,0:06:47.699
useful percentage of material out of the course.

0:06:47.699,0:06:49.599
I am gonna start out by just

0:06:49.599,0:06:53.089
walking through and giving you the

0:06:53.089,0:06:56.919
outline of what we're going to try and do
here

0:06:56.919,0:07:01.169
As i said we're going to go roughly

0:07:01.169,0:07:03.270
about two-and-an-half hours of lecture

0:07:03.270,0:07:04.729
about two hours forty minutes

0:07:04.729,0:07:06.499
per week

0:07:06.499,0:07:07.619
and

0:07:07.619,0:07:11.770
so we will start off this week with an introduction.

0:07:11.770,0:07:13.860
This is as I said we're going to start from the
top

0:07:13.860,0:07:15.749
and just start working our way down

0:07:15.749,0:07:19.350
so the general thing I'm going to do is
to talk about the interface

0:07:19.350,0:07:21.439
%uh which is something that you

0:07:21.439,0:07:25.319
are presumably fairly familiar with since
you've worked with that system

0:07:25.319,0:07:27.249
and then

0:07:27.249,0:07:29.739
sort of layout terminology

0:07:29.739,0:07:32.080
although we use normal english words

0:07:32.080,0:07:34.419
they have

0:07:34.419,0:07:38.580
sometimes rather bizarre meanings compared to their
common usage

0:07:38.580,0:07:39.220
and

0:07:39.220,0:07:42.330
I will just sort of lay out the terminology
lay out the

0:07:42.330,0:07:45.750
the way we talk about how the system is structured

0:07:45.750,0:07:50.780
and this week we will also talk about the
basic services ""What is it that the kernel is

0:07:50.780,0:07:52.929
providing for us?""

0:07:52.929,0:07:54.060
and then of course

0:07:54.060,0:07:58.499
we'll proceed to dive down in and and see how
that is done

0:07:58.499,0:07:59.970
so here in

0:07:59.970,0:08:01.400
Week 2

0:08:01.400,0:08:05.450
%uh we're gonna look at the system from the
perspective of 

0:08:05.450,0:08:07.039
something that

0:08:07.039,0:08:08.720
manages processes.

0:08:08.720,0:08:12.170
One way of looking at the kernel it's really
just a

0:08:12.170,0:08:16.440
the resource manager and the resource that
is managing are things going to do with processes

0:08:16.440,0:08:19.460
So we'll look at a process, what the structure of
it is

0:08:19.460,0:08:20.649
%uh and

0:08:20.649,0:08:23.559
talk about the different ways that they can
be structured.

0:08:23.559,0:08:28.379
Process can for example be an address space
and can have one thread running in it can have

0:08:28.379,0:08:29.749
multiple threads running in it.

0:08:29.749,0:08:34.620
we'll talk about the different ways
that we think a process is.

0:08:34.620,0:08:38.480
We will look at the management of those processes


0:08:38.480,0:08:39.239
we've got

0:08:39.239,0:08:42.020
to lay out the bits and pieces that
need to be managed

0:08:42.020,0:08:44.660
%uh and then talk about

0:08:44.660,0:08:47.190
how we do that.

0:08:47.190,0:08:51.740
we'll talk about jails.. this is something
that you currently find only in FreeBSD

0:08:51.740,0:08:55.060
hasn't made it into

0:08:55.060,0:08:56.320
Linux yet although

0:08:56.320,0:09:01.630
%uh the concept is %uh being actively worked
on so my guess is that you'll see that

0:09:01.630,0:09:03.500
%uh fairly soon.

0:09:03.500,0:09:06.360
%uh will also then talk about scheduling

0:09:06.360,0:09:10.579
which is in essence how we decide what gets
to run, when it gets to run, how long it takes

0:09:10.579,0:09:13.500
to run, etc.

0:09:13.500,0:09:14.330
okay

0:09:14.330,0:09:19.020
The week after that we will go into virtual
memory.

0:09:19.020,0:09:23.800
Signals aren't really part of virtual memory 
but they didn't fit into next week's

0:09:23.800,0:09:26.400
material so I just would drop that at the
beginning

0:09:26.400,0:09:29.850
but the bulk of Week 3 is going to
be

0:09:29.850,0:09:32.019
the management of Virtual Memory. So we've got

0:09:32.019,0:09:35.119
a bunch of physical memory, a bunch of
processes that are

0:09:35.119,0:09:37.940
trying to use their address spaces

0:09:37.940,0:09:39.590
and we will talk about

0:09:39.590,0:09:41.410
essentially how you will make all that work

0:09:41.410,0:09:43.510
It's called a virtual memory because it's

0:09:43.510,0:09:47.420
sort of a cheat. We promise you the world and
then we deliver you 

0:09:47.420,0:09:51.480
as small number of pages as we think we
can get away with.

0:09:51.480,0:09:56.420
Okay. So the first three weeks then essentially
get us through

0:09:56.420,0:09:58.340
looking at the world as if it was all

0:09:58.340,0:10:00.560
all about processes

0:10:00.560,0:10:03.880
and in Week 4 we change gears. we say
okay well you know

0:10:03.880,0:10:07.570
the kernel isn't just about processes. You can sort of look at it orthogonally
and you can

0:10:07.570,0:10:10.000
say it's really just a giant I/O switch

0:10:10.000,0:10:12.910
it's just like a traffic cop that's just managing
these

0:10:12.910,0:10:14.860
I/O streams

0:10:14.860,0:10:15.450
and

0:10:15.450,0:10:18.610
so let's look at it from that perspective.

0:10:18.610,0:10:19.310
And

0:10:19.310,0:10:24.740
%uh we'll start with special files, again this
where the interface when you talk about UNIX

0:10:24.740,0:10:25.880
systems, when you talk about

0:10:25.880,0:10:27.950
what's normally /dev

0:10:27.950,0:10:34.170
interface that gets you access
to the various I/O streams that are available

0:10:34.170,0:10:37.220
and we'll look at how that's organized and
the structure of it

0:10:37.220,0:10:41.840
%uh which is to be fairly simple but in the
last decade has gotten

0:10:41.840,0:10:43.670
incredibly complicated.

0:10:43.670,0:10:48.540
We will also talk about sudo terminals in
job control

0:10:48.540,0:10:53.330
this is about as interesting as watching the
grass grow but unfortunately it's

0:10:53.330,0:10:55.490
a major component of the system

0:10:55.490,0:10:59.520
and especially people that deal with system
administration have to know far more about

0:10:59.520,0:11:06.520
this than they probably ever thought they
wanted to.

0:11:06.900,0:11:11.430
Okay we will then continue in Week 5 with
the kernel I/O structure,

0:11:11.430,0:11:16.090
%uh We will start with multiplexing of I/O. The
kernel has done this

0:11:16.090,0:11:17.360
always

0:11:17.360,0:11:22.110
but we will really talking more about how do
we export I/O multiplexing to

0:11:22.110,0:11:25.970
user applications.

0:11:25.970,0:11:29.250
We will then move into auto configuration strategy

0:11:29.250,0:11:31.370
Auto configuration

0:11:31.370,0:11:32.770
is what happens

0:11:32.770,0:11:36.619
and typically or historically I guess you
could say as the system boots.

0:11:36.619,0:11:39.500
so all that stuff that comes out about

0:11:39.500,0:11:40.810
what

0:11:40.810,0:11:43.550
hardwares are on the machine and how it's all
interconnected

0:11:43.550,0:11:47.350
all of that is tied up in auto configuration

0:11:47.350,0:11:50.040
and that used to happen just once it boots

0:11:50.040,0:11:52.000
but in modern systems today

0:11:52.000,0:11:55.839
it's an ongoing process. It happens at boot
but it also happens

0:11:55.839,0:12:00.550
anytime you plug a new I/O device, a
PCMCIA card,

0:12:00.550,0:12:03.680
you remove a disk or you put in a new disk.

0:12:03.680,0:12:07.010
Any sort of activity that changes the the I/O

0:12:07.010,0:12:08.360
structure of the machine

0:12:08.360,0:12:10.870
auto configuration has to fired back up

0:12:10.870,0:12:13.050
and figure out what's disappeared

0:12:13.050,0:12:18.330
and cleanup and figure out what new has arrived
to conongiure it in.

0:12:18.330,0:12:19.320
and then we'll talk

0:12:19.320,0:12:23.870
a little bit about the configuration of the
device driver

0:12:23.870,0:12:27.390
this actually gets into an area of that 

0:12:27.390,0:12:28.660
is

0:12:28.660,0:12:33.440
one well let me just give it as a bit
of advice to the class esspecially those of

0:12:33.440,0:12:36.780
you who work in system administration.

0:12:36.780,0:12:42.010
You'd really want to be careful that
you don't learn too much about device drivers

0:12:42.010,0:12:44.670
because there is really these three things that 

0:12:44.670,0:12:48.580
it's not good to learn about and if you do
learn about it it's really good to keep it

0:12:48.580,0:12:49.740
to yourself

0:12:49.740,0:12:51.949
because if you become an expert or

0:12:51.949,0:12:54.960
viewed as an expert in any of these areas

0:12:54.960,0:12:59.370
you will become the designated stocky for
that and your psyche you'll never get to do

0:12:59.370,0:13:01.760
anything

0:13:01.760,0:13:02.610
but that

0:13:02.610,0:13:07.360
The three things that I highly
recommend not learning very much about are

0:13:07.360,0:13:09.060
device drivers,

0:13:09.060,0:13:12.320
send mail configuration files

0:13:12.320,0:13:13.970
or anything having to do

0:13:13.970,0:13:19.350
with LDAP or anything in
that general domain

0:13:19.350,0:13:22.660
%uh because as I say 

0:13:22.660,0:13:24.900
that will become your life's work

0:13:24.900,0:13:25.920
and

0:13:25.920,0:13:32.920
there's other things that you might find more interesting.
""Do you have a question?""

0:13:33.870,0:13:36.659
so one of my students empathized with my point

0:13:36.659,0:13:39.640
I believe you said you worked on that mail
system

0:13:39.640,0:13:43.120
%uh so you you might know something about
Sum mail configuration files but you don't

0:13:43.120,0:13:47.850
have to answer that

0:13:47.850,0:13:52.100
so we're going to talk about what a device
driver does and really just the entry

0:13:52.100,0:13:53.170
points to it

0:13:53.170,0:13:57.180
but we're not going to talk about how you
write such a thing, how you debug such a thing

0:13:57.180,0:14:01.490
or much of anything about it. I actually used
to teach an entire class believe it or not

0:14:01.490,0:14:02.720
about the device drivers

0:14:02.720,0:14:05.849
%uh but then I realized a year i waste
since

0:14:05.849,0:14:12.580
i gone through and made a point of forgetting
every slide in that talk.

0:14:12.580,0:14:16.860
so then we will move on to Filesystem

0:14:16.860,0:14:21.540
and as always will start at the high level
talk about the interface what is it that is

0:14:21.540,0:14:23.020
exported out of the system

0:14:23.020,0:14:27.840
%uh and then we will start diving down in sea and
how do we go about implementing that

0:14:27.840,0:14:29.010
%uh so

0:14:29.010,0:14:31.010
we'll start with that

0:14:31.010,0:14:32.560
so called 

0:14:32.560,0:14:33.680
Block I/O system

0:14:33.680,0:14:36.140
it's historically been called buffer
cache

0:14:36.140,0:14:38.590
and it's still recalled that periodically

0:14:38.590,0:14:42.720
and the fact that the matter is that there isn't really
about buffer cache anymore,thers is just one big

0:14:42.720,0:14:44.620
cache in it.Its the VM cache

0:14:44.620,0:14:47.810
and the Filesystem has a view into it
and

0:14:47.810,0:14:50.829
the processes have a view into it but at
the end of the day

0:14:50.829,0:14:54.660
you really don't want the same information
on two different

0:14:54.660,0:14:56.030
pages of memory

0:14:56.030,0:14:59.390
because that just leads to trouble.

0:14:59.390,0:15:03.390
But Filesystems think that they have buffers and so
there's been a year where we make

0:15:03.390,0:15:06.149
these things that look like what historically
were buffers

0:15:06.149,0:15:08.830
that really just happened just really map into VM system

0:15:08.830,0:15:11.720
but they're still managed in the way that
they have been

0:15:11.720,0:15:15.020
managed historically

0:15:15.020,0:15:20.670
We will then get down into Filesystem implementation
the local file system if you will

0:15:20.670,0:15:23.400
and into also

0:15:23.400,0:15:25.730
soft updates and snapshots.

0:15:25.730,0:15:26.440
on this

0:15:26.440,0:15:31.100
for the time being is something that you see
only in FreeBSD

0:15:31.100,0:15:35.310
the alternative to soft updates is journalling
which is %uh more commonly used 

0:15:35.310,0:15:39.630
for example what is used by ext3

0:15:39.630,0:15:41.179
so i'll go through soft updates and

0:15:41.179,0:15:45.260
a lot of the issues in soft updates are the
same issues that you have to deal with journalling

0:15:45.260,0:15:48.370
what is it that we're protecting and how we
go about doing that

0:15:48.370,0:15:51.150
and the differences is in the detail.

0:15:51.150,0:15:54.630
There is actually a paper in the back to your
notes if this is something that interests

0:15:54.630,0:15:55.240
you

0:15:55.240,0:15:59.930
%uh it's a comparison of journalling versus 
soft updates that was done

0:15:59.930,0:16:02.120
about five or eight years ago.

0:16:02.120,0:16:08.460
and not to spoil the punch line but the answers
they both work about are the same

0:16:08.460,0:16:12.500
Okay the snapshots again is something that
if

0:16:12.500,0:16:15.920
you've worked with things like the network
appilance box you're probably quite

0:16:15.920,0:16:19.640
aware of what snapshots are and how they do
or don't work for you

0:16:19.640,0:16:21.959
this is this the same functionality

0:16:21.959,0:16:27.380
%uh in the Filesystem implemented in a
somewhat different way

0:16:27.380,0:16:28.449
%uh so this

0:16:28.449,0:16:31.940
that Week 6 is really going to be the local
file system

0:16:31.940,0:16:34.750
the disk connected to the machine you work.

0:16:34.750,0:16:39.140
Week 7 then we get into multiple 
Filesystem support so how do we abstract out that

0:16:39.140,0:16:41.190
Filesystem layer

0:16:41.190,0:16:46.430
and support Multiple Filesystems at the
same time so for example in FreeBSD

0:16:46.430,0:16:50.199
you can of course run with their traditional
fast Filesystem

0:16:50.199,0:16:54.540
but if you happen to like the Linux Filesystem 
better or you have to share a disk

0:16:54.540,0:16:55.690
with a Linux machine

0:16:55.690,0:16:58.310
you can run the ext2 or ext3

0:16:58.310,0:17:01.020
%uh and it will perfectly happily do that

0:17:01.020,0:17:01.620
so

0:17:01.620,0:17:05.589
we will have to look then at how do we provide
interface so that we can plug in all these different

0:17:05.589,0:17:09.260
Filesystems that we want to support

0:17:09.260,0:17:12.250
another area of which there's been a great

0:17:12.250,0:17:15.309
deal of growth at least in coding complexity


0:17:15.309,0:17:17.840
is so-called Volume Management

0:17:17.840,0:17:19.370
%uh so in the

0:17:19.370,0:17:24.480
good old days a Filesystem lived on a disk or
piece of disk and that was that

0:17:24.480,0:17:26.130
but this day and age 

0:17:26.130,0:17:31.150
that won't do any more so we aggregate disks
together by striping them or RAID 

0:17:31.150,0:17:31.980
arraying them

0:17:31.980,0:17:33.380
and we need such really things

0:17:33.380,0:17:39.210
and we need a whole layer in the system just to
manage those disks

0:17:39.210,0:17:44.280
we'll then get to the as an example of an alternative
Filesystem we're going to talk about the

0:17:44.280,0:17:46.530
Network Filesystem or NFS

0:17:46.530,0:17:48.500
but that's not because this is

0:17:48.500,0:17:51.090
the world's best remote file system

0:17:51.090,0:17:55.240
or the cleanest design or any of the thing
properties you might hope that

0:17:55.240,0:17:57.049
such a class is this one would have

0:17:57.049,0:17:58.600
but it's ubiquitous

0:17:58.600,0:18:00.210
very widely used

0:18:00.210,0:18:01.350
and

0:18:01.350,0:18:06.850
we're going to talk about that one

0:18:06.850,0:18:07.740
we'll

0:18:07.740,0:18:10.970
then once again switch gears on Week 8

0:18:10.970,0:18:17.120
and turn our attention to of Networking and
Interprocess communication

0:18:17.120,0:18:18.200
and

0:18:18.200,0:18:23.210
again we'll start from the very top so we'll
go through, we'll go with concepts, the terminology

0:18:23.210,0:18:24.450
that gets used

0:18:24.450,0:18:30.230
and what's difference between domain
based addressing and an address domain you know

0:18:30.230,0:18:30.910
we'll go through

0:18:30.910,0:18:34.910
well what the basic IPC services are,

0:18:34.910,0:18:39.080
essentially what all the system calls that
has anything to do with networking

0:18:39.080,0:18:40.590
and

0:18:40.590,0:18:43.720
just sort of describe what each of them are
and I'm going to go through

0:18:43.720,0:18:45.830
a somewhat contrived example

0:18:45.830,0:18:49.840
it makes use of every one of those interfaces

0:18:49.840,0:18:52.860
and just to show how they all conected
together

0:18:52.860,0:18:54.169
and for those of you that work

0:18:54.169,0:18:57.400
in networking or had done any kind of network
programming

0:18:57.400,0:19:00.480
if you're looking for a week to miss and this
Week 8 is the one to miss that's 'cause that's

0:19:00.480,0:19:02.780
the sort of most basic

0:19:02.780,0:19:04.210
lecture that I'm going to give

0:19:04.210,0:19:07.910
If you are not sure whether or not you need to
go through that, there is

0:19:07.910,0:19:09.540
one of the papers in the back

0:19:09.540,0:19:12.620
it is an introduction to Interprocess communication

0:19:12.620,0:19:18.279
%uh read that paper if you say yeah yeah yeah
yeah yeah you are done with Week 8.

0:19:18.279,0:19:20.590
on the other hand if you dont come to Week
8

0:19:20.590,0:19:22.790
and then in Week 9 I say

0:19:22.790,0:19:26.860
I call on you and say alright what is it

0:19:26.860,0:19:30.560
that listen system call does and you
can't tell me

0:19:30.560,0:19:32.610
you're gonna get a demerit

0:19:32.610,0:19:34.340
okay

0:19:34.340,0:19:37.770
then in Week 9 we will get into the actual 

0:19:37.770,0:19:41.419
networking implementation itself, we go
through system layers as we did

0:19:41.419,0:19:43.310
in all the other areas

0:19:43.310,0:19:44.130
and

0:19:44.130,0:19:48.330
we will spend a significant portion of that
class talking about routing

0:19:48.330,0:19:50.230
%uh routing

0:19:50.230,0:19:53.610
for those of you that haven't had the pleasure
of dealing with it

0:19:53.610,0:19:55.540
is a black heart

0:19:55.540,0:19:58.050
or at least a dark science

0:19:58.050,0:19:59.170
and

0:19:59.170,0:19:59.930
so

0:19:59.930,0:20:02.490
we'll talk about it

0:20:02.490,0:20:06.270
from the perspective first of all to what
do we do locally within the machine

0:20:06.270,0:20:10.090
and then what are some of the bigger strategies
that we can use for doing routing

0:20:10.090,0:20:11.910
%uh enterprise 

0:20:11.910,0:20:14.840
wide routing or

0:20:14.840,0:20:20.190
area wide routing some like throughout the
state of California or throughout US whatever

0:20:20.190,0:20:25.379
this again like device drivers is really
just sort of a nickel 

0:20:25.379,0:20:26.480
%uh throught the dark

0:20:26.480,0:20:27.800

0:20:27.800,0:20:31.820
what what the choices are what that the basic
strategies are that are used

0:20:31.820,0:20:33.989
If you're thinking you're going to walk out
of here

0:20:33.989,0:20:36.110
knowing how to set up a routing well sorry

0:20:36.110,0:20:38.430
we are not going to get that far

0:20:38.430,0:20:41.559
but you should at least have a pretty good idea
of what the issues are

0:20:41.559,0:20:44.430
and what the general solutions are

0:20:44.430,0:20:48.950
then finally in Week 10 well not finally
but next few weeks and

0:20:48.950,0:20:52.380
we will go through the Internet Protocols

0:20:52.380,0:20:54.320
primarily TCP/IP

0:20:54.320,0:20:56.560
and this is

0:20:56.560,0:20:58.809
what are the algorithms that are used

0:20:58.809,0:21:01.030
and I'm putting a particular emphasis

0:21:01.030,0:21:03.050
for this particular class

0:21:03.050,0:21:05.080
on

0:21:05.080,0:21:07.730
changes that have been made in the protocols

0:21:07.730,0:21:14.310
to deal with a lot of attacks that
we've been seeing SYN attacks and

0:21:14.310,0:21:16.880
that sort of thing

0:21:16.880,0:21:19.440
rather than just a straight

0:21:19.440,0:21:22.440
iteration of what the the actual protocols
are

0:21:22.440,0:21:24.940
i'll talk primarily about IPv4

0:21:24.940,0:21:31.940
%uh but I will also try and talk a bit about
IPv6 as well

0:21:33.510,0:21:35.850
so the first ten weeks are

0:21:35.850,0:21:38.100
sort of kernel course

0:21:38.100,0:21:40.800
now back with two weeks on at the end

0:21:40.800,0:21:42.010
to talk about

0:21:42.010,0:21:43.990
through the bigger picture of

0:21:43.990,0:21:48.240
System Tuning,Crash dump analysis that level of
thing

0:21:48.240,0:21:52.940
The idea is really to consolidate what
we figured out or talked about in the first

0:21:52.940,0:21:54.710
ten weeks and

0:21:54.710,0:21:58.760
how that applies to tools that are available
to us to

0:21:58.760,0:22:00.760
look at what the system is doing,

0:22:00.760,0:22:02.649
to analyze what the system is doing

0:22:02.649,0:22:03.650
and hopefully

0:22:03.650,0:22:04.720
improves

0:22:04.720,0:22:07.130
the performance of what the system is doing

0:22:07.130,0:22:07.750
and

0:22:07.750,0:22:12.169
for the most part the kind of tuning I'm
talking about is not

0:22:12.169,0:22:14.740
going in and hack hack hacking your kernel 

0:22:14.740,0:22:16.510
because the fact that the matter is

0:22:16.510,0:22:18.600
you can't do that anyway

0:22:18.600,0:22:22.340
%uh so it's more looking at it from the perspective
of saying

0:22:22.340,0:22:26.390
is this system running badly because it doesn't
have enough memory on it?

0:22:26.390,0:22:29.470
or is it running badly because there isn't enough
I/O capacity?

0:22:29.470,0:22:33.549
or is it running badly because the it's got
enough I/O capacity but

0:22:33.549,0:22:35.940
certain drives are being overloaded

0:22:35.940,0:22:37.309
or is it

0:22:37.309,0:22:42.220
being overrun because we're simply trying
to do too much on this machine?,etc.

0:22:42.220,0:22:45.440
so that's the sort of level of thing that we're
looking at it

0:22:45.440,0:22:47.080
but tied into

0:22:47.080,0:22:52.130
lot of concepts that we talked before so we can talk
about active virtual memory

0:22:52.130,0:22:53.710
and what that means

0:22:53.710,0:22:55.120
and

0:22:55.120,0:22:58.750
essentially measure what it is and hopefully
then you will understand the context of what

0:22:58.750,0:23:00.690
we talked about in the VM section

0:23:00.690,0:23:03.990
what that really means

0:23:03.990,0:23:07.460
the Crash dump analysis is is one of these
topics that

0:23:07.460,0:23:08.730
you are gonna love or hate

0:23:08.730,0:23:12.530
%uh you actually have to deal with crashed
dumps

0:23:12.530,0:23:13.679
its people find it invaluable

0:23:13.679,0:23:15.580
and if you don't have to deal with Crash dumps

0:23:15.580,0:23:18.790
it's an incredible mass of boring detail

0:23:18.790,0:23:23.240
the only good part of it is that that's the
whole session is only about an hour or long

0:23:23.240,0:23:25.529
If it interests you, listen closely

0:23:25.529,0:23:28.950
and if it bores you, well, its only an hour long

0:23:28.950,0:23:32.880
okay up lastly we'll talk a little bit about
security issues

0:23:32.880,0:23:36.250
again this is really more of the tools that
are available

0:23:36.250,0:23:40.750
to deal with security staff as opposed to a
complete tutorial on

0:23:40.750,0:23:45.120
how to implement security so those of you
that deal with security

0:23:45.120,0:23:48.400
it's just gonna to be sort of security one on
one

0:23:48.400,0:23:50.029
%uh for those of you

0:23:50.029,0:23:51.500
that have but

0:23:51.500,0:23:54.399
you'll have to deal with it but haven't really
thought about it

0:23:54.399,0:23:58.549
%uh it'll probably scare you to death and
you wonder have to keep the machines from

0:23:58.549,0:24:02.840
being hijacked everyday

0:24:02.840,0:24:08.030
Okay that's in essence what we're going
to try and do here

0:24:08.030,0:24:15.030
anybody have any comments, questions, thoughts.
Alright, no, well.

0:24:16.130,0:24:17.840
Let's get started

0:24:17.840,0:24:22.180
we will be begin on page fifteen with an
overview of the kernel.

0:24:22.180,0:24:26.040
Hopefully nobody's lost yet.

0:24:26.040,0:24:29.310
What's a kernel? Alright.

0:24:29.310,0:24:31.370
so starting at the very top

0:24:31.370,0:24:33.070
the big broad brush

0:24:33.070,0:24:35.140
what we have is

0:24:35.140,0:24:38.330
a UNIX virtual machine and

0:24:38.330,0:24:41.660
and virtual machines are actually something
that has been around

0:24:41.660,0:24:44.539
as a concept since the sixties

0:24:44.539,0:24:48.919
the diffrence is really just sort of the level
of the interface that people have dealt with

0:24:48.919,0:24:51.360
when they talk about Virtual Machines

0:24:51.360,0:24:53.610
in the 1960s

0:24:53.610,0:24:56.770
computers were these enormous things you would
have

0:24:56.770,0:24:58.870
your computer room would be something that be

0:24:58.870,0:25:01.909
three times the size of this conference
room if you had

0:25:01.909,0:25:03.230
a computer

0:25:03.230,0:25:05.530
the computer itself was this

0:25:05.530,0:25:07.840
tall as a refrigerator freezer

0:25:07.840,0:25:08.950
imagine

0:25:08.950,0:25:13.909
five or eight or ten of these units
side by side that itself made up the computer

0:25:13.909,0:25:16.080
that would be one 

0:25:16.080,0:25:20.030
for the core processor and the one which
should be the floating point unit and several

0:25:20.030,0:25:24.080
of them that would be the memory the core
literally 

0:25:24.080,0:25:29.110
%uh and then they'd be other rows of these
disk drives about the size of a washing

0:25:29.110,0:25:29.660
machine

0:25:29.660,0:25:34.169
%then behind that since you couldn't store
everything on disk so

0:25:34.169,0:25:36.300
that you had rows of tape drives

0:25:36.300,0:25:37.880
and then you had this little

0:25:37.880,0:25:39.610
set of sort of

0:25:39.610,0:25:43.330
munchkins that would run around and and tend
to the machine and they mount tapes and take

0:25:43.330,0:25:46.710
off tapes and mount disc packs and remove disc packs 
because 

0:25:46.710,0:25:49.760
the drives themselves were very expensive and
so

0:25:49.760,0:25:53.110
you wouldn't just as today we have a 


0:25:53.110,0:25:56.090
one spindle that was dedicated just to one set
of platters

0:25:56.090,0:25:57.130
you could take out a 

0:25:57.130,0:25:59.460
set of platters and put in another

0:25:59.460,0:26:02.540
hundred megabytes of platters and these are
platters that are

0:26:02.540,0:26:05.280
this big around and it's like six or eight
of them and

0:26:05.280,0:26:09.140
a giant head assemblies they comes rumbling in and
out

0:26:09.140,0:26:12.440
anyway one of these giant giant machines

0:26:12.440,0:26:17.380
that costs many millions of dollars would run 
at about ten

0:26:17.380,0:26:21.120
million instructions per second, 10 mips

0:26:21.120,0:26:21.630
and 10 mips

0:26:21.630,0:26:28.330
that's was more computing power than anybody
could possibly imagine using in a single application

0:26:28.330,0:26:28.880
just

0:26:28.880,0:26:31.050
by contrast this this

0:26:31.050,0:26:34.070
four-year-old laptop here is probably on
the order of

0:26:34.070,0:26:36.440
one or two hundred mips

0:26:36.440,0:26:37.140
but anyway

0:26:37.140,0:26:40.760
people couldn't really view what we would
do with a lot of computing power

0:26:40.760,0:26:44.640
and the other thing was that you didn't have
a notion of sort of operating system that had

0:26:44.640,0:26:45.890
applications running on it

0:26:45.890,0:26:46.760
because

0:26:46.760,0:26:50.160
everybody wanted to write straight to
the raw hardware

0:26:50.160,0:26:51.750
and so

0:26:51.750,0:26:55.900
IBM who was a big manufacturer
of machines in those days

0:26:55.900,0:26:59.060
did what they came up with this thing called
the VM

0:26:59.060,0:27:00.770
and this was a little

0:27:00.770,0:27:02.549
you'd call an operating system really

0:27:02.549,0:27:05.130
but what it did is a cloned

0:27:05.130,0:27:09.270
independent copies of the machine worked just
like the original machines you could boot

0:27:09.270,0:27:11.769
something that thought it was an operating
system

0:27:11.769,0:27:13.380
on top of VM

0:27:13.380,0:27:16.750
so you take one least ten that machines and
it would clone

0:27:16.750,0:27:20.050
six identical one mip copies

0:27:20.050,0:27:22.030
%uh and then you could boot

0:27:22.030,0:27:24.700
whatever you wanted on each one of those machines
so

0:27:24.700,0:27:29.510
if you were doing database that you do your
database because database cannot run on the raw hardware

0:27:29.510,0:27:32.920
or if you're doing payroll who would boot up the payroll
program

0:27:32.920,0:27:37.950
%uh or if you actually tried to service the
users you could boot a time sharing batch thing

0:27:37.950,0:27:40.790
that would read card images and print
stuff out

0:27:40.790,0:27:44.460
or they even had TSO the Time Sharing
Option where you could interactively sit

0:27:44.460,0:27:45.559
and type send

0:27:45.559,0:27:47.560
stuffs in and get answers back

0:27:47.560,0:27:48.570
%uh and

0:27:48.570,0:27:51.429
%uh also you could boot TSO so whatever set
of

0:27:51.429,0:27:52.219
%um

0:27:52.219,0:27:55.339
things you need you could boot them and they ran
independently as if they were running on their

0:27:55.339,0:27:56.470
own machine

0:27:56.470,0:28:03.150
but all the VM did was it give you an exact
raw copy of the hardware

0:28:03.150,0:28:04.529
so when UNIX came along

0:28:04.529,0:28:07.350
they sort of like the notion of

0:28:07.350,0:28:11.509
providing the concept of independent
things that you could operate in

0:28:11.509,0:28:13.610
but they wanted it at a higher level

0:28:13.610,0:28:15.610
so you're looking merely to do that

0:28:15.610,0:28:17.480
instead of at the raw hardware level

0:28:17.480,0:28:19.679
to do it at a process well

0:28:19.679,0:28:23.799
and the idea that then was that the interface you
would program to would be what we think of as

0:28:23.799,0:28:26.090
a System call interface today

0:28:26.090,0:28:27.849
and the idea then was that

0:28:27.849,0:28:30.740
you would be given a process or set of processes

0:28:30.740,0:28:34.990
and those were independent your process
couldn't affect

0:28:34.990,0:28:38.830
the address space of another process reach
over and mess around with the addresses,

0:28:38.830,0:28:41.030
you couldn't mess around with their I/O
channels

0:28:41.030,0:28:43.179
%uh you could slow them down by

0:28:43.179,0:28:44.299
being a pig but

0:28:44.299,0:28:47.980
that was about the only way that you could affect
other processes

0:28:47.980,0:28:48.480
and

0:28:48.480,0:28:49.830
%uh so

0:28:49.830,0:28:52.669
what the interfaces that they had there

0:28:52.669,0:28:58.660
with one that had these characteristics
he had a a paged virtual address space

0:28:58.660,0:29:02.980
so you din't have to know as in the old days how much physical
memory is on the machine and make your application

0:29:02.980,0:29:04.740
fit into that amount of memory

0:29:04.740,0:29:07.950
you just had what looked like a large

0:29:07.950,0:29:11.710
uniform address space even if the underlying
hardware had segments or some other

0:29:11.710,0:29:13.580
hardware brain damage

0:29:13.580,0:29:17.390
it look to you like he just had a big uniform
address space and 

0:29:17.390,0:29:21.070
the size of the address space was independent
of the amount of memory that was on the machine

0:29:21.070,0:29:23.900
your address space could be bigger than amount of
physical memory

0:29:23.900,0:29:26.499
cause we got to move pages around underneath

0:29:26.499,0:29:29.320
whatever part address space was actually
active

0:29:29.320,0:29:34.260
that is obviously do this if you if
you are trying to run 1 gigabyte of

0:29:34.260,0:29:35.630
application on top of

0:29:35.630,0:29:37.240
ten megabytes of memory

0:29:37.240,0:29:40.880
it's probably going to bring new meaning to
same day service

0:29:40.880,0:29:45.519
but if you're willing to wait long enough it
will eventually move the pages around and you will

0:29:45.519,0:29:49.740
progress through getting your application run

0:29:49.740,0:29:53.890
anothe thing was dealing with software
interrupts

0:29:53.890,0:29:55.789
%uh in the old days

0:29:55.789,0:29:58.749
you had to understand how the hardware worked

0:29:58.749,0:30:03.900
in order to deal with exceptional conditions
so for example to did a divide by zero

0:30:03.900,0:30:08.170
the the hardware would have jumped to some
vector location or

0:30:08.170,0:30:08.630
something

0:30:08.630,0:30:12.799
and you had no khow how that worked and make
sure that you had your program

0:30:12.799,0:30:16.510
use just a little bit of assembly language which
set up to deal with that

0:30:16.510,0:30:19.870
and UNIX said let's let's get away
from the hardware here

0:30:19.870,0:30:22.080
and so they did this thing called signals

0:30:22.080,0:30:25.700
the answer is, the finest of the signals is that
if you do divide by zero

0:30:25.700,0:30:29.529
%uh you simply register a routine you
want to have called you don't have to know

0:30:29.529,0:30:31.220
how the hardware figured it out

0:30:31.220,0:30:36.740
you just know that that routine is going to get
called and you can deal with it at that point

0:30:36.740,0:30:40.960
well we got set of timers and counters to keep
track of what we're doing, this is really more

0:30:40.960,0:30:43.490
for counting than anything else but

0:30:43.490,0:30:46.970
applications may want to have access to that.

0:30:46.970,0:30:51.720
we have a set of identifiers that we're
going to use for things like accounting,

0:30:51.720,0:30:54.830
protection and scheduling and so on

0:30:54.830,0:30:55.820
and one of the

0:30:55.820,0:31:00.320
the early philosophies of UNIX was that to try
and keep it simple.

0:31:00.320,0:31:02.630
operating systems have gotten very baroque

0:31:02.630,0:31:04.490
in particular the thing that

0:31:04.490,0:31:07.350
pre dated UNIX was a thing called
Multix

0:31:07.350,0:31:12.820
%uh Multix was was a joint project between
Honeywell, a big computer manufacturer of the

0:31:12.820,0:31:15.740
time at

0:31:15.740,0:31:17.129
AT&T bell laboratories

0:31:17.129,0:31:19.750
the big industrial labratory at that time

0:31:19.750,0:31:21.380
and MIT

0:31:21.380,0:31:23.430
a big university then and

0:31:23.430,0:31:24.690
still today

0:31:24.690,0:31:29.259
%uh and that those three organizations got
together to try and build this 

0:31:29.259,0:31:31.400
time sharing operating system

0:31:31.400,0:31:32.280
and it

0:31:32.280,0:31:33.770
it just got bigger and

0:31:33.770,0:31:37.160
more grandiose and more complex and never
finished

0:31:37.160,0:31:38.979
but as soon as that's what we see

0:31:38.979,0:31:42.709
although we know how to do that but also we could
do this other thing too and so then the teared it

0:31:42.709,0:31:43.429
apart and

0:31:43.429,0:31:46.440
they never really got to something that

0:31:46.440,0:31:48.210
could be put into production

0:31:48.210,0:31:49.919
and so the

0:31:49.919,0:31:50.570
AT&T

0:31:50.570,0:31:54.340
Bell laboratories decided to pull out of
that project

0:31:54.340,0:31:55.940
and

0:31:55.940,0:32:00.000
the two of the people that had been working on
that project, Ken Thompson and Dennis Richie

0:32:00.000,0:32:04.390
%uh were sort of bound because they were now
back to typing cards and putting them through

0:32:04.390,0:32:05.259
card reader and

0:32:05.259,0:32:07.960
they are just used to the idea that you could
actually

0:32:07.960,0:32:11.559
sit at an ASSR teletype and interact
with your computer

0:32:11.559,0:32:13.440
and so

0:32:13.440,0:32:18.230
they found an old %uh PDP-8 soon off in
the quarter that have been abandoned

0:32:18.230,0:32:22.120
and started working on this little tiny operating
system which they called UNIX

0:32:22.120,0:32:26.549
%uh which eventually moved to the PDP-11 and
became what we have today

0:32:26.549,0:32:28.050
but because it was

0:32:28.050,0:32:32.120
they were coming first of all from Multix
where everything had been done and 

0:32:32.120,0:32:34.110
in great grandiose detail

0:32:34.110,0:32:37.549
and because they're fundamentally just two
the of them working on it and they wanted to get something

0:32:37.549,0:32:38.370
done and

0:32:38.370,0:32:40.130
within a year or so

0:32:40.130,0:32:41.529
one of their philosophies was

0:32:41.529,0:32:44.099
let's find out one way of doing things

0:32:44.099,0:32:48.180
let's not have eight ways from Sunday let's just
get the one way

0:32:48.180,0:32:53.860
and and that's what we will provide. So what is
the sort of core set of things that we need.

0:32:53.860,0:32:58.620
well first thing is when it comes to identifiers,
let's not have you know

0:32:58.620,0:33:00.430
eighty thousand different identifiers

0:33:00.430,0:33:03.140
so they came up with process identifiers,

0:33:03.140,0:33:09.620
user identifier and at that time a single group
identifier and later expanded

0:33:09.620,0:33:14.200
and they used that sort of identifies for everything
so its used for counting, used for main

0:33:14.200,0:33:17.410
protection decisions, used for scheduling
decisions

0:33:17.410,0:33:19.470
and

0:33:19.470,0:33:24.279
again it was the simplicity of thing which
was what was driving their decision

0:33:24.279,0:33:28.840
but they're really sort of true key idea 
that they had

0:33:28.840,0:33:30.880
that really made a difference that

0:33:30.880,0:33:32.539
that's were set them up side

0:33:32.539,0:33:34.749
from what everybody else done before them

0:33:34.749,0:33:35.450
and which

0:33:35.450,0:33:39.740
in retrospect is something that has been pervasive
more or less ever since

0:33:39.740,0:33:41.869
the first of these was the notion

0:33:41.869,0:33:44.840
that we have a unique descriptive space

0:33:44.840,0:33:46.289
%uh that is

0:33:46.289,0:33:51.250
given a descriptor it can reference
any I/O device

0:33:51.250,0:33:53.650
or even any kind of I/O channel

0:33:53.650,0:33:58.270
so you can have a descriptor for terminal
or descriptor for file or descriptive for

0:33:58.270,0:34:02.240
a disk or descriptor for pipe or descriptor
for a socket

0:34:02.240,0:34:03.500
and

0:34:03.500,0:34:04.790
you don't need to know

0:34:04.790,0:34:07.940
what it references in order to be able to read
and write on that thing

0:34:07.940,0:34:11.290
so if i hand you a descriptor 
can read from that the descriptor or you can write

0:34:11.290,0:34:13.259
to that descriptor

0:34:13.259,0:34:15.189
and

0:34:15.189,0:34:17.359
the correct thing will happen

0:34:17.359,0:34:19.089
and you'd say well

0:34:19.089,0:34:23.629
that's obvious I mean how else could you
possibly think about doing it

0:34:23.629,0:34:25.179
predating UNIX

0:34:25.179,0:34:28.059
everything was done with

0:34:28.059,0:34:29.379
a little subsystem

0:34:29.379,0:34:33.419
that would open a file, read a file, write a
file, close a file

0:34:33.419,0:34:37.429
and there was another set of system calls which
would open a terminal,read a terminal, write terminal

0:34:37.429,0:34:38.089
,close terminal

0:34:38.089,0:34:39.210
and yet another one

0:34:39.210,0:34:42.409
which was create a pipe,read a pipe,
write a pipe and so on.

0:34:42.409,0:34:47.699
so if you are just dropped at a stupid
program like CAD

0:34:47.699,0:34:51.579
you would have to have code in there and say was
my input a terminal which in case I need to

0:34:51.579,0:34:53.159
use the read terminal

0:34:53.159,0:34:57.419
or is it a file which in case i need
to use read file or is it a pipe in which in case

0:34:57.419,0:34:59.189
i need to use read pipe

0:34:59.189,0:35:01.860
and so the program itself had to have all
this

0:35:01.860,0:35:02.859
coding in it

0:35:02.859,0:35:04.409
whereas when they went to

0:35:04.409,0:35:07.159
the uniform descriptor space

0:35:07.159,0:35:09.630
CAD doesn't know and doesn't need to know
it just says

0:35:09.630,0:35:10.819
read my input,

0:35:10.819,0:35:13.979
write the output

0:35:13.979,0:35:17.059
it works and we add a new type of descriptor

0:35:17.059,0:35:17.600
and

0:35:17.600,0:35:21.700
CAD just continues to work just as it always
did.

0:35:21.700,0:35:24.199
So this proved to be a very powerful construct

0:35:24.199,0:35:27.019
and pretty much every operating system after
UNIX

0:35:27.019,0:35:28.659
did that and there's

0:35:28.659,0:35:30.210
one exception of %uh

0:35:30.210,0:35:32.549
large company in the Pacific North-West

0:35:32.549,0:35:35.830
that still has not quite uniform descriptor
space

0:35:35.830,0:35:38.380
but %uh that's part of their legacy that really

0:35:38.380,0:35:39.900
they're working on that.

0:35:39.900,0:35:42.009
Longhorn will be here.

0:35:42.009,0:35:43.939
and anyway 

0:35:43.939,0:35:46.190
this set of facilities 

0:35:46.190,0:35:50.150
makes up the UNIX virtual machine

0:35:50.150,0:35:51.559
and

0:35:51.559,0:35:55.559
in sometimes we still see virtual machines
being used today in fact we're seeing sort

0:35:55.559,0:35:56.749
of a reversion

0:35:56.749,0:36:01.429
%uh back to some of the ideas stop in things
like the VMware

0:36:01.429,0:36:03.079
which is

0:36:03.079,0:36:07.029
essentially allow you to go back to booting
native operating systems again so sort of

0:36:07.029,0:36:08.280
interesting to watch

0:36:08.280,0:36:09.060
that's the sort of

0:36:09.060,0:36:12.919
%uh %uh pendulum of back going back and forth
of what's the correct layer

0:36:12.919,0:36:14.609
for for doing

0:36:14.609,0:36:18.890
%uh virtual machines

0:36:18.890,0:36:22.499
Okay. so far so good.

0:36:22.499,0:36:24.719
all right i said there was 

0:36:24.719,0:36:27.160
two key ideas that UNIX had

0:36:27.160,0:36:30.279
the first thing is uniform descriptor
space

0:36:30.279,0:36:35.819
the second one which was really critical was
this notion of processes as a commodity 

0:36:35.819,0:36:37.309
item

0:36:37.309,0:36:40.220
so here on Page 17 I tried to lay
it out

0:36:40.220,0:36:41.090
the

0:36:41.090,0:36:44.159
that the components that make up a process

0:36:44.159,0:36:45.759
%uh and

0:36:45.759,0:36:50.359
what do I really mean when I say a process as
a commodity item

0:36:50.359,0:36:53.650
leading up to

0:36:53.650,0:36:54.689
UNIX

0:36:54.689,0:36:56.800
the systems that pre-dated it,

0:36:56.800,0:36:59.200
processes were these very large

0:36:59.200,0:37:02.169
heavyweight expensive thing

0:37:02.169,0:37:02.779
and

0:37:02.779,0:37:04.539
if you look at

0:37:04.539,0:37:08.629
MVS which was the operating system
that ran on IBM for doing multiple processing

0:37:08.629,0:37:10.509
and

0:37:10.509,0:37:13.799
the system administrator would decide at boot
time

0:37:13.799,0:37:17.019
what degree of multiprocessing they wish
to support

0:37:17.019,0:37:18.140
so they'd say well

0:37:18.140,0:37:20.739
well, let upto six things happen at once

0:37:20.739,0:37:22.490
and so as part of booting up

0:37:22.490,0:37:24.419
they would create six

0:37:24.419,0:37:25.349
processes

0:37:25.349,0:37:30.059
and now you as a user if you wanted to do
something let's say you wanted to

0:37:30.059,0:37:32.009
compile and ran a program

0:37:32.009,0:37:34.960
%uh you would be given a process

0:37:34.960,0:37:36.019
and it's up to you

0:37:36.019,0:37:39.369
to figure out how to stage what you needed
done

0:37:39.369,0:37:39.819
and

0:37:39.819,0:37:43.930
%uh that this was often fairly complex

0:37:43.930,0:37:47.880
and so you would have to write out all the
steps that you wanted

0:37:47.880,0:37:50.300
in this wonderful thing called JCL

0:37:50.300,0:37:52.259
Job Control Language and 

0:37:52.259,0:37:56.650
Job Control Language was send mail configuration
file of the sixties

0:37:56.650,0:38:00.679
other where people who sold job that the company
was how to put this stuff together 'cause

0:38:00.679,0:38:04.189
like to do is get what one extra space or
missing comma

0:38:04.189,0:38:05.000
something in their

0:38:05.000,0:38:08.630
and I hope it would just blow up it would
just sort of spit the card deck back at

0:38:08.630,0:38:09.799
you and say well

0:38:09.799,0:38:13.500
somewhere in there is a mistake that's sort of
the general area of this card

0:38:13.500,0:38:15.549
and I can't deal with it. Fix it.

0:38:15.549,0:38:16.489
and of course

0:38:16.489,0:38:20.550
in those days it wasn't just a matter of hitting
carriage when you know make cariage return you have to

0:38:20.550,0:38:25.239
get your deck pull out the card, and type the
new one, put it back in and re-submit it

0:38:25.239,0:38:28.729
As heaven forbid you couldnt touch that 
card reader you know, it had to be done by

0:38:28.729,0:38:29.970
an operator

0:38:29.970,0:38:32.869
so the card deck will read through it would
disappear and

0:38:32.869,0:38:36.800
you know if you're lucky a few minutes later
if you were not lucky a few hours later

0:38:36.800,0:38:37.849
you would get

0:38:37.849,0:38:39.570
a print print out

0:38:39.570,0:38:43.419
which was what it happened and then you could
look at it and you know

0:38:43.419,0:38:47.209
I put a comma in the wrong place I guess
I get to do it all again

0:38:47.209,0:38:49.930
so

0:38:49.930,0:38:54.940
if you would need to do something
like compiling and running a program

0:38:54.940,0:38:59.579
was you'd have to break into these steps. well
I need to run the the preprocessor

0:38:59.579,0:39:04.670
and so us clean out whatever gump that was left
over on that process from the previous user

0:39:04.670,0:39:06.240
put the preprocessor in there

0:39:06.240,0:39:10.530
%uh and then read from this file here let's
say gotta put it somewhere so creative

0:39:10.530,0:39:12.510
scratch file over on this disk and

0:39:12.510,0:39:17.299
it was excruciating detail like how many cylinders
and how many tracks and this and that

0:39:17.299,0:39:19.139
blocks blah blah blah

0:39:19.139,0:39:23.119
and don't forget any of those parameters 'cause
it'll spit it out if you do

0:39:23.119,0:39:26.890
and so then it would run the first step in that
if its successful then you'd have sitting

0:39:26.890,0:39:28.899
in this scratch file that you had created

0:39:28.899,0:39:33.100
the output of the preprocessor and then
you'd load the first pass of the compiler

0:39:33.100,0:39:36.930
and lets now read from that scratch file
and create this other scratch file over here and

0:39:36.930,0:39:39.450
when thats successful and we need to delete that
one

0:39:39.450,0:39:43.830
and then load the second pass, put that back
into another scratch file and then we run this

0:39:43.830,0:39:45.950
assembler, optimizer then the

0:39:45.950,0:39:47.750
loader this and that

0:39:47.750,0:39:49.410
finally run the program

0:39:49.410,0:39:50.900
and %uh if all goes well

0:39:50.900,0:39:57.029
you know at step sixteen out comes the answer

0:39:57.029,0:39:58.129
fourty two. so UNIX

0:39:58.129,0:40:00.819
said, look this is silly

0:40:00.819,0:40:02.880
a lot of this is just

0:40:02.880,0:40:04.310
bookkeeping

0:40:04.310,0:40:07.249
and computers do bookkeeping really well

0:40:07.249,0:40:12.179
and you'll recall yeah but it's going to take
all these cycles it's like

0:40:12.179,0:40:16.309
computers are supposed to be labor-saving
devices right so

0:40:16.309,0:40:20.150
they came up with this notion that they would
create processes on the fly as needed

0:40:20.150,0:40:21.159
you had

0:40:21.159,0:40:25.549
you've had a preprocessor in two
steps of the compiler and then

0:40:25.549,0:40:27.109
optimizer and then a loader

0:40:27.109,0:40:29.410
we just create Boom seven processes

0:40:29.410,0:40:31.920
and we connect them together with pipes

0:40:31.920,0:40:35.180
and so we take the input and you know run
through in

0:40:35.180,0:40:38.270
through the pipes and you know out the end
you get the the

0:40:38.270,0:40:39.629
executable

0:40:39.629,0:40:40.030
and

0:40:40.030,0:40:42.880
we simply create each of these processes

0:40:42.880,0:40:44.650
and

0:40:44.650,0:40:46.549
so you as a user just

0:40:46.549,0:40:49.479
type you know the C compiler just

0:40:49.479,0:40:52.429
fork these things pipe them together got the result

0:40:52.429,0:40:53.640
and

0:40:53.640,0:40:57.509
then once it was done with this processes is
just threw them away so any time you'd create a

0:40:57.509,0:41:00.479
new process and it came to you christine clean

0:41:00.479,0:41:04.239
and you needed a bunch of things it did 
put everything in intermediate files

0:41:04.239,0:41:07.549
the fact that matter is in the early days

0:41:07.549,0:41:08.129
those computers

0:41:08.129,0:41:11.910
didn't really have enough memory to support
all that stuff at once so

0:41:11.910,0:41:15.809
behind you those pipes were actually implemented
as files

0:41:15.809,0:41:19.319
you didn't have atleast to remember to create
them and delete them

0:41:19.319,0:41:20.200
and deal with them

0:41:20.200,0:41:24.020
as far as you're concerned it just look stuff flowing through pipes
and of course today it

0:41:24.020,0:41:24.490
just

0:41:24.490,0:41:27.989
does flow through pipes in memory

0:41:27.989,0:41:29.439
okay so

0:41:29.439,0:41:33.689
this notion then that that we're just gonna
create processes on the fly is needed and

0:41:33.689,0:41:35.559
connect them together as needed

0:41:35.559,0:41:38.039
and that was a novel concept

0:41:38.039,0:41:43.599
and it wasn't that somehow mysteriously figured
out how to create processes cheaply

0:41:43.599,0:41:44.839
cause they hadn't

0:41:44.839,0:41:46.180
they were still

0:41:46.180,0:41:49.959
really expensive to create

0:41:49.959,0:41:52.210
but that extra effort

0:41:52.210,0:41:53.029
was

0:41:53.029,0:41:56.089
worth it because it was saving a lot of programming
time

0:41:56.089,0:41:59.809
so my favorite example is you run ls

0:41:59.809,0:42:01.810
so we have to create a process

0:42:01.810,0:42:04.259
load the ls binary into it

0:42:04.259,0:42:06.180
and it prints a line or two on your screen

0:42:06.180,0:42:10.609
and we tear the entire thing down and return
all its resources back to the system

0:42:10.609,0:42:14.979
more than ninety percent of the cost of running
ls is creating and destroying the process

0:42:14.979,0:42:19.239
a tiny fraction of it is actually running
ls

0:42:19.239,0:42:24.259
it goes so fast, who cares right

0:42:24.259,0:42:25.749
the point is that

0:42:25.749,0:42:30.039
%uh that concept of just creating things as
needed

0:42:30.039,0:42:31.780
again was very powerful

0:42:31.780,0:42:35.709
and is one that is just pervasive today

0:42:35.709,0:42:38.639
okay so what is a process actually made up
of

0:42:38.639,0:42:43.179
%uh it gets some amount of CPU time or at
least we do really hope that it gets some

0:42:43.179,0:42:46.050
amount of CPU time, the lack of getting
CPU time

0:42:46.050,0:42:46.670
that makes it

0:42:46.670,0:42:47.979
a pure so sluggish

0:42:47.979,0:42:49.409
of course

0:42:49.409,0:42:51.920
others really boils down to scheduling

0:42:51.920,0:42:54.249
and we're going to talk about scheduling

0:42:54.249,0:42:56.279
probably more than you care to

0:42:56.279,0:42:59.219
in a couple weeks time

0:42:59.219,0:43:01.619
we have the asynchronous events

0:43:01.619,0:43:04.569
%uh these are the external events that

0:43:04.569,0:43:05.659
are coming in

0:43:05.659,0:43:07.679
%uh so

0:43:07.679,0:43:10.169
they may be either things that

0:43:10.169,0:43:14.339
we're coming in from the outside world like
start, stop and quit

0:43:14.339,0:43:15.279
%uh oh

0:43:15.279,0:43:18.170
out-of-band arrival notification that kind
of thing

0:43:18.170,0:43:22.339
or it may in fact be things that the program
is bringing down upon itself

0:43:22.339,0:43:25.590
on such as a segment fault,a divide by zero

0:43:25.590,0:43:26.910
and some other

0:43:26.910,0:43:31.959
what would normally be viewed as incorrect
operation

0:43:31.959,0:43:35.849
and so will talk about that when we talk about
signals

0:43:35.849,0:43:37.039
every program

0:43:37.039,0:43:38.899
get some amount of memory

0:43:38.899,0:43:42.659
it gets an initial amount when it starts
up injured generally allocates more as it

0:43:42.659,0:43:45.229
goes along

0:43:45.229,0:43:49.429
of course we will deal with up her extensively
will spend an entire week on it

0:43:49.429,0:43:54.249
when we talk about how virtual memory is implemented

0:43:54.249,0:43:54.609
and

0:43:54.609,0:43:57.429
%uh then we get I/O descriptors

0:43:57.429,0:44:02.259
I used to say that every program had to have
at least one I/O descriptor since

0:44:02.259,0:44:04.910
it absolutely had no input

0:44:04.910,0:44:06.329
absolutely no output

0:44:06.329,0:44:09.049
then it was sort of pointless

0:44:09.049,0:44:12.900
of course I had to have one of my students
come up and point out to me there is a

0:44:12.900,0:44:13.849
class of programs

0:44:13.849,0:44:16.469
which don't need I/O descriptors

0:44:16.469,0:44:17.440
and that is

0:44:17.440,0:44:19.549
these things called benchmarks

0:44:19.549,0:44:23.249
the just compute something all we really care
about is how long it takes them to compute

0:44:23.249,0:44:24.959
we dont actually care what the answer is

0:44:24.959,0:44:26.019
In theory we dont

0:44:26.019,0:44:29.779
I personally felt like my benchmark stop with
something so I can see it there

0:44:29.779,0:44:31.489
doing computing the right thing

0:44:31.489,0:44:33.169
but in theory

0:44:33.169,0:44:35.919
that wouldn't be necessary

0:44:35.919,0:44:38.650
outside of that class of programs

0:44:38.650,0:44:42.670
everything needs some sort of descriptors and
of course we'll talk about descriptors

0:44:42.670,0:44:43.659
quite extensively

0:44:43.659,0:44:47.349
%uh as we go through the I/O subsystem

0:44:47.349,0:44:50.969
okay so the executive summary is that processes
are

0:44:50.969,0:44:54.969
the fundamental service that is provided by
UNIX

0:44:54.969,0:44:58.430
and

0:44:58.430,0:45:02.849
what we're going to spend essentially the
next two and a half weeks working on

0:45:02.849,0:45:04.769
is

0:45:04.769,0:45:07.079
what what makes up processes

0:45:07.079,0:45:10.180
we'll go into much more detail about each of these
four points

0:45:10.180,0:45:11.769
and

0:45:11.769,0:45:13.630
then how do we actually go about

0:45:13.630,0:45:14.390
providing that

0:45:14.390,0:45:16.639
bit of service

0:45:16.639,0:45:17.900
the next thing that I

0:45:17.900,0:45:22.210
going to do now is this go through and lay
out some of the terminology that

0:45:22.210,0:45:23.239
we have we when

0:45:23.239,0:45:25.130
we're talking about processes

0:45:25.130,0:45:29.229
so this is sort of the big picture here were
on page eighteen

0:45:29.229,0:45:30.669
and

0:45:30.669,0:45:33.669
you can see we have sort of three bits that
make up

0:45:33.669,0:45:36.640
the system

0:45:36.640,0:45:39.029
the currently running user process

0:45:39.029,0:45:41.180
and then what we call the top half of the kernel

0:45:41.180,0:45:43.699
and the bottom half of the kernel

0:45:43.699,0:45:47.049
now this would be a picture for a uniprocessor

0:45:47.049,0:45:49.299
so one CPU 

0:45:49.299,0:45:51.209
if we had a multiprocessor

0:45:51.209,0:45:54.009
%uh then we would have

0:45:54.009,0:45:57.130
one instance of the kernel

0:45:57.130,0:45:59.529
but multiple instances of the user process

0:45:59.529,0:46:02.879
but for any given CPU on a multiprocessor

0:46:02.879,0:46:05.709
it is running exactly one process

0:46:05.709,0:46:09.309
so you may think they were running for four-five
processes all at once

0:46:09.309,0:46:14.319
but the fact of the matter is that any instant
in time there's only one process which is

0:46:14.319,0:46:16.299
actually running

0:46:16.299,0:46:18.609
and

0:46:18.609,0:46:21.429
that is the one that we have within the system

0:46:21.429,0:46:25.199
now we give the illusion that were running
lots of things because we switch between them

0:46:25.199,0:46:26.100
rather quickly

0:46:26.100,0:46:29.269
so it looks like things are happening in all
windows at once

0:46:29.269,0:46:31.430
but in reality

0:46:31.430,0:46:33.619
that's not really happening

0:46:33.619,0:46:36.440
okay there is a set of properties that I want to
look at

0:46:36.440,0:46:40.899
that had to do with each one of these parts here

0:46:40.899,0:46:44.359
but that just to look at it from the
big picture perspective

0:46:44.359,0:46:45.970
what you see here

0:46:45.970,0:46:47.180
is

0:46:47.180,0:46:51.549
there is boundary between the user process
and the top half of the kernel

0:46:51.549,0:46:54.949
which is really just like a glorified sovereignty
call

0:46:54.949,0:46:59.539
it's a lot like calling into a library routine
like calling strcat, strcpy or something

0:46:59.539,0:47:00.319
like that

0:47:00.319,0:47:03.679
%uh when you do a system call

0:47:03.679,0:47:05.650
we take that same set of parameters

0:47:05.650,0:47:08.009
now this is sort of

0:47:08.009,0:47:09.780
brick Wall here if you will

0:47:09.780,0:47:11.380
that is protecting

0:47:11.380,0:47:13.680
the the top half of the kernel

0:47:13.680,0:47:15.299
from the application

0:47:15.299,0:47:18.899
I'm more go into some detail about how that
actually gets implemented

0:47:18.899,0:47:22.729
but in a sense you can think of it
is is there sort of this whaling Wall with little

0:47:22.729,0:47:24.990
chinks there you can sort of push a request
through

0:47:24.990,0:47:28.230
and somebody other sites where polls that
looks at it and decide whether they're going

0:47:28.230,0:47:28.690
to

0:47:28.690,0:47:30.769
dained to provide service to you

0:47:30.769,0:47:34.229
and if they do then they will send it back

0:47:34.229,0:47:37.649
well like a library where you can just sort
of reach in and walk around if you want to

0:47:37.649,0:47:38.290
you

0:47:38.290,0:47:40.950
good programming practices you don't do that
but

0:47:40.950,0:47:43.049
you could

0:47:43.049,0:47:44.579
all right so

0:47:44.579,0:47:49.089
the the top half of the kernel is really looks
a lot like

0:47:49.089,0:47:50.509
a big library

0:47:50.509,0:47:53.509
%uh it just happens to be a library of
routines

0:47:53.509,0:47:57.599
that deal with things where processes need
to interact with each other

0:47:57.599,0:48:01.399
in fact for many people they don't understand
for what's the difference between the C

0:48:01.399,0:48:03.259
library and the top half of the kernel

0:48:03.259,0:48:08.020
%uh if it's something that you're doing that
no other process needs to know about

0:48:08.020,0:48:09.799
then it can be in the C library

0:48:09.799,0:48:13.829
so if you call strcat to concatenate two
strings together

0:48:13.829,0:48:17.599
nobody else needs to know you're doing that
you don't need to coordinate with anybody

0:48:17.599,0:48:19.000
else that you're doing that

0:48:19.000,0:48:20.160
it's just happening

0:48:20.160,0:48:21.979
so that goes in the C library.

0:48:21.979,0:48:24.489
on the other hand if you're reading or writing
the file

0:48:24.489,0:48:28.029
there may be other processes that are also
reading and writing that file

0:48:28.029,0:48:29.910
and therefore that

0:48:29.910,0:48:31.579
has to be done by the kernel

0:48:31.579,0:48:33.120
because they can coordinate

0:48:33.120,0:48:37.189
on the daemon processes that are trying to access
that file.

0:48:37.189,0:48:40.529
so the top of the kernel is pretty straightforward
code

0:48:40.529,0:48:45.539
it looks a lot like any other library that
you would write if you look at top half kernel

0:48:45.539,0:48:49.640
code you know you see all read,come in 
it's got these parameters we Mark around we

0:48:49.640,0:48:53.719
get some data that we put it in the buffer and
we return back

0:48:53.719,0:48:57.470
in fact writing code for the top half of
the kernel is

0:48:57.470,0:48:59.729
not all that difficult to do

0:48:59.729,0:49:00.989
%uh it's

0:49:00.989,0:49:01.959
you have

0:49:01.959,0:49:05.939
for many the same properties that you would
when you're writing user level application

0:49:05.939,0:49:07.529
code

0:49:07.529,0:49:11.779
the bottom half of the kernel is where things
start to get nasty

0:49:11.779,0:49:14.820
thus the bottom half of the kernel is the part
of the system

0:49:14.820,0:49:18.769
that deals with all of the asynchronous events
in the system

0:49:18.769,0:49:22.179
%uh is things like device drivers,

0:49:22.179,0:49:23.779
timers

0:49:23.779,0:49:25.010
that level of thing

0:49:25.010,0:49:28.029
that are driven by hardware events

0:49:28.029,0:49:28.659
so

0:49:28.659,0:49:31.459
for example a packet arrives on the network

0:49:31.459,0:49:33.670
that causes and interrupt a command

0:49:33.670,0:49:36.729
that will be handled by the bottom half of
the kernel

0:49:36.729,0:49:38.829
and historically

0:49:38.829,0:49:43.079
when an interrupt came in it preempted whatever
else was going on

0:49:43.079,0:49:45.400
and it ran until it's finished and then return

0:49:45.400,0:49:46.539
and it could not

0:49:46.539,0:49:49.439
go to sleep to wait for resources or other
things

0:49:49.439,0:49:51.339
%uh in current systems

0:49:51.339,0:49:54.549
you can actually go to sleep in a interrupt driver
and wait for

0:49:54.549,0:49:56.739
some other activity to complete

0:49:56.739,0:49:58.259
it is however

0:49:58.259,0:50:00.799
not a good idea to do that

0:50:00.799,0:50:01.909
because

0:50:01.909,0:50:06.739
the usual case of most of device drivers is they
can finish whatever they're doing in an interrupt

0:50:06.739,0:50:08.579
without ever blocking

0:50:08.579,0:50:09.580
and so

0:50:09.580,0:50:13.649
when an interrupt comes in and we assume that you're
not going to sleep

0:50:13.649,0:50:14.710
and if you actually

0:50:14.710,0:50:17.219
then go to sleep.oh man

0:50:17.219,0:50:20.469
you didnt tell us you're going to do this we
have to go off into a whole lot of other work

0:50:20.469,0:50:23.029
that we had originally planned on doing

0:50:23.029,0:50:25.460
so if you go to sleep in a device driver

0:50:25.460,0:50:28.209
you are taking a very serious performance

0:50:28.209,0:50:31.019
so it's highly recommended that you don't
do that

0:50:31.019,0:50:33.130
but if you have to you can

0:50:33.130,0:50:35.809
on it's because of this historic behavior
or

0:50:35.809,0:50:39.899
of not being able to sleep in the bottom half
of the kernel

0:50:39.899,0:50:42.119
certain properties that have

0:50:42.119,0:50:44.769
%uh taken over in device drivers

0:50:44.769,0:50:45.940
and that is

0:50:45.940,0:50:50.369
that a device driver should be handed all
the resources it needs to get his job done

0:50:50.369,0:50:54.490
you don't give a disk device driver 
Go read this

0:50:54.490,0:50:56.549
and put it somewhere

0:50:56.549,0:50:57.580
you have to say

0:50:57.580,0:50:59.410
Go read this particular block

0:50:59.410,0:51:02.650
here is a chunk of memory that I want that
my data to put in

0:51:02.650,0:51:03.959
and

0:51:03.959,0:51:06.169
no to find it when it's done

0:51:06.169,0:51:06.970
because

0:51:06.970,0:51:10.660
things like allocating memory are classic
places where you end up having to go to sleep

0:51:10.660,0:51:12.939
to wait for stuff to happen

0:51:12.939,0:51:14.449
and

0:51:14.449,0:51:16.390
historically you couldn't do that

0:51:16.390,0:51:18.640
even currently don't want to have to do that

0:51:18.640,0:51:23.400
so device drivers generally have all
resources pre allocated

0:51:23.400,0:51:25.169
and then they can just go

0:51:25.169,0:51:27.279
the one place where this doesn't work

0:51:27.279,0:51:29.029
is the network

0:51:29.029,0:51:30.929
and in particular

0:51:30.929,0:51:34.630
you don't know when somebody's going to send
packets to you

0:51:34.630,0:51:37.040
you say well you're looking you're open connections

0:51:37.040,0:51:39.360
but if you're doing something like IP forwarding

0:51:39.360,0:51:40.969
there's no

0:51:40.969,0:51:45.039
top half state it's dealing with this packets
they're just coming in on one interface being

0:51:45.039,0:51:46.719
sent out on another interface

0:51:46.719,0:51:50.630
they never pass through any part of the top
half of the kernel

0:51:50.630,0:51:53.529
and so in the case of network device drivers

0:51:53.529,0:51:56.149
they need to allocate memory

0:51:56.149,0:51:56.640
and

0:51:56.640,0:51:58.829
it memory gets into short supply

0:51:58.829,0:52:01.689
and they try to allocate memory and it's not
available

0:52:01.689,0:52:05.049
they historically coudnt wait for memory to be
available

0:52:05.049,0:52:08.380
and even in practice today don't wait


0:52:08.380,0:52:09.580
for memory to become available

0:52:09.580,0:52:12.469
they simply drop the packet on the floor

0:52:12.469,0:52:18.109
it's like well I didn't have any place to
put it sorry oops

0:52:18.109,0:52:20.940
now that doesn't called incorrect behavior

0:52:20.940,0:52:24.369
because a higher level protocols what we transmit

0:52:24.369,0:52:29.140
but it does cause great performance problems
because we transmissions means that connections

0:52:29.140,0:52:29.879
stall

0:52:29.879,0:52:31.110
they have to back up

0:52:31.110,0:52:33.010
they have to resend data

0:52:33.010,0:52:33.739
and so on

0:52:33.739,0:52:38.739
so you really want to avoid dropping packets
if you can possibly help it

0:52:38.739,0:52:42.029
and consequently

0:52:42.029,0:52:43.420
we tend to

0:52:43.420,0:52:46.499
pre allocate a certain amount of memory for
the network drivers

0:52:46.499,0:52:48.299
%uh and

0:52:48.299,0:52:52.169
we try very hard to make sure that we're not
going to run out of memory but

0:52:52.169,0:52:54.869
if packets come fast enough and we can't deal
with them

0:52:54.869,0:52:57.940
as quickly as they are arriving over short period
of time

0:52:57.940,0:53:03.489
we get to the point where we simply have to start
dropping packets

0:53:03.489,0:53:07.649
this is a part of kernel that you do not wish to
write code for

0:53:07.649,0:53:10.919
because it is extremely difficult 
debug

0:53:10.919,0:53:12.759
you get these bugs where

0:53:12.759,0:53:18.779
the only time it happens is on the third Tuesday
when there's a full moon

0:53:18.779,0:53:19.300
and

0:53:19.300,0:53:24.199
we have a disk interrupt followed by %uh a
terminal character coming in

0:53:24.199,0:53:28.289
and the network packet arriving of size fifteen
twenty two

0:53:28.289,0:53:30.109
and when all those things happened

0:53:30.109,0:53:32.719
the system panics

0:53:32.719,0:53:37.380
and of course there's like the panic
cause you're following some bad pointer

0:53:37.380,0:53:40.969
something that should have been there
but was freed some time in the distant past

0:53:40.969,0:53:42.930
we are not sure when

0:53:42.930,0:53:44.049
and

0:53:44.049,0:53:47.400
try to debug things like that is extremely
difficult

0:53:47.400,0:53:48.509
mean you can

0:53:48.509,0:53:52.120
think well I think I found the problem but
it's not reproduceable

0:53:52.120,0:53:55.530
you know you have to wait for the next third
Tuesday with a full moon and blah blah blah

0:53:55.530,0:53:56.950
to happen

0:53:56.950,0:53:57.469
and

0:53:57.469,0:54:01.449
you know so you sort of statistically
gets that you fix that you know I was getting

0:54:01.449,0:54:03.510
this bug once every three days

0:54:03.510,0:54:06.099
and now it's gone for two weeks without happening

0:54:06.099,0:54:07.239
did you fix that?

0:54:07.239,0:54:08.969
or if you've been lucky

0:54:08.969,0:54:10.459
and and it's

0:54:10.459,0:54:14.349
that that coupled with the fact that you're
dealing with hardware

0:54:14.349,0:54:18.049
and hardware really works the way it's documented
to work

0:54:18.049,0:54:21.770
and so you know they're doing everything that
it says you're supposed to do

0:54:21.770,0:54:26.260
it still doesn't work because you didn't set
the fiddle bit over on that other place over

0:54:26.260,0:54:26.660
there

0:54:26.660,0:54:30.479
that's not documented anywhere but if it's
not said it doesn't work

0:54:30.479,0:54:33.769
occasionally

0:54:33.769,0:54:36.110
this is another reason that you really want
of avoid

0:54:36.110,0:54:40.459
dealing with this part of the system if
you can possibly help

0:54:40.459,0:54:44.369
but lets go through and and look at some
of the properties here starting up with at

0:54:44.369,0:54:45.789
the user process

0:54:45.789,0:54:47.980
%uh we're running with 

0:54:47.980,0:54:51.449
preemptive scheduling

0:54:51.449,0:54:53.409
now there's several caveats here

0:54:53.409,0:54:55.239
preemptive scheduling is the default

0:54:55.239,0:54:56.970
so called shared scheduler

0:54:56.970,0:55:01.360
that is what you normally use there are other
schedulers like the real time scheduler

0:55:01.360,0:55:02.869
where what I'm saying isnt that true

0:55:02.869,0:55:05.709
%uh will talk about some of the schedulers was
later

0:55:05.709,0:55:09.930
but the usual scheduler that you're running
on under UNIX is a shared scheduler

0:55:09.930,0:55:13.229
and under the shared scheduler the user applications

0:55:13.229,0:55:15.159
run with pre emptive scheduling

0:55:15.159,0:55:17.449
and pre emptive scheduling means that

0:55:17.449,0:55:20.019
you run at the whim of the system

0:55:20.019,0:55:21.420
if they want you to run

0:55:21.420,0:55:22.140
you run

0:55:22.140,0:55:25.490
once you start running you have no guarantee
of how long you're going to run

0:55:25.490,0:55:29.370
it might like to run for three instructions
and then decide it doesn't like you many more

0:55:29.370,0:55:31.150
it wants to run something else

0:55:31.150,0:55:35.920
while you might get to run for several seconds
and in a row with the with no intervening

0:55:35.920,0:55:37.469
things interrupting

0:55:37.469,0:55:39.719
you just don't know

0:55:39.719,0:55:40.969
and

0:55:40.969,0:55:42.839
really all you know is

0:55:42.839,0:55:43.569
that 

0:55:43.569,0:55:48.239
%uh they claim that they're using statistics
and that and that the statistics are fair

0:55:48.239,0:55:55.059
and so on average you're going to get a reasonable
amount of time but thats

0:55:55.059,0:55:57.129
up to the system you don't control that

0:55:57.129,0:55:58.439
the real point here

0:55:58.439,0:56:01.940
is that you don't have any way of creating
a critical section

0:56:01.940,0:56:04.950
you can say okay I don't want to be interrupted

0:56:04.950,0:56:07.429
during this particular sequence of things

0:56:07.429,0:56:09.809
so you have to program

0:56:09.809,0:56:13.469
assuming that you may be interrupted at any
point

0:56:13.469,0:56:14.979
okay

0:56:14.979,0:56:18.909
the next thing is that when you're running
in user process

0:56:18.909,0:56:20.719
you are running in

0:56:20.719,0:56:24.150
with the processor in what's called unprivileged
mode

0:56:24.150,0:56:28.109
one of the requirements for running any kind
of a UNIX system

0:56:28.109,0:56:31.759
is that you have to have a processor that
support privileged and unprivileged

0:56:31.759,0:56:33.709
two different modes of operation

0:56:33.709,0:56:37.049
in privilege mode which is what the kernel
runs in

0:56:37.049,0:56:38.950
the entire repertoire

0:56:38.950,0:56:40.869
of the hardware is available

0:56:40.869,0:56:45.339
by this I mean you can set all the register
as you can fiddle with the memory management

0:56:45.339,0:56:47.460
unit you can initiate I/O

0:56:47.460,0:56:50.519
you can access any register anywhere

0:56:50.519,0:56:51.919
etc

0:56:51.919,0:56:56.540
when you're running in unprivileged
mode which is what user process run in and

0:56:56.540,0:57:00.709
this a large subset of the instructions which
you cannot execute

0:57:00.709,0:57:03.480
you cannot initiate I/O on

0:57:03.480,0:57:04.209
devices

0:57:04.209,0:57:06.770
you cannot change the memory mapping

0:57:06.770,0:57:10.209
you cannot access memory that's not part of
your address space

0:57:10.209,0:57:13.299
%uh you cannot execute certain instructions
like halt

0:57:13.299,0:57:15.589
%uh and

0:57:15.589,0:57:19.039
so in general you are protected

0:57:19.039,0:57:21.789
from manipulating anything that's outside of your
address space

0:57:21.789,0:57:23.759
this of course is desirable because

0:57:23.759,0:57:27.059
%uh when you're running in this unprevileged 
mode

0:57:27.059,0:57:28.300
you're protected

0:57:28.300,0:57:31.910
from other processes manipulating you 
and they're protected from you manipulating

0:57:31.910,0:57:33.079
them

0:57:33.079,0:57:36.430
for those of you that have had that misfortune
to have to use

0:57:36.430,0:57:39.339
early versions of windows up to about ninety
eight

0:57:39.339,0:57:42.470
they always ran with the processor
running in privileged mode

0:57:42.470,0:57:44.009
even in applications

0:57:44.009,0:57:46.459
and so either maliciously or accidentally

0:57:46.459,0:57:50.000
you could stop on other people address space
or you could stop on the kernel

0:57:50.000,0:57:53.020
and a lot of the blue screen of death was
people just

0:57:53.020,0:57:56.319
following wild pointers and trashing different
parts of the system

0:57:56.319,0:57:58.819
taking everything down

0:57:58.819,0:58:00.020
it also makes it

0:58:00.020,0:58:02.320
far easier to

0:58:02.320,0:58:05.459
implement things like viruses and worms and
other things because

0:58:05.459,0:58:09.619
user application can we rewrite the boot
block on the disk they can just the write down

0:58:09.619,0:58:13.109
and manipulate the registers that allow them
to do whatever they want

0:58:13.109,0:58:16.730
whereas when you're running in unprivileged
mode you cant write those kinds of

0:58:16.730,0:58:20.179
of things

0:58:20.179,0:58:24.119
modern versions of Windows from about
2000 on

0:58:24.119,0:58:26.630
now run with privileged and unprevileged mode

0:58:26.630,0:58:28.649
but UNIX has always required that

0:58:28.649,0:58:30.219
and so when you're running an 

0:58:30.219,0:58:31.319
the user process

0:58:31.319,0:58:33.389
you cannot block i mean

0:58:33.389,0:58:37.969
you cannot execute the instructions which
cause a context switching to occur

0:58:37.969,0:58:40.349
you can't pick what's going to run next

0:58:40.349,0:58:43.140
you can't make that thing run next all you can
do

0:58:43.140,0:58:45.189
is go to the operating system and say

0:58:45.189,0:58:49.269
hey I've got nothing to do. pick somebody else
to run

0:58:49.269,0:58:53.449
the operating system is the think they can
then execute the instructions which cause

0:58:53.449,0:58:57.609
a different process to be loaded

0:58:57.609,0:58:59.049
and run

0:58:59.049,0:59:03.400
alright.finally while you're in a user application you're
running on a user stack

0:59:03.400,0:59:06.410
that's part of the user address space

0:59:06.410,0:59:07.889
so

0:59:07.889,0:59:10.819
part of creating a process gives you a runtime
stack

0:59:10.819,0:59:14.369
as part of a virtual address space and so it
can be

0:59:14.369,0:59:18.199
more or less up to the limits of the hardware
as big as you want it to be

0:59:18.199,0:59:19.949
so if you are running on thirty two-bit processor

0:59:19.949,0:59:22.819
you're stack can get 2 gigabytes

0:59:22.819,0:59:23.319
and

0:59:23.319,0:59:26.839
%uh the what this means is that anytime you
allocate local variables

0:59:26.839,0:59:28.529
you don't have to worry about Oh

0:59:28.529,0:59:30.609
is that gonna overrun my stack?

0:59:30.609,0:59:31.610
so if you need

0:59:31.610,0:59:35.519
a hundred thousand double precision floating
point numbers

0:59:35.519,0:59:37.189
you can just as a local variable allocate

0:59:37.189,0:59:40.269
an array of size a hundred-thousand type
double

0:59:40.269,0:59:44.029
and it just decrements your stack pointer by
hundred hundred thousand bytes

0:59:44.029,0:59:45.009
a way to go

0:59:45.009,0:59:47.299
it's just virtual address space

0:59:47.299,0:59:49.020
as you'll see when we get into the kernel

0:59:49.020,0:59:50.210
that ceases to be the case