OSTEP chapter 10

This commit is contained in:
ridethepig 2023-04-07 12:14:14 +08:00
parent a06a617205
commit 5dc45b9e51
4 changed files with 331 additions and 8 deletions

View File

@ -1612,5 +1612,257 @@
:height 1468.8}), :height 1468.8}),
:page 132}, :page 132},
:content {:text "cache coherence"}, :content {:text "cache coherence"},
:properties {:color "yellow"}}
{:id #uuid "642f878b-44c2-4485-ae98-448032b588da",
:page 132,
:position {:bounding {:x1 359.7260437011719,
:y1 833.890625,
:x2 548.6223754882812,
:y2 859.890625,
:width 1036.8,
:height 1555.2},
:rects ({:x1 359.7260437011719,
:y1 833.890625,
:x2 548.6223754882812,
:y2 859.890625,
:width 1036.8,
:height 1555.2}),
:page 132},
:content {:text " Synchronization"},
:properties {:color "yellow"}}
{:id #uuid "642f87d0-2e9a-405c-8fa6-689dc492ef52",
:page 133,
:position {:bounding {:x1 337.5885009765625,
:y1 1005.828125,
:x2 500.90411376953125,
:y2 1031.828125,
:width 1036.8,
:height 1555.2},
:rects ({:x1 337.5885009765625,
:y1 1005.828125,
:x2 500.90411376953125,
:y2 1031.828125,
:width 1036.8,
:height 1555.2}),
:page 133},
:content {:text "Cache Affinity"},
:properties {:color "yellow"}}
{:id #uuid "642f88e3-3f8b-472b-8947-09531409a23b",
:page 134,
:position {:bounding {:x1 0,
:y1 77,
:x2 897.30126953125,
:y2 385.265625,
:width 1036.8,
:height 1555.2},
:rects ({:x1 0,
:y1 77,
:x2 0,
:y2 99,
:width 1036.8,
:height 1555.2}
{:x1 830.359375,
:y1 332.34375,
:x2 897.30126953125,
:y2 361.34375,
:width 1036.8,
:height 1555.2}
{:x1 206.265625,
:y1 356.265625,
:x2 540.1387939453125,
:y2 385.265625,
:width 1036.8,
:height 1555.2}
{:x1 206.265625,
:y1 360.265625,
:x2 540.1387939453125,
:y2 381.78125,
:width 1036.8,
:height 1555.2}),
:page 134},
:content {:text "singlequeue multiprocessor scheduling"},
:properties {:color "yellow"}}
{:id #uuid "642f90ef-6bf0-42be-8056-188682da8901",
:page 135,
:position {:bounding {:x1 139.3125,
:y1 912.71875,
:x2 652.6011962890625,
:y2 941.71875,
:width 1036.8,
:height 1555.2},
:rects ({:x1 139.3125,
:y1 912.71875,
:x2 533.1480712890625,
:y2 941.71875,
:width 1036.8,
:height 1555.2}
{:x1 565.9375,
:y1 912.71875,
:x2 640.0490112304688,
:y2 941.71875,
:width 1036.8,
:height 1555.2}
{:x1 527.78125,
:y1 916.71875,
:x2 652.6011962890625,
:y2 938.234375,
:width 1036.8,
:height 1555.2}),
:page 135},
:content {:text "multi-queue multiprocessor scheduling (or MQMS)."},
:properties {:color "yellow"}}
{:id #uuid "642f914d-502e-4f9d-8878-cf331e7f3fc3",
:page 136,
:position {:bounding {:x1 666.286865234375,
:y1 1288.765625,
:x2 743.6843872070312,
:y2 1309.765625,
:width 1036.8,
:height 1555.2},
:rects ({:x1 666.286865234375,
:y1 1288.765625,
:x2 743.6843872070312,
:y2 1309.765625,
:width 1036.8,
:height 1555.2}),
:page 136},
:content {:text "sinister "},
:properties {:color "green"}}
{:id #uuid "642f934e-0f7b-43de-97a1-fc530b229098",
:page 136,
:position {:bounding {:x1 0,
:y1 237,
:x2 897.284423828125,
:y2 662.109375,
:width 1036.8,
:height 1555.2},
:rects ({:x1 0,
:y1 237,
:x2 0,
:y2 259,
:width 1036.8,
:height 1555.2}
{:x1 854.234375,
:y1 609.1875,
:x2 897.284423828125,
:y2 638.1875,
:width 1036.8,
:height 1555.2}
{:x1 206.265625,
:y1 633.109375,
:x2 307.8766174316406,
:y2 662.109375,
:width 1036.8,
:height 1555.2}
{:x1 206.265625,
:y1 637.109375,
:x2 307.8766174316406,
:y2 658.625,
:width 1036.8,
:height 1555.2}),
:page 136},
:content {:text "load imbalance"},
:properties {:color "yellow"}}
{:id #uuid "642f9458-c07c-4ef3-a1ec-a14e76ea4b2b",
:page 137,
:position {:bounding {:x1 336.7445983886719,
:y1 242.765625,
:x2 435.4749755859375,
:y2 263.765625,
:width 1036.8,
:height 1555.2},
:rects ({:x1 336.7445983886719,
:y1 242.765625,
:x2 435.4749755859375,
:y2 263.765625,
:width 1036.8,
:height 1555.2}),
:page 137},
:content {:text "insidious "},
:properties {:color "green"}}
{:id #uuid "642f9564-38b9-4f22-a0af-f4c4f6c8fe76",
:page 137,
:position {:bounding {:x1 456.296875,
:y1 491.78125,
:x2 553.1802978515625,
:y2 520.78125,
:width 1036.8,
:height 1555.2},
:rects ({:x1 456.296875,
:y1 491.78125,
:x2 553.1802978515625,
:y2 520.78125,
:width 1036.8,
:height 1555.2}),
:page 137},
:content {:text "migration"},
:properties {:color "yellow"}}
{:id #uuid "642f96cb-066e-4ab9-975c-a746e3143062",
:page 138,
:position {:bounding {:x1 748.4410400390625,
:y1 629.421875,
:x2 869.3787841796875,
:y2 650.421875,
:width 1036.8,
:height 1555.2},
:rects ({:x1 748.4410400390625,
:y1 629.421875,
:x2 869.3787841796875,
:y2 650.421875,
:width 1036.8,
:height 1555.2}),
:page 138},
:content {:text "dissertation "},
:properties {:color "green"}}
{:id #uuid "642f97ac-a4ab-4baf-b039-678c466ea588",
:page 138,
:position {:bounding {:x1 818.3055419921875,
:y1 1203.875,
:x2 897.3005981445312,
:y2 1224.875,
:width 1036.8,
:height 1555.2},
:rects ({:x1 818.3055419921875,
:y1 1203.875,
:x2 897.3005981445312,
:y2 1224.875,
:width 1036.8,
:height 1555.2}),
:page 138},
:content {:text "daunting"},
:properties {:color "green"}}
{:id #uuid "642f97b5-d203-4998-84f0-21d66f8424b7",
:page 138,
:position {:bounding {:x1 206.265625,
:y1 1251.703125,
:x2 304.9924011230469,
:y2 1272.703125,
:width 1036.8,
:height 1555.2},
:rects ({:x1 206.265625,
:y1 1251.703125,
:x2 304.9924011230469,
:y2 1272.703125,
:width 1036.8,
:height 1555.2}),
:page 138},
:content {:text "undertake "},
:properties {:color "green"}}
{:id #uuid "642f981d-af29-4cc1-a9da-b445cb964674",
:page 138,
:position {:bounding {:x1 206.25347900390625,
:y1 519.890625,
:x2 589.3045043945312,
:y2 545.890625,
:width 1036.8,
:height 1555.2},
:rects ({:x1 206.25347900390625,
:y1 519.890625,
:x2 589.3045043945312,
:y2 545.890625,
:width 1036.8,
:height 1555.2}),
:page 138},
:content {:text "Linux Multiprocessor Schedulers"},
:properties {:color "yellow"}}], :properties {:color "yellow"}}],
:extra {:page 132}} :extra {:page 142}}

