递归转化成非递归过程_8086微处理器中的递归和重入过程
遞歸轉化成非遞歸過程
As we all know that a procedure is a set of instruction written separately which can be used any time in the code when required. A normal procedure execution includes calling of the procedure, shifting the control of the processor to the procedure, and then returning the control to the calling program. This can be well understood as follows:
眾所周知,過程是一組單獨編寫的指令,可在需要時隨時在代碼中使用。 正常的過程執行包括調用過程,將處理器的控制權移交給該過程,然后將控制權返回給調用程序。 可以很好地理解如下:
Apart from this, we have two special types of procedures: Recursive Procedures and Re-entrant procedures...
除此之外,我們有兩種特殊類型的過程: 遞歸過程和重入過程 ...
1)遞歸程序 (1) Recursive procedures)
A recursive procedure is a procedure which calls itself. This results in the procedure call to be generated from within the procedures again and again. This can be understood as follows:
遞歸過程是一個調用自身的過程。 這導致從過程內部一次又一次地生成過程調用。 這可以理解為:
Image reference: https://images.app.goo.gl/kyJgWtWnF5faQfTe7
圖片參考:https://images.app.goo.gl/kyJgWtWnF5faQfTe7
The recursive procedures keep on executing until the termination condition is reached. The recursive procedures are very effective to use and to implement but they take a large amount of stack space and the linking of the procedure within the procedure takes more time as well as puts extra load on the processor.
遞歸過程將繼續執行,直到達到終止條件為止。 遞歸過程非常有效地使用和實施,但是它們占用了大量的堆??臻g,并且過程中的過程鏈接需要花費更多的時間,并且會給處理器帶來額外的負擔。
2)重入程序 (2) Re-entrant procedures)
The re-entrant procedure is a very special kind of procedure. In such kind of procedure, procedure 1 is called the mainline program, then procedure 2 is called form procedure 1 and then again procedure 1 is called form procedure 2. This can be well understood from the following diagram:
重入過程是一種非常特殊的過程。 在這種過程中,過程1稱為主線程序,然后過程2稱為表單過程1,然后過程1又稱為表單過程2。這可以從下圖中很好地理解:
Image reference: https://images.app.goo.gl/HKw5j6K6HQk79ki29
圖片參考:https://images.app.goo.gl/HKw5j6K6HQk79ki29
This is called a re-entrant procedure because a procedure is re-entering into itself form another procedure which is also present inside its own body. The re-entrant procedure occurs in the following three conditions: when the procedure is undergoing recursion, when multi-threading is being implemented inside a program or when some interruption is being generated. Like the recursive procedures, it is important to have a termination condition for the procedures in the re-entrant procedures also, else we can face machine halts due to infinite procedure calls.
這稱為重入過程,因為一個過程從另一個過程重新進入自身,該另一個過程也存在于其自身內部。 重入過程在以下三種情況下發生:當過程進行遞歸時,在程序內部實現多線程時或在生成某些中斷時。 像遞歸過程一樣,在重入過程中也要有一個終止條件,這一點也很重要,否則由于無限的過程調用,我們可能會遇到機器暫停的情況。
翻譯自: https://www.includehelp.com/embedded-system/recursive-and-re-entrant-procedures-in-8086-microprocessor.aspx
遞歸轉化成非遞歸過程
總結
以上是生活随笔為你收集整理的递归转化成非递归过程_8086微处理器中的递归和重入过程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring Cloud Alibaba
- 下一篇: 再见 Postman!Apifox 才是