I am studying POSIX threads and saw that there is a way to change the stack size; I am still a layman in general operating systems; so what is the benefit of having a small stack, will i have memory savings at runtime? type in embedded systems?
what is the benefit of having a small stack
The major benefit is that you can create more threads.
On 32-bit OSes (4GiB address space), using 8MiB stack allows you to create a maximum of 512 threads. In reality, you will run out of virtual address much faster, as the kernel usually reserves 1/2 to 1/4 of total address space, and heap and shared libraries fragment the available address space more.
If you are running server processes (think web search), you may want to use "one thread per connection" model, which then limits how many simultaneous connections you can handle on a single machine. Even 10 years ago, 500 threads was way too few compared to what the processor was capable of.
Address space exhaustion is less of a concern with 64-bit OSes.
In addition, once a thread used significant amount of stack, that memory is "stranded".
Imagine you have a web server which handles 1000s of requests per second. If most requests use (say) 32KiB of stack, but an occasional rare request uses 2MiB of stack, and if the requests are distributed randomly across a pool of threads, eventually every thread will have used 2MiB of RAM, and so your process will continue to use N*2MiB of RAM despite only needing N*32KiB 99.99% of the time.
You can avoid such stranding of RAM if you force your threads to use no more than (say) 64KiB of stack.
Having this extra RAM allows you to run other tasks on the same machine (which is how many cloud service providers are able to sell their "excess capacity" at very low cost).