The Windows Internal book 5th edition has the following comment in page 360.
The stack size for the initial thread is taken from the image—there’s no way to specify another size.
I understand that for Windows OS, each thread is given 4K or 16K (depending on system) stack, and the size is fixed.
Then how about the stack in .NET?
The Microsoft stack is a set of applications and tools that are designed to work together—from the back-end data base to coding languages (e.g., C#) and development environments (e.g., Visual Studio), all the way up to platforms and applications, like cloud apps, Microsoft (Office) 365, and business applications like ...
Windows Presentation Foundation (WPF) Most enterprise-grade applications trust Microsoft's technology stack for its dependable performance.
ReactJS and NodeJS are two of the most popular web development stacks in 2022. They are both relatively new and modern frameworks. They are also not language-specific, so developers can use the same skills they use to work on front-end web development projects to work with ReactJS and NodeJS.
If you're new to web development, the MEAN or MERN stack are good starting points. These stacks are relatively easy to learn, and they use a single programming language (JavaScript) which makes things simpler.
Yes, the size for the startup thread is determined by a value in the .EXE file header. Necessarily so, it is the OS that creates the thread, before any code in the program can run. It calls the entrypoint of the program, CorExeMain().
The managed compiler you use writes that value into the EXE file header. Current .NET compilers select 1 MB when you target x86 or Any CPU, 4 MB when you target x64. This is however not fixed, you can modify the value with the Editbin.exe utility, /STACK command line option. You could use this post-build event to get a 2MB stack:
set path=%path%;$(DevEnvDir);$(DevEnvDir)..\..\vc\bin
editbin.exe /STACK:2097152 "$(TargetPath)"
The stack size for threads that you create yourself are under your control, the Thread class constructor has overloads that lets you specify the size. You cannot make it too small, if clips the value to 256 KB. That's necessary, the just-in-time compiler also uses the stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With