answersLogoWhite

0


Best Answer
CPU

central processing unit

Stack

1. An orderly pile, especially one arranged in layers.

2. A section of memory and its associated registers used for temporary storage of information in which the item most recently stored is the first to be retrieved.

D.Ghosh Roy
User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the CPU stack?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Where is the CPU stack is placed?

its placed in RAm


Which CPU register holds address for memory?

The program counter (PC) and the stack pointer (SP).


What section of memory is used to make stack?

Stack memory is memory assigned to a task or other instruction loop that it uses to perform instructions. Stack is used any time variables are declared inline with the code (see example below). Stack is also used for preserving registers whenever the processor switches contexts (from task to interrupt, between interrupts, or between tasks). Stack is provide either by the Operating System when the task is started, statically when a task is defined (as would be in an RTOS), or at compile time if there is no operating system. In the third case, the stacks in the system are assigned for each of the various interrupt contexts and the main loop. Stack usage example: void somefunc(int a) { // "int a" will be in a CPU register int i=0; // May be either a CPU register or on the stack, depending on CPU architecture and compiler. char c[10]; // Will exist on the stack struct somestruct *ss=malloc(sizeof(struct somestruct)); // The memory that ss points to will be in the "heap", the pointer to this memory will be on the stack. }


How does a thread work in a CPU?

A thread in a CPU is a sequence of instructions that the CPU can execute independently from other threads. Each thread has its own program counter, stack pointer, and set of registers. The CPU switches between threads to give the appearance of running multiple tasks simultaneously.


When a function call is made inside a running program the return address is saved on the program stack Who saves it?

The CPU (=Central Processor Unit).


What best describes the function of a computer register?

Registers work like variables in computer code, but they are hard-wired and very fast. Actual variables are stored in RAM, and it is much faster for the CPU to access its own registers than to access RAM. CPU registers are the temporary areas in which software runs in the CPU. The majority of CPU operations are done using the registers. There are also special registers which are usually not directly accessed by user code. There is a flags register, and that is what returns the status of operations so the CPU can easily know if a result was zero, overflowed, carried, etc. There is an Instruction Pointer register which lets the CPU know where it is when executing code. That is not user editable, but user code certainly changes it by design. There is a Stack Pointer (SP) register, at least in PC compatible CPUs. The stack is an area of memory set aside for storing things from registers using the PUSH instruction. The POP instruction restores values into registers from memory. The SP register records where in the stack the next stack operation is to take place. The Call and Return instructions also use the stack to know where to come back to, and software uses the stack to pass parameters between functions and subroutines. So SP is a very important register.


When should the register modifier be used?

When your variable is going to use quite often then we can request compiler to store the variable in CPU Register, but CPU registers are limited so some time your request may not be granted, so in this case it will be stored in Stack. Don't request compiler to store large structure in CPU registers, because they are limited.


How primitive variables are stored on Stack?

Call-stacks are fixed-length and are allocated on a per-thread basis as threads are instantiated. The stack pointer CPU register keeps track of the next available address in the current thread's stack. The compiler computes the length of a function according to the number and type of its local variables (including formal arguments) plus the return address. When the function is invoked, the current stack pointer is adjusted by this amount, creating a "stack frame" specific to that function. Given the start address of the stack frame, the local variables and formal arguments can be referred to via constant offsets within the stack frame. When the function returns, the stack pointer is readjusted, effectively freeing the memory without actually releasing it back to the system. In this way, memory can be allocated and released on the stack with minimum cost.


What is context schedulling?

Context switching is the process of saving the state of a process or thread, and then restoring the state of another process or thread for execution. Context switching enables multitasking by allowing multiple processes or threads to share a single CPU. It involves saving and restoring CPU registers, program counter, and stack pointers.


What is stack space?

A type of RAM that is organized as a stack. or part of RAM that has software to make it operate like a stack. A stack memory operates like one of those chip dispensers they use in Los Vegas. You push the chips onto the stack. When you remove one (called a pop), it was the one on the top, the last one you put in. The first one you put in is the last one you take out. They are used by certain types of computer hardware and software that needs data accessed in that way, FILO (first in last out) and LIFO (last in first out). For example subroutine return addresses. When the CPU executes a subroutine call, the return address is pushed on the stack. The subroutine may call another subroutine, with another return address pushed on the stack. And more. then when the subroutines are exited, the addresses are POPed off the stack and executed. The use of a stack ensures the returns are all executed in the correct order.


What is the significance of asmlinkage modifier in C?

The asmlinkage tag tells gcc that that the function should not expect to find any of its arguments in registers (a common optimization), but only on the CPU's stack. Many kernel functions use the fact, that system_call consumes its first argument, the system call number, and leaves other arguments (which were passed to it in registers) on the stack. All system calls are marked with the asmlinkage tag, so they all look to the stack for arguments.


What is CPU protection?

CPU protection is one who protect the CPU. and the one who destroy the CPU also is the one who protect the CPU and the one who destroy the CPU is the one who protect the CPU and the one who destroy the CPU is the who protect the CPU and the one who destroy the CPU is the one who protect the CPU and the one who destroy the CPU is the who protect the CPU and the one who destroy the CPU is the one who protect the CPU and the one who destroy the CPU is the one who protect the CPU.