I want to know if creating a managed thread in .Net (by calling Thread.Start()
) causes that exactly one native thread to be created in background?
So is there a corresponding native thread for a managed threads?
If yes, when a managed thread waits or sleeps, does it mean that the corresponding native thread also waits or sleeps?
It is important to distinguish between these two types of process memory because each thread will have its own stack, but all the threads in a process will share the heap. Threads are sometimes called lightweight processes because they have their own stack but can access shared data.
Threads are not independent of one another like processes are, and as a result threads share with other threads their code section, data section, and OS resources (like open files and signals). But, like process, a thread has its own program counter (PC), register set, and stack space.
Yes , in multithreading each thread has its own stack. having a separate stack is what makes thread's independent of each other.
A manageable version of a ThreadFactory . A ManagedThreadFactory extends the Java™ SE ThreadFactory to provide a method for creating threads for execution in a Java™ EE environment.
Yes, a .NET Thread maps to a native operating system thread on all current CLR hosts.
There's an option to map it to something else in the hosting api through the ICLRTaskManager interface, like a fiber, but that is not actually implemented in any of the main-stream hosts. The SQL Server team at the .NET 2.0 time frame attempted this but the project was abandoned when they could not make it reliable enough. This was not tried again. Technically you could run into a custom hosted CLR, started by an unmanaged program, that implemented this mapping but the odds are rather low.
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