So I have a simple enough console app:
class Program
{
static void Main(string[] args)
{
Console.ReadKey();
}
}
I've built it with release configuration. When I run it and open task manager, I see it has 4 threads. Why is this happening even though I'm not creating any threads?
This can't possibly be each application. I tried opening notepad and it has just 1 thread. Although it is a native app and my console app is managed.
Any ideas?
“free-threaded” for MTA apartment means threads can read COM data simultaneously;but to update COM data in MTA, your source codes should use synchronization manner by yourself. In the other hand, STA is “thread-safe” by COM itself. Your program can access STA data diretly and easily.
What is MultiThreading? Multithreading enables us to run multiple threads concurrently. For example in a web browser, we can have one thread which handles the user interface, and in parallel we can have another thread which fetches the data to be displayed. So multithreading improves the responsiveness of a system.
Lock-free techniques allow multiple threads to work together in a non-blocking way, often achieving incredible performance. As the name suggests, locks are not used. If the idea of a multithreaded program without mutexes makes you uncomfortable, you are quite sane. Yet lock-free systems are pervasive.
I imagine threads you are seeing are:
This post details some of the special CLR threads.
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