Commit 3a1f682
committed
Add list helpers for scheduler ready queues
Previously, list_pushback() and list_remove() were the only list APIs
available for manipulating task lists. However, both functions perform
malloc/free internally, which is unnecessary and inefficient during
task state transitions.
The previous commit introduced an intrusive ready-queue membership
structure in tcb_t. To support this design and improve efficiency,
this commit adds two helper functions for intrusive list manipulation,
eliminating overhead malloc/free operation during task lifecycle.
- list_pushback_node(): append an existing node to the end of the
list in O(n) time without allocating memory.
- list_remove_node(): remove a node from the list without freeing it.
Both helper functions are operated in O(n) by linearly searching
method.1 parent 4f29f87 commit 3a1f682
1 file changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
103 | 121 | | |
104 | 122 | | |
105 | 123 | | |
| |||
134 | 152 | | |
135 | 153 | | |
136 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
137 | 174 | | |
138 | 175 | | |
139 | 176 | | |
| |||
0 commit comments