Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Free multiple threads?

Tags:

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?

like image 362
Aniket Avatar asked Oct 13 '12 21:10

Aniket


People also ask

What is free threading?

“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 multi threading with example?

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.

Can multithreading be lock free?

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.


1 Answers

I imagine threads you are seeing are:

  1. The main thread.
  2. The finalizer thread
  3. The In-process debugger helper thread
  4. The concurrent GC thread.

This post details some of the special CLR threads.

like image 180
Lee Avatar answered Oct 08 '22 01:10

Lee