递归转化成非递归过程_8086微处理器中的递归和重入过程
遞歸轉(zhuǎn)化成非遞歸過(guò)程
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:
眾所周知,過(guò)程是一組單獨(dú)編寫(xiě)的指令,可在需要時(shí)隨時(shí)在代碼中使用。 正常的過(guò)程執(zhí)行包括調(diào)用過(guò)程,將處理器的控制權(quán)移交給該過(guò)程,然后將控制權(quán)返回給調(diào)用程序。 可以很好地理解如下:
Apart from this, we have two special types of procedures: Recursive Procedures and Re-entrant procedures...
除此之外,我們有兩種特殊類型的過(guò)程: 遞歸過(guò)程和重入過(guò)程 ...
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:
遞歸過(guò)程是一個(gè)調(diào)用自身的過(guò)程。 這導(dǎo)致從過(guò)程內(nèi)部一次又一次地生成過(guò)程調(diào)用。 這可以理解為:
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.
遞歸過(guò)程將繼續(xù)執(zhí)行,直到達(dá)到終止條件為止。 遞歸過(guò)程非常有效地使用和實(shí)施,但是它們占用了大量的堆棧空間,并且過(guò)程中的過(guò)程鏈接需要花費(fèi)更多的時(shí)間,并且會(huì)給處理器帶來(lái)額外的負(fù)擔(dān)。
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:
重入過(guò)程是一種非常特殊的過(guò)程。 在這種過(guò)程中,過(guò)程1稱為主線程序,然后過(guò)程2稱為表單過(guò)程1,然后過(guò)程1又稱為表單過(guò)程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.
這稱為重入過(guò)程,因?yàn)橐粋€(gè)過(guò)程從另一個(gè)過(guò)程重新進(jìn)入自身,該另一個(gè)過(guò)程也存在于其自身內(nèi)部。 重入過(guò)程在以下三種情況下發(fā)生:當(dāng)過(guò)程進(jìn)行遞歸時(shí),在程序內(nèi)部實(shí)現(xiàn)多線程時(shí)或在生成某些中斷時(shí)。 像遞歸過(guò)程一樣,在重入過(guò)程中也要有一個(gè)終止條件,這一點(diǎn)也很重要,否則由于無(wú)限的過(guò)程調(diào)用,我們可能會(huì)遇到機(jī)器暫停的情況。
翻譯自: https://www.includehelp.com/embedded-system/recursive-and-re-entrant-procedures-in-8086-microprocessor.aspx
遞歸轉(zhuǎn)化成非遞歸過(guò)程
總結(jié)
以上是生活随笔為你收集整理的递归转化成非递归过程_8086微处理器中的递归和重入过程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Spring Cloud Alibaba
- 下一篇: 再见 Postman!Apifox 才是