微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别
生活随笔
收集整理的這篇文章主要介紹了
微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
微內核和宏內核的區別
Prerequisite
先決條件
Procedure in 8086 Microprocessor
8086微處理器中的過程
Macros in 8086 Microprocessor
8086微處理器中的宏
過程和宏之間的區別 (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. |
| 微處理器可以有效處理的指令數 | 最好將過程用于大量指令集。 因此,當指令數大于10時,最好使用過程。 | 當集合中的指令數較少時,宏比過程有用。 因此,當子程序包含少于10條指令時,在這種情況下使用宏會更有效。 |
| 所使用的匯編程序指令 | 匯編程序指令-PROC用于定義過程。 匯編程序指令ENDP用于指示過程主體已結束。 | 匯編程序指令MACRO用于定義宏,并指示程序的主體已結束,因此使用匯編程序指令ENDM。 |
| 執行過程 | 每次調用一個過程時,都需要CALL和RET指令來轉移對指令執行的控制。 | 每次調用宏時,微處理器的匯編程序都將宏的整個指令集置于主程序形式中,以進行宏調用。 |
| 執行時間處理時間 | 這些過程的執行速度比宏要慢,因為每次調用一個過程時,都需要將其與調用程序集成和鏈接,這需要時間。 | 與過程相比,宏的執行速度更快,因為不需要將宏與調用程序集成或鏈接。 每次調用時,它都被簡單地加載到主存儲器中。 |
| 開銷時間 | 在調用過程并將控件返回到調用程序時會發生開銷時間。 | 避免了開銷時間,因為不會進行呼叫和返回。 |
| 所需的內存量 | 與宏相比,過程只需要較少的內存,因為過程只寫入一次并加載到主存儲器中,并且在調用時鏈接到調用程序。 | 宏需要大量的內存,因為每次調用宏時都會將其加載到主內存中。 |
| 機器代碼生成的次數 | 定義過程后,機器代碼(包含過程中的指令)僅生成一次。 | 每次調用宏時都會生成機器代碼(包含宏中的指令)。 |
| 參數傳遞 | 在過程中,我們無法將參數直接傳遞給id。 但是,可以使用寄存器以及通過堆棧將值傳遞給它。 | 宏能夠在其定義內處理參數,我們可以在調用該宏的語句中傳遞它們。 |
翻譯自: https://www.includehelp.com/embedded-system/procedures-vs-macros-in-8086-microprocessors.aspx
微內核和宏內核的區別
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的微内核和宏内核的区别_8086微处理器中的过程和宏之间的区别的全部內容,希望文章能夠幫你解決所遇到的問題。