What is a computer stack and how many stacks are there in computer?

I would like to know how many stacks are there in a computer and what is a stack in reality and what is the function of each stack.
Thank you in advance

Replies

  • Jeffrey Arulraj
    Jeffrey Arulraj
    Remeber a pile of Coins or a pile of books arranged one over the other That is a really good example of a stack

    In a stack the last placed object can only be taken out at the first time

    That is when you place 10 books one over the other the book on top only can be removed @ the first time though you wish to take the last book This is called stack

    The first question I am not sure about it mate

    In a computer the Main Memory is based on Stack concept I guess
  • Pensu
    Pensu
    Stack is just a pile with a last in first out mechanism. In computer science, stacks are used quite a lot. The simplest example is functions. When a function calls another function it just put the other function on the top of the stack. So, the top would be executed first.

    As far as the number of stacks is concerned, I dont think there is a limit. I guess it depends on your system's memory.
  • rukawa
    rukawa
    Thak you for your answers. Each process have a stack right? what is it used for and where is it stored?
  • Pensu
    Pensu
    Stack is a logical entity. The computer represent the memory in form of a stack. So, stack is nothing but your memory only. Any as far as I know every thread has a stack.
  • rukawa
    rukawa
    In Mr. Tanenbaum's book "operating systems", he says that processes in UNIX have their memory divided up into 3 segments :

    - the text segment (i.e the program code)
    - the data segment (i.e the variables)
    - the stack segment.

    rfdfgdf

    The stack segment is used for what?
  • Pensu
    Pensu
    Well, the stack segment mainly stores local variables, while the data segment stores global and static variables.
  • rukawa
    rukawa
    In the body of the process's program there are a numbrer of functions. Everytime a function is called, the process uses its stack (I mean the process's stack) to store the parameters and local variables and return addresses, is that true? is the process's stack used fot all the functions of the program?
  • Pensu
    Pensu
    Well, that makes senses. The function shouldn't have it's stack outside process's memory space.
  • Nayan Goenka
    Nayan Goenka
    There is nothing like a Computer Stack. We have stacks. It is a data structure which allows you to store arrays of data together in a LIFO format that is Last in first out.

    The number of stacks is not specific. A stack can be of any size and length. If you have doubt any particular stack in any program or you have read about it somewhere and you didnt understand then paste that content here. We will try to explain.
  • rukawa
    rukawa
    The process's program contains functions which may call other functions. When a function calls another function, the address that the called function should return to is stored in the stack. But what exactly is this address :
    - the address of the instruction following the instruction that called the function
    - the address of the instruction that called the function
    - the address of the program itself
    what is it?
  • Pensu
    Pensu
    Option A.....😉

You are reading an archived discussion.

Related Posts

can i do mba after b.tech in aeronautics . what are its advantages and disadvantages ??
CSIR has announced exams. Following link will be useful for the candidates. https://csirhrdg.res.in/mainnotificationnet_dec2013.pdf Any suggestions exam materials etc will be useful for others thank you. ATB !👍
The title may be a little misleading But here we are talking about a Chinese tech to convert brain wave into sound Just like Mozart. This process is primarily a...
We had the facility of WiFi in our hostel till last semester but the hostel governing people removee WiFi from hostel this semester.When we approached them and enquired about the...
Hey guys, Let us put on a discussion about the deadliest form of action today and what will it be in next 20 years. Right now we are boasting ourselves...