Google Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
When you say a stack here, i guess you mean the operating system's stack which keeps track of the calls made among processes and co-ordinates them.
But a Process Control Block doesnt contain a stack dedicated to the process, does it? Can anybody clarify this plz.
Stack here is probably referring to the process's stack (in user space), though it does not specifically state it. Each process has it's own kernel stack as well in kernel space for system calls. Lastly, if a process is using kernel threads (1 user : 1 kernel), then the kernel will maintain a stack for each thread.
blogs.msdn.com/b/oldnewthing/archive/2005/07/29/444912.aspx
this URL answers your questions.
>>
Do the threads have their own stacks, or share the process stack(s), or both?
>>
I think, there is no process dedicated stack. in other words , we can say, process stack same as initially created thread stack.
What is a process: program in execution.
What is a stack: space use to hold the value of the temp variables and keep track of the flow control.
How many stacks can a process have:one (in most of the cases)
What is a thread: its can be think as a unit of CPU execution.
How many threads can a process have:depend on the size of the thread pool and OS
Do the threads have their own stacks, or share the process : threads have their own stack and registers but share the address space with the parent process.
What is a process: program in execution.
- Anonymous April 22, 2012What is a stack: space use to hold the value of the temp variables and keep track of the flow control.
How many stacks can a process have:one (in most of the cases)
What is a thread: its can be think as a unit of CPU execution.
How many threads can a process have:depend on the size of the thread pool and OS
Do the threads have their own stacks, or share the process : threads have their own stack and registers but share the address space with the parent process.