BD-MISC-TRANS-1: 事务管理与规范检测

需积分: 48 54 下载量 141 浏览量 更新于2024-08-08 收藏 3.09MB PDF 举报
"设计和分析实验方法与R语言应用——约翰·劳森著" 在这个部分,我们聚焦于MISRA-C:2004标准在关键系统中使用C语言的指导原则,特别是关于“始终关闭事务”的规则【BD-MISC-TRANS-1】。MISRA-C是一套旨在提高嵌入式系统软件质量与安全性的编程规则,对于关键领域的软件开发如汽车和航空工业至关重要。 规则【BD-MISC-TRANS-1】强调了正确管理事务的重要性,确保事务在使用后被适当地关闭。事务通常涉及到数据库操作、并发控制或其他需要开始和结束的动作。不正确地关闭事务可能导致数据一致性问题、资源泄漏或系统性能下降。 为了实现这一规则,开发者需要识别并规范那些开始和结束事务的函数。这包括配置参数化的对话框,其中有两个表格:一个是“开始事务的函数”,另一个是“终止事务的函数”。这些表格允许开发者指定哪些函数是事务的起始点和终点,并且可以通过启用或排除列表来控制分析的范围。 在“开始事务的函数”表格中,开发者需要详细描述哪些函数启动了事务。这可能包括函数返回事务对象、调用了开始事务的方法(如`transaction->open()`),或者函数的参数中包含事务对象。每个条目需要明确指出在这些情况下的行为,例如,返回的事务对象、此对象是否为事务、以及受影响的参数序号。 特别要注意的是,如果函数名与类型声明的未修饰名称完全匹配,那么这个函数被视为构造函数,这在某些情况下会启动事务。在这种情况下,必须标记“此”对象为事务对象,尽管其他字段的更改对构造函数的分析没有影响。 在“终止事务的函数”表格中,应列出用于关闭事务的函数,确保在事务完成后执行必要的清理工作。这同样需要精确的配置,以确保所有开启的事务都能正确关闭,防止资源泄漏。 通过遵循MISRA-C:2004的这一规则,开发者能够增强代码的可靠性和安全性,这对于依赖C语言构建的关键系统来说是至关重要的。这不仅涉及编程实践,也涉及到代码审查和静态分析工具,如C++test 9.2,它能够帮助检测和修复不符合MISRA-C规则的编码错误。 理解和实施【BD-MISC-TRANS-1】规则对于编写高效且安全的C代码是不可或缺的,特别是在需要高可靠性的系统中,如航空航天或医疗设备的软件开发。同时,利用支持MISRA-C标准的工具可以提高代码质量和团队的工作效率。

4 Experiments This section examines the effectiveness of the proposed IFCS-MOEA framework. First, Section 4.1 presents the experimental settings. Second, Section 4.2 examines the effect of IFCS on MOEA/D-DE. Then, Section 4.3 compares the performance of IFCS-MOEA/D-DE with five state-of-the-art MOEAs on 19 test problems. Finally, Section 4.4 compares the performance of IFCS-MOEA/D-DE with five state-of-the-art MOEAs on four real-world application problems. 4.1 Experimental Settings MOEA/D-DE [23] is integrated with the proposed framework for experiments, and the resulting algorithm is named IFCS-MOEA/D-DE. Five surrogate-based MOEAs, i.e., FCS-MOEA/D-DE [39], CPS-MOEA [41], CSEA [29], MOEA/DEGO [43] and EDN-ARM-OEA [12] are used for comparison. UF1–10, LZ1–9 test problems [44, 23] with complicated PSs are used for experiments. Among them, UF1–7, LZ1–5, and LZ7–9 have 2 objectives, UF8–10, and LZ6 have 3 objectives. UF1–10, LZ1–5, and LZ9 are with 30 decision variables, and LZ6–8 are with 10 decision variables. The population size N is set to 45 for all compared algorithms. The maximum number of FEs is set as 500 since the problems are viewed as expensive MOPs [39]. For each test problem, each algorithm is executed 21 times independently. For IFCS-MOEA/D-DE, wmax is set to 30 and η is set to 5. For the other algorithms, we use the settings suggested in their papers. The IGD [6] metric is used to evaluate the performance of each algorithm. All algorithms are examined on PlatEMO [34] platform.

2023-05-24 上传