韩星星,肖锋,黄姝娟,等.DAG任务同步中无锁机制实现方法研究[J]. 微电子学与计算机,2023,40(6):9-16. doi: 10.19304/J.ISSN1000-7180.2022.0457
引用本文: 韩星星,肖锋,黄姝娟,等.DAG任务同步中无锁机制实现方法研究[J]. 微电子学与计算机,2023,40(6):9-16. doi: 10.19304/J.ISSN1000-7180.2022.0457
HAN X X,XIAO F,HUANG S J,et al. Research on the implementation method of lock-free mechanism in DAG task synchronization[J]. Microelectronics & Computer,2023,40(6):9-16. doi: 10.19304/J.ISSN1000-7180.2022.0457
Citation: HAN X X,XIAO F,HUANG S J,et al. Research on the implementation method of lock-free mechanism in DAG task synchronization[J]. Microelectronics & Computer,2023,40(6):9-16. doi: 10.19304/J.ISSN1000-7180.2022.0457

DAG任务同步中无锁机制实现方法研究

Research on the implementation method of lock-free mechanism in DAG task synchronization

  • 摘要: 随着多核嵌入式实时系统的发展,DAG任务同步问题得到了广泛的关注. 目前的任务同步方法大都采用锁机制,但锁机制存在许多问题,如自旋锁存在任务忙等状态,浪费CPU资源;使用互斥锁的任务若获取不到共享资源会被阻塞,产生上下文切换开销;顺序锁允许写任务有更高的优先级,但写任务不能频繁更新数据,否则读任务会产生饿死现象. 上述锁机制如果应用于多核平台下的DAG任务同步,不仅会影响系统整体执行效率,导致后继任务无法执行,严重时会引发死锁现象导致系统崩溃. 因此,提出了在DAG任务同步过程中使用DCAS无锁机制,有效避免了锁机制存在的问题. 在LITMUSRT多核平台下,以多任务同时申请、填充和释放Vxworks网络缓冲区为例,对缓冲池中的三元组mBlk,clBlk,cluster分别使用DCAS无锁机制. 实验结果表明,相比传统锁机制,DCAS无锁机制在DAG任务同步方面有较好的效果,响应时间减少了10.4%,系统的整体执行效率提高了4.2%.

     

    Abstract: With the development of multi-core embedded real-time systems, the DAG task synchronization problem has received extensive attention. Most of the current task synchronization methods use the lock mechanism, but there are many problems in the lock mechanism, such as the spin lock in the task busy waiting state, which wastes CPU resources; If a task using a mutex cannot obtain a shared resource, it will be blocked, resulting in context switching overhead; Sequential locks allow write tasks to have higher priority, but write tasks cannot update data frequently, otherwise read tasks will starve to death. If the above lock mechanism is applied to the synchronization of DAG tasks on a multi-core platform, it will not only affect the overall execution efficiency of the system, but also cause subsequent tasks to fail to execute, and in severe cases, will lead to deadlocks and system crashes. Therefore, the DCAS lock-free mechanism is used in the DAG task synchronization process, and the while condition is used to avoid the ABA problem. Under the LITMUSRT multi-core platform, taking multitasking to apply, fill and release Vxworks network buffers at the same time as an example, the triplet mBlk, clBlk, and cluster in the buffer pool respectively use the DCAS lock-free mechanism. The experimental results show that compared with the traditional lock mechanism, the DCAS lock-free mechanism has a better effect in DAG task synchronization, the response time is reduced by 10.4%, and the overall execution efficiency of the system is improved by 4.2%.

     

/

返回文章
返回