Default streams in a very small C # console application (Visual Studio 2012)

I am trying to figure out what is the purpose of the threads that appear in every new c # application. I created a new console application with an empty Main function:

static void Main(string[] args) { } 

and set a breakpoint at the end of the function, then I looked at the threads window:

Default threads

Sometimes it shows 8 threads, and sometimes 7 threads.

Can anyone explain what the purpose of all these topics is, and why do I need them for such a simple project?

+7
multithreading c # visual-studio-2012
source share
2 answers

In short, these additional streams are associated with GC, Finalizer, VS, and Debugger. Below is a link to a more detailed answer to your question:

Why does this simple .NET console application have so many threads?

+6
source share

First of all, I think we need to understand what flows are?

Themes:

Threading allows your program to do parallel processing so that you can perform more than one operation at a time. For example, you can upload heavy images to the application, perform background tasks, and at that time you can process streaming video in files.

If you will not use streams - then when you upload images to your application, your user interface is stuck so that you can do nothing more, just waiting for the images to complete loading.

So why does our application start with 7-8 threads?

So let's see what topics we have:

By default, a C # program has one thread. This thread executes the code in the program, starting and ending with the main method.

You also have a garbage collector that is responsible for destroying objects when their life cycle ends.

And there are a few more debug threads.

+2
source share

All Articles