First USB sketch.
[cascardo/kernel/slides/.git] / 06process / process
1 %Processes
2 %Thadeu Cascardo
3
4 # Process Context
5
6 * System calls
7 * Kernel Stack
8 * User space memory access
9 * current process
10
11 # Interrupts
12
13 * May race with a process
14 * Usually blocks all other interrupts
15 * Must be fast
16
17 # Bottom Halves: the old way
18
19 * Interrupts would work in the top halves and schedule a bottom half for
20   execution
21 * Bottom halves executed with interrupts enabled
22 * They were static: drivers could not dynamically create them
23 * Only one bottom half could execute at a time, even in SMP systems
24
25 # Softirqs: scaling Linux
26
27 * They were introduced to put the IRQ handling to scale
28 * They are static as well, but two of the softirqs are dedicated to tasklets
29 * Tasklets allow drivers to schedule some code for execution dynamically
30
31 # Sleeping
32
33 * There are many places in the code that will wait for an event
34 * Waiting should release the processor to another process: that means that the
35   current process (the waiter) will sleep
36 * Sleep is equivalent to scheduling, that is, picking up another process to
37   execute
38 * Scheduling another process is prone to races
39
40 # Atomic context
41
42 * Contexts that cannot sleep or schedule
43 * IRQs and softirqs are atomic
44 * They cannot access user space
45 * They cannot sleep
46
47 # Current softirqs
48
49 * High priority tasklets
50 * Timers
51 * Network transmit
52 * Network receive
53 * Block softirq
54 * Block iopoll
55 * Low priority tasklets
56 * Scheduler
57 * High Resolution Timers
58 * RCU
59
60 # SMP
61
62 * Races, races, races
63 * BKL
64 * Scalable locking is needed
65 * SMP-safety is what people are selling and buying
66 * Only local IRQs are disabled
67
68 # Preemption
69
70 * Now, a single CPU may race with itself
71 * Different problems, different care and approach
72 * Some problems are the same and SMP-safety is now relevant in UP systems
73
74 # Disabling IRQs
75
76 * local\\_irq\\_disable
77 * local\\_irq\\_enable
78 * local\\_irq\\_save
79 * local\\_irq\\_restore
80
81 # Disabling Preemption
82
83 * preempt\\_disable
84 * preempt\\_enable
85 * preempt\\_enable\\_no\\_resched
86
87 # SMP functions
88
89 * smp\\_processor\\_id
90 * get\\_cpu
91 * put\\_cpu