Skip to content
Related Articles
Open in App
Not now

Related Articles

How much Stack size required for BIOS interrupt call?

Improve Article
Save Article
  • Last Updated : 14 Sep, 2022
Improve Article
Save Article
  • Stack: It is a linear data structure that follows the LIFO( Last In First Out ) order for performing the operations. 
  • BIOS: It provides a set of instructions and is responsible for booting the computer. The BIOS performs all the tests needed at startup time.

Stack size required for bios interrupt calls?

1)  For No interrupts generated in task

Formula For calculating Stack size required for bios no interrupt call

Task stack size = size used by user + argument size of the service-call + 6 (bytes)

2)  For Interrupts generated in task

The formula for calculating Stack size required for bios interrupt call

Task stack size = size used by user + service-call argument size + 6 + 20 (bytes)

Example:

Suppose If we are given a task “Task1”, function GFG1 (using 12 bytes of the stack) makes a gfg_geek1 service call, and function GFG2 (using 20 bytes of the stack) makes a gfg_geek2 service call.

Since this is a  interrupts generated task we will use Formula 2 for calculating the size.

  • Pattern of gfg_geek1 = size used by user (for function A) + service-call argument size (gfg_geek1) + 6 + 20
    = 124620
    = 42 bytes
  • Pattern of gfg_geek2 = size used by user (for function B) + service-call argument size (gfg_geek2) + 6 + 20
    = 200620
    = 26 bytes

Now we will compare the pattern of gfg_geek1 with the pattern of gfg_geek2 now the pattern that uses the most stack is pattern gfg_geek1, at 42 bytes. The size that needs to be specified in the system for the file will be 42 minus 6 bytes, which equals 36 bytes. 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!