Skip to content
Related Articles

Related Articles

Improve Article

Stack Implementation in Operating System uses by Processor

  • Last Updated : 19 Sep, 2019

A stack is an associate ordered a set of components, only one of that (last added) are often accessed at a time. The point of access is named the highest of the stack. The number of components within the stack, or length of the stack, is variable. Items could solely be side to or deleted from the highest of the stack. For this reason, a stack is additionally referred to as a pushdown list or a last-in-first-out (LIFO) list.

The implementation of a stack needs that there be some set of locations accustomed store the stack components. A typical approach is illustrated in the below diagram.

The location of the continuous block is reserved in main memory (or virtual memory) for the stack. Most of the time, the block is part full of stack components and also the remainder is accessible for stack growth. Three addresses area unit required for correct operation, and these area units typically keep in processor registers:

  • Stack Pointer:
    It contains the address of this prime of the stack. If the associated item is appended to (PUSH) or deleted from (POP) the stack, the pointer is decremented or incremented to contain the address of the new prime of the stack.
  • Stack Base:
    It contains the address of a very cheap location within the reserved block. this can be the primary location to be used once the associated item is side to associate empty stack. If an effort is formed to POP a component once the stack is empty, an error is reported.

  • Stack Limit:
    It contains the address of the opposite finish, or top, of the reserved block. If an effort is formed to PUSH a component once the stack is full, an error is reported.

Traditionally, and on most processors, these days, the base of the stack is at the high address finish of the reserved stack block, and also the limit is at the low-address finish. so, the stack will grow from higher addresses to lower addresses.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.


My Personal Notes arrow_drop_up
Recommended Articles
Page :