A doubt on basics -- memory allocation

Pages: 12
So how many stacks would be there? say for example each process creates its own thread and if there are 1000 processes running then would 1000 different stack be there in the main memory?
Yes, but don't confuse the terms "process" and "thread". There's as many stacks allocated as threads the system is running.
I don't see the need to access anything other than the variables in the top frame. At least this is how I have thought about it--it is probably not technically correct.


we do need to access the others. For example, when calling a function, which needs three arguments, we should push all the three arguments onto the stack, and call that function. When that function runs, it first saves the %ebp onto the stack, and set its own %ebp (movl %esp, %ebp). The function accesses to the arguments passed to it by using
movl n(%ebp), somewhere ( n is a number to set offset from %ebp). it is so important, and without it, a called function can not use the arguments.
So the stacks will all be in the main memory??? if so.. is there a limit on the number of threads that OS can handle at a given time?
Of course.
Topic archived. No new replies allowed.
Pages: 12