About the Author xi
Preface xiii
Declaration of AI-Assisted Technologies xv
Acknowledgments xvii
A Historical Perspective xxi
Special Contributions xxiii
1 Introduction 1
1.1 Overview 1
1.2 Life Cycle of a Process 3
1.3 Internal Representation of a Process 6
1.4 Creating Processes 8
1.5 Synchronization Between P0, P1, and P2 for Creating Processes 12
1.6 Duplicating Structures for Creating Processes â" copy_process() 13
1.7 Inserting Process into Runqueue â" wake_up_new_task() 15
1.8 Context Switch â" schedule() 24
1.9 Limits of Processes 26
1.10 Organization of the Book 26
2 Creating Processes 31
2.1 Overview 31
2.2 Internal Representation of Processes 34
2.3 Hardcode P0 â" Creating P0init_task, Swapper Thread 37
2.4 Direct Creation â" Creating P1 kernel_init and P2 kthreadd 40
2.5 Creating Early Kernel Threads and Hotplug Threads 49
2.6 Synchronization for Creating Early Kernel Threads 77
2.7 Summary 79
3 Kernel Clone: Part 1 â" copy_process() 81
3.1 Overview of Calls for Creating Processes 81
3.2 kernel_clone() via kernel_thread() 85
3.3 kernel_clone() via user_mode_thread() 86
3.4 kernel_clone() via System Calls 92
3.5 kernel_clone() 94
3.6 copy_process() â" kernel_clone(): Part 1 95
3.7 Summary 116
4 Kernel Clone: Part 2 â" wake_up_new_task() 119
4.1 Overview 120
4.2 Background on runqueues 121
4.3 Overview of wake_up_new_task() 127
4.4 Updating runqueue Clock â" update_rq_clock() 129
4.5 Inserting New Tasks to runqueue â" activate_task()->enqueue_task() 136
4.6 Summary 172
5 Per-Entity Load Tracking 175
5.1 Overview 176
5.2 Measuring Contributions to Loads 178
5.3 Computing Individual Load Sums ___update_load_sum() 182
5.4 Preparation for Computing Individual Load Averages 187
5.5 Computing Individual Load Averages ___update_load_avg() 193
5.6 Interrupts â" A Short Introduction for scheduler_tick() 194
5.7 Summary 201
6 Task Groups 203
6.1 Overview â" Hierarchy of Task Groups and Tasks 203
6.2 Determining Load Sum and Average for Individual Tasks 208
6.3 Tracking Load Sum and Load Average for Groups 214
6.4 Updating cfs Groups 229
6.5 Task Groups in Action Using cgroup 233
6.6 Summary 244
7 Global Loads 247
7.1 Overview 248
7.2 Periods for Updating Global Loads 248
7.3 Computing Global Loads 252
7.4 Exponential Decaying of Loads Over Time 257
7.5 Effects of Period 260
7.6 No HZ Global Load 262
7.7 Summary 268
8 Schedule 269
8.1 Overview 270
8.2 Preemption 276
8.3 schedule() 278
8.4 Putting Previous Task Back to RB Tree 288
8.5 Context Switch 292
8.6 Summary 314
Further Reading 315
Index 317
Subject Index 329