微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别
生活随笔
收集整理的這篇文章主要介紹了
微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
微內(nèi)核和宏內(nèi)核的區(qū)別
Prerequisite
先決條件
Procedure in 8086 Microprocessor
8086微處理器中的過(guò)程
Macros in 8086 Microprocessor
8086微處理器中的宏
過(guò)程和宏之間的區(qū)別 (Differences between Procedures and Macros )
| Number of Instructions that can be effectively handled by the microprocessor | It 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 used | The 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 Time | The 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 time | Overhead 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 required | The 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 generated | The 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 parameters | In 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. |
| 微處理器可以有效處理的指令數(shù) | 最好將過(guò)程用于大量指令集。 因此,當(dāng)指令數(shù)大于10時(shí),最好使用過(guò)程。 | 當(dāng)集合中的指令數(shù)較少時(shí),宏比過(guò)程有用。 因此,當(dāng)子程序包含少于10條指令時(shí),在這種情況下使用宏會(huì)更有效。 |
| 所使用的匯編程序指令 | 匯編程序指令-PROC用于定義過(guò)程。 匯編程序指令ENDP用于指示過(guò)程主體已結(jié)束。 | 匯編程序指令MACRO用于定義宏,并指示程序的主體已結(jié)束,因此使用匯編程序指令ENDM。 |
| 執(zhí)行過(guò)程 | 每次調(diào)用一個(gè)過(guò)程時(shí),都需要CALL和RET指令來(lái)轉(zhuǎn)移對(duì)指令執(zhí)行的控制。 | 每次調(diào)用宏時(shí),微處理器的匯編程序都將宏的整個(gè)指令集置于主程序形式中,以進(jìn)行宏調(diào)用。 |
| 執(zhí)行時(shí)間處理時(shí)間 | 這些過(guò)程的執(zhí)行速度比宏要慢,因?yàn)槊看握{(diào)用一個(gè)過(guò)程時(shí),都需要將其與調(diào)用程序集成和鏈接,這需要時(shí)間。 | 與過(guò)程相比,宏的執(zhí)行速度更快,因?yàn)椴恍枰獙⒑昱c調(diào)用程序集成或鏈接。 每次調(diào)用時(shí),它都被簡(jiǎn)單地加載到主存儲(chǔ)器中。 |
| 開銷時(shí)間 | 在調(diào)用過(guò)程并將控件返回到調(diào)用程序時(shí)會(huì)發(fā)生開銷時(shí)間。 | 避免了開銷時(shí)間,因?yàn)椴粫?huì)進(jìn)行呼叫和返回。 |
| 所需的內(nèi)存量 | 與宏相比,過(guò)程只需要較少的內(nèi)存,因?yàn)檫^(guò)程只寫入一次并加載到主存儲(chǔ)器中,并且在調(diào)用時(shí)鏈接到調(diào)用程序。 | 宏需要大量的內(nèi)存,因?yàn)槊看握{(diào)用宏時(shí)都會(huì)將其加載到主內(nèi)存中。 |
| 機(jī)器代碼生成的次數(shù) | 定義過(guò)程后,機(jī)器代碼(包含過(guò)程中的指令)僅生成一次。 | 每次調(diào)用宏時(shí)都會(huì)生成機(jī)器代碼(包含宏中的指令)。 |
| 參數(shù)傳遞 | 在過(guò)程中,我們無(wú)法將參數(shù)直接傳遞給id。 但是,可以使用寄存器以及通過(guò)堆棧將值傳遞給它。 | 宏能夠在其定義內(nèi)處理參數(shù),我們可以在調(diào)用該宏的語(yǔ)句中傳遞它們。 |
翻譯自: https://www.includehelp.com/embedded-system/procedures-vs-macros-in-8086-microprocessors.aspx
微內(nèi)核和宏內(nèi)核的區(qū)別
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 独栋别墅多少钱啊?
- 下一篇: 前序遍历m-ary树_在Ruby中使用a