2
journals/2023_04_07.md Normal file
View File

@ -0,0 +1,2 @@
- 居然要体测,虽然基本上无所谓就是了
-

View File

@ -427,12 +427,81 @@ file-path:: ../assets/ostep_1680491762166_0.pdf
hl-color:: green hl-color:: green
id:: 642eeb3a-8803-4c73-84a7-cc48c903f10f id:: 642eeb3a-8803-4c73-84a7-cc48c903f10f
- proliferation 涌现;增殖 - proliferation 涌现;增殖
ls-type:: annotation
hl-page:: 129 hl-page:: 129
hl-color:: green
id:: 642eeb44-cf62-4cf6-81cb-f1f6423cb66d
- cache coherence
ls-type:: annotation ls-type:: annotation
id:: 642eeb44-cf62-4cf6-81cb-f1f6423cb66d
hl-color:: green
- Problems with multiple processors
- cache coherence: basically, hardware handles this
hl-page:: 132 hl-page:: 132
hl-color:: yellow ls-type:: annotation
id:: 642eecc1-d07d-4e48-bcd5-b84db831b241 id:: 642eecc1-d07d-4e48-bcd5-b84db831b241
hl-color:: yellow
- Synchronization: though locks ensure correctness, performance is harmed
hl-page:: 132
ls-type:: annotation
id:: 642f878b-44c2-4485-ae98-448032b588da
hl-color:: yellow
- Cache Affinity: cache may still keep some of the process's state, so this may be faster if the process runs on the same CPU next time, in that there is no need to load state from memory.
hl-page:: 133
ls-type:: annotation
id:: 642f87d0-2e9a-405c-8fa6-689dc492ef52
hl-color:: yellow
- Single-Queue Multiprocessor Scheduling(SQMS)
hl-page:: 134
ls-type:: annotation
id:: 642f88e3-3f8b-472b-8947-09531409a23b
hl-color:: yellow
- Simply use the same policy as we do in the single processor condition, and pick maybe more than one best jobs to run.
- Problem 1: lack of scalability. Since it is a single global queue, there will be a lot of contention on the same lock, thus greatly reducing the performance.
- Problem 2: cache affinity. If the scheduler simply feed processes to CPU by order, the jobs will bounce around from CPU to CPU. Complex affinity mechanism is needed to try to make it more likely that process will continue to run on the same CPU.
- Multi-Queue Multiprocessor Scheduling (MQMS).
hl-page:: 135
ls-type:: annotation
id:: 642f90ef-6bf0-42be-8056-188682da8901
hl-color:: yellow
- Consists of multiple independent queues following some particular policy. Avoid problems of sharing and synchronization.
- More scalable: when number of CPUs grows, add more queues.
- Better cache affinity: jobs in the same queue stay in the same CPU
- Problem: load imbalance. The jobs in the queue with fewer jobs get more CPU share than those in the queue with more jobs. Or even worse, some CPUs are IDLE. (一核有难,七核围观)
hl-page:: 136
ls-type:: annotation
id:: 642f934e-0f7b-43de-97a1-fc530b229098
hl-color:: yellow
- Migration: the obvious solution to load imbalance, is to migrate some jobs from one CPU to another. Sometimes, we need to keep switching jobs, in such case that Q1 has 1 job and Q2 has 2 jobs. You may want to keep moving the third job from one CPU to another, to balance load.
hl-page:: 137
ls-type:: annotation
id:: 642f9564-38b9-4f22-a0af-f4c4f6c8fe76
hl-color:: yellow
- Work stealing: source queue(low on jobs) occasionally peek at other queues to see whether it is a good idea to move some jobs to help balance load.
- sinister 危险的, 不吉祥的
hl-page:: 136
ls-type:: annotation
id:: 642f914d-502e-4f9d-8878-cf331e7f3fc3
hl-color:: green
- insidious 隐伏的,潜在的,阴险的
hl-page:: 137
ls-type:: annotation
id:: 642f9458-c07c-4ef3-a1ec-a14e76ea4b2b
hl-color:: green
- dissertation 专题论文, 学位论文
ls-type:: annotation
hl-page:: 138
hl-color:: green
id:: 642f96cb-066e-4ab9-975c-a746e3143062
- daunting 使人畏缩的;使人气馁的;
ls-type:: annotation
hl-page:: 138
hl-color:: green
id:: 642f97ac-a4ab-4baf-b039-678c466ea588
- undertake 承担;从事;负责
ls-type:: annotation
hl-page:: 138
hl-color:: green
id:: 642f97b5-d203-4998-84f0-21d66f8424b7
- Linux Multiprocessor Schedulers: 3 different schedulers. CFS and O(1) are MQMS, while BFS is SQMS based on EEVDF.
hl-page:: 138
ls-type:: annotation
id:: 642f981d-af29-4cc1-a9da-b445cb964674
hl-color:: yellow
-