微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别

微内核和宏内核的区别

Prerequisite

先决条件

过程和宏之间的区别 (Differences between Procedures and Macros )

CharacteristicProcedureMacro
Number of Instructions that can be effectively handled by the microprocessorIt is better to use Procedures for a set of a large number of instructions. Hence, it is optimal to use Procedures when the number of instructions is more than 10.Macros are useful over Procedures when the number of instructions in the set is less. Therefore, when the subprogram contains less than 10 instructions, Macros are more efficient to use in such cases.
Assembler Directives usedThe assembler directive - PROC is used to define a Procedure. And the assembler directive - ENDP is used to indicate that the body of the procedure has ended.The assembler directive- MACRO is used to define a Macro, And to indicate that the body of the procedure has ended, the assembler directive- ENDM is used.
Execution Process Every time a procedure is called, the CALL and RET instructions are required for shifting the control of instruction execution. Every time a Macro is called, the assembler of the microprocessor places the entire set of instructions of the Macros in the mainline program form where the call to the macro is made.
Execution TimeThe Procedures execute slower than the Macros because every time a procedure is called, it is necessary to integrate and link it with the calling program and this takes time. The execution of macros is faster as compared to procedures because there is no need to integrate or link the macros with the calling program. It is simply loaded into the main memory every time it is called.
Overhead timeOverhead time occurs while calling the procedure and returning the control to the calling program. Overhead time is avoided as calling and returning does not take place.
Amount of memory requiredThe Procedures require less amount of memory than the Macros because a Procedure is written and loaded into the main memory only once, and is linked to the calling program when called.The Macros require a large amount of memory because it is loaded into the main memory every time it is called.
Number of times machine code generatedThe machine code (containing the instructions within the Procedure) is generated only once when the procedure is defined.The machine code (containing the instructions within the Macros) is generated every time the macro is called.
Passing of parametersIn procedures, we cannot pass the parameter to id directly. However, the values can be passed to it using registers and also via stack.The macros are capable of handling parameters within their definition and we can pass them in the statement which calls the macro.
特性 程序 巨集
微处理器可以有效处理的指令数 最好将过程用于大量指令集。 因此,当指令数大于10时,最好使用过程。 当集合中的指令数较少时,宏比过程有用。 因此,当子程序包含少于10条指令时,在这种情况下使用宏会更有效。
所使用的汇编程序指令 汇编程序指令-PROC用于定义过程。 汇编程序指令ENDP用于指示过程主体已结束。 汇编程序指令MACRO用于定义宏,并指示程序的主体已结束,因此使用汇编程序指令ENDM。
执行过程 每次调用一个过程时,都需要CALL和RET指令来转移对指令执行的控制。 每次调用宏时,微处理器的汇编程序都将宏的整个指令集置于主程序形式中,以进行宏调用。
执行时间处理时间 这些过程的执行速度比宏要慢,因为每次调用一个过程时,都需要将其与调用程序集成和链接,这需要时间。 与过程相比,宏的执行速度更快,因为不需要将宏与调用程序集成或链接。 每次调用时,它都被简单地加载到主存储器中。
开销时间 在调用过程并将控件返回到调用程序时会发生开销时间。 避免了开销时间,因为不会进行呼叫和返回。
所需的内存量 与宏相比,过程只需要较少的内存,因为过程只写入一次并加载到主存储器中,并且在调用时链接到调用程序。 宏需要大量的内存,因为每次调用宏时都会将其加载到主内存中。
机器代码生成的次数 定义过程后,机器代码(包含过程中的指令)仅生成一次。 每次调用宏时都会生成机器代码(包含宏中的指令)。
参数传递 在过程中,我们无法将参数直接传递给id。 但是,可以使用寄存器以及通过堆栈将值传递给它。 宏能够在其定义内处理参数,我们可以在调用该宏的语句中传递它们。

翻译自: https://www.includehelp.com/embedded-system/procedures-vs-macros-in-8086-microprocessors.aspx

微内核和宏内核的区别

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值