@@ -96,9 +96,13 @@ lazy_static! {
96
96
// This value represents the trend of tasks mapped onto the thread pool.
97
97
// Calculation is following:
98
98
//
99
- // α :: EMA_COEFFICIENT :: smoothing factor between 0 and 1
100
- // Yt :: freq :: frequency sample at time t
101
- // St :: acc :: EMA at time t
99
+ // +--------+-----------------+----------------------------------+
100
+ // | Symbol | Identifier | Explanation |
101
+ // +--------+-----------------+----------------------------------+
102
+ // | α | EMA_COEFFICIENT | smoothing factor between 0 and 1 |
103
+ // | Yt | freq | frequency sample at time t |
104
+ // | St | acc | EMA at time t |
105
+ // +--------+-----------------+----------------------------------+
102
106
//
103
107
// Under these definitions formula is following:
104
108
// EMA = α * [ Yt + (1 - α)*Yt-1 + ((1 - α)^2)*Yt-2 + ((1 - α)^3)*Yt-3 ... ] + St
@@ -163,7 +167,7 @@ fn scale_pool() {
163
167
{
164
168
// Throughput is low. Allocate more threads to unblock flow.
165
169
// If we fall to this case, scheduler is congested by longhauling tasks.
166
- // For unblock the flow we should add up some threads to the pool, but not that much to
170
+ // For unblock the flow we should add up some threads to the pool, but not that many to
167
171
// stagger the program's operation.
168
172
let scale = LOW_WATERMARK * current_frequency + 1 ;
169
173
@@ -221,8 +225,8 @@ fn create_blocking_thread() {
221
225
match err. kind ( ) {
222
226
ErrorKind :: WouldBlock => {
223
227
// Maximum allowed threads per process is varying from system to system.
224
- // Some systems has it(like MacOS ), some doesn 't(Linux)
225
- // This case expected to not happen.
228
+ // Also, some systems have it(like macOS ), and some don 't(Linux).
229
+ // This case expected not to happen.
226
230
// But when happened this shouldn't throw a panic.
227
231
let current_arc = POOL_SIZE . clone ( ) ;
228
232
MAX_THREADS . store ( * current_arc. lock ( ) . unwrap ( ) - 1 , Ordering :: SeqCst ) ;
@@ -235,7 +239,7 @@ fn create_blocking_thread() {
235
239
} ) ;
236
240
}
237
241
238
- // Enqueues work, attempting to send to the threadpool in a
242
+ // Enqueues work, attempting to send to the thread pool in a
239
243
// nonblocking way and spinning up needed amount of threads
240
244
// based on the previous statistics without relying on
241
245
// if there is not a thread ready to accept the work or not.
0 commit comments