渲染错误:Mermaid 渲染失败: Parsing failed: Lexer error on line 2, column 14: unexpected character: ->(<- at offset: 31, skipped 1 characters. Lexer error on line 2, column 18: unexpected character: ->层<- at offset: 35, skipped 3 characters. Lexer error on line 2, column 24: unexpected character: ->网<- at offset: 41, skipped 3 characters. Lexer error on line 3, column 16: unexpected character: ->(<- at offset: 60, skipped 17 characters. Lexer error on line 4, column 20: unexpected character: ->(<- at offset: 97, skipped 13 characters. Lexer error on line 5, column 17: unexpected character: ->(<- at offset: 127, skipped 1 characters. Lexer error on line 5, column 24: unexpected character: ->层<- at offset: 134, skipped 5 characters. Lexer error on line 5, column 35: unexpected character: ->集<- at offset: 145, skipped 3 characters. Lexer error on line 6, column 18: unexpected character: ->(<- at offset: 166, skipped 14 characters. Lexer error on line 7, column 20: unexpected character: ->(<- at offset: 200, skipped 1 characters. Lexer error on line 7, column 24: unexpected character: ->网<- at offset: 204, skipped 3 characters. Lexer error on line 8, column 21: unexpected character: ->(<- at offset: 235, skipped 9 characters. Lexer error on line 9, column 18: unexpected character: ->(<- at offset: 271, skipped 8 characters. Lexer error on line 10, column 27: unexpected character: ->(<- at offset: 315, skipped 6 characters. Lexer error on line 11, column 22: unexpected character: ->(<- at offset: 356, skipped 7 characters. Lexer error on line 12, column 25: unexpected character: ->(<- at offset: 401, skipped 8 characters. Lexer error on line 13, column 20: unexpected character: ->(<- at offset: 440, skipped 4 characters. Lexer error on line 13, column 26: unexpected character: ->)<- at offset: 446, skipped 1 characters. Lexer error on line 14, column 22: unexpected character: ->(<- at offset: 480, skipped 6 characters. Parse error on line 2, column 15: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: 'API' Parse error on line 2, column 21: Expecting token of type ':' but found `API`. Parse error on line 5, column 18: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: 'Worker' Parse error on line 5, column 29: Expecting token of type ':' but found `Worker`. Parse error on line 7, column 21: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: 'API' Parse error on line 7, column 28: Expecting token of type ':' but found `in`. Parse error on line 13, column 24: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: 'DB' Parse error on line 13, column 28: Expecting token of type ':' but found `in`. Parse error on line 16, column 19: Expecting token of type 'ARROW_DIRECTION' but found `priority`. Parse error on line 16, column 27: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: ':' Parse error on line 17, column 20: Expecting token of type 'ARROW_DIRECTION' but found `queue`. Parse error on line 17, column 25: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: ':' Parse error on line 18, column 17: Expecting token of type 'ARROW_DIRECTION' but found `core_scheduler`. Parse error on line 18, column 31: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: ':' Parse error on line 19, column 26: Expecting token of type 'ARROW_DIRECTION' but found `worker`. Parse error on line 19, column 32: Expecting: one of these possible Token sequences: 1. [NEWLINE] 2. [EOF] but found: ':' Parse error on line 20, column 20: Expecting token of type ':' but found `<`. Parse error on line 20, column 25: Expecting token of type 'ARROW_DIRECTION' but found `preempter`. Parse error on line 21, column 20: Expecting token of type ':' but found `<`. Parse error on line 21, column 25: Expecting token of type 'ARROW_DIRECTION' but found `lock_service`. Parse error on line 22, column 12: Expecting token of type ':' but found `<`. Parse error on line 22, column 17: Expecting token of type 'ARROW_DIRECTION' but found `meta_db`. Parse error on line 23, column 15: Expecting token of type ':' but found `--`. Parse error on line 23, column 19: Expecting token of type 'ARROW_DIRECTION' but found `event_bus`.
我们首先定义优先级反转场景下的阻塞时间计算公式: 传统无优化调度的最大阻塞时间为: B o l d = ∑ i = 1 n C i + T w a i t B_{old} = \sum_{i=1}^{n} C_i + T_{wait}Bold=i=1∑nCi+Twait 其中C i C_iCi是所有排在高优先级任务之前的低优先级任务的执行时间,T w a i t T_{wait}Twait是资源等待时间。
Harness协议优化后的最大阻塞时间为: B n e w = m a x ( C c r i t i c a l ) + T p r e e m p t B_{new} = max(C_{critical}) + T_{preempt}Bnew=max(Ccritical)+Tpreempt 其中m a x ( C c r i t i c a l ) max(C_{critical})max(Ccritical)是所有低优先级任务的最长临界区执行时间,T p r e e m p t T_{preempt}Tpreempt是任务抢占的开销,计算公式为: T p r e e m p t = T s n a p s h o t + T t e r m i n a t e + T s c h e d u l e T_{preempt} = T_{snapshot} + T_{terminate} + T_{schedule}Tpreempt=Tsnapshot+Tterminate+Tschedule 其中T s n a p s h o t T_{snapshot}Tsnapshot是任务上下文快照时间,T t e r m i n a t e T_{terminate}Tterminate是低优先级任务终止时间,T s c h e d u l e T_{schedule}Tschedule是高优先级任务调度时间,在Harness的生产环境中T p r e e m p t T_{preempt}Tpreempt平均只有200ms左右。