线程不可见的资源监控运行时通过visual studio命令提示符Threads not visible in resource monitor when running through visual studio command prompt

- 此内容更新于:2015-01-06
主题:

我有一个c#控制台类有4线程,当我运行同一个类正确使用visual studio线程创建和我可以看到他们的计算资源监控器,但当我使用命令提示符并编译应用程序使用相同csc和运行资源监控器中我看不到任何线程,但执行相同的代码。 我有下面的代码。

原文:

I have a C# console class having 4 threads, when I run the same class using visual studio threads are properly created and I can see their count in the resource monitor, but when I use the command prompt and compile application using csc and the run same I don't see any threads in the resource monitor but the same code is executed.

I have following code.

public static void startPoint()
    {
        Console.ReadLine();
        var thread1 = new Thread(foo) {Name = "Foo"};
        thread1.Start();

        var thread2 = new Thread(loo) {Name = "Loo"};
        thread2.Start();
    }

when running through visual studio ctrl+f5, no of threads are 13, initially it was 9 then I started 4 threads, making 13

When I run through visual studio command prompt, the application runs but the thread count is one only

CodeCaster的回复:两个场景中,找到ConsoleThread。exe不是.vshost.exe。此外,逻辑线程!=物理线程。

(原文:For both scenarios, find ConsoleThread.exe, not the .vshost.exe. Also, logical threads != physical threads.)

Sriram Sakthivel的回复:你# 39;看着cmd。exe不是ConsoleThread.exe

(原文:You're looking at cmd.exe instead of ConsoleThread.exe)

Pankaj的回复:我打电话的ConsoleThread exe cmd因此我看着cmd

(原文:I am calling the ConsoleThread exe from the cmd hence I am looking at cmd)

Sriram Sakthivel的回复:不知道你如何运行它,但是你的过程将是一个单独的一个。你需要看看ConsoleThread。exe。

(原文:Not sure how you run it, but still your process will be a separate one. You need to look at ConsoleThread.exe only.)