Home » Embedded Systems

Recursive and Re-entrant Procedures in 8086 Microprocessor

In this article, we are going to study about the two special types of procedures whose functioning is a bit different from the normal procedures. These are the Recursive procedures and Re-entrant procedures. Here in this article, we are going to discuss the control mechanism of the processor while executing these types of Procedures.
Submitted by Monika Sharma, on August 04, 2019

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:

Recursive and Re-entrant Procedures in 8086 Microprocessor (1)

Apart from this, we have two special types of procedures: Recursive Procedures and Re-entrant procedures...

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:

Recursive and Re-entrant Procedures in 8086 Microprocessor (2)

Image reference: 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.

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:

Recursive and Re-entrant Procedures in 8086 Microprocessor (3)

Image reference: 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.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.