通过GUI的作业进程在同一个虚拟处理器上执行,或者通过命令行使用任何空闲的虚拟处理器
Processes of Job through GUI executes on same Virtual Processeor While through Command line Utilises Whatever VIrtual Processor is Free
我有一个应用程序。我们可以通过GUI和命令行在上面运行作业。该服务器有2个物理CPU和32个处理器核心。CPU1上的处理器内核为(0-7,16-23)而在CPU2上是(8-15,24-31)。当我从命令行运行作业时,我可以看到我的进程在不同的虚拟处理器内核上运行,其中包括CPU1和CPU2的虚拟处理器核心。而当我通过GUI运行它时,只使用了1个虚拟处理器核心,在我的情况下,它是物理CPU 2的cpu31。这导致了性能问题,因为从GUI完成作业比在命令行上完成作业需要更多的时间。
通过命令行运行的作业的prstat统计信息显示:-
9282 hercules 40M 27M sleep 20 0 0:00:01 0.1% process2/1
9282 hercules 45M 33M cpu23 29 0 0:00:01 0.1% process2/2
9282 hercules 45M 33M sleep 49 0 0:00:01 0.1% process2/2
9359 hercules 39M 29M sleep 60 0 0:00:00 0.1% process1/1
9282 hercules 45M 33M sleep 59 0 0:00:01 0.1% process2/2
9359 hercules 39M 29M sleep 59 0 0:00:00 0.1% process1/1
9282 hercules 45M 33M sleep 59 0 0:00:01 0.1% process2/2
9282 hercules 45M 33M sleep 59 0 0:00:01 0.1% process2/2
9282 hercules 45M 33M sleep 49 0 0:00:01 0.1% process2/2
9282 hercules 45M 33M sleep 59 0 0:00:01 0.1% process2/2
14945 hercules 53M 42M cpu28 50 0 0:00:04 0.6% process1/1
14945 hercules 53M 42M cpu15 40 0 0:00:09 1.1% process1/1
14945 hercules 53M 42M cpu8 40 0 0:00:14 1.5% process1/1
14945 hercules 54M 42M cpu11 20 0 0:00:19 1.9% process1/1
14945 hercules 54M 43M cpu12 10 0 0:00:24 2.1% process1/1
14945 hercules 54M 43M cpu9 20 0 0:00:29 2.3% process1/1
14945 hercules 54M 43M cpu8 20 0 0:00:34 2.5% process1/1
14945 hercules 54M 43M cpu11 20 0 0:00:39 2.6% process1/1
14945 hercules 55M 44M cpu30 10 0 0:00:44 2.7% process1/1
14945 hercules 55M 44M cpu3 20 0 0:00:49 2.8% process1/1
14945 hercules 55M 44M cpu8 20 0 0:00:51 2.4% process1/1
14945 hercules 55M 44M cpu28 10 0 0:00:56 2.6% process1/1
14945 hercules 56M 44M cpu9 10 0 0:01:01 2.7% process1/1
14945 hercules 56M 45M cpu13 0 0 0:01:06 2.8% process1/1
14945 hercules 56M 45M cpu25 10 0 0:01:11 2.8% process1/1
14945 hercules 56M 45M cpu2 0 0 0:01:16 2.9% process1/1
14945 hercules 56M 45M sleep 50 0 0:01:20 2.8% process1/1
14945 hercules 57M 46M cpu15 0 0 0:01:25 2.8% process1/1
14945 hercules 57M 46M cpu24 0 0 0:01:30 2.9% process1/1
14945 hercules 57M 46M cpu29 0 0 0:01:35 2.9% process1/1
14945 hercules 57M 46M cpu14 0 0 0:01:40 3.0% process1/1
14945 hercules 58M 47M cpu13 0 0 0:01:45 3.0% process1/1
14945 hercules 58M 47M cpu5 50 0 0:01:53 2.9% process1/1
14945 hercules 58M 47M cpu8 50 0 0:01:58 2.9% process1/1
14945 hercules 58M 47M cpu8 40 0 0:02:03 3.0% process1/1
14945 hercules 59M 48M cpu14 30 0 0:02:08 3.0% process1/1
14945 hercules 59M 48M cpu29 30 0 0:02:13 3.0% process1/1
14945 hercules 59M 48M cpu11 20 0 0:02:18 3.0% process1/1
14945 hercules 60M 49M cpu30 30 0 0:02:23 3.0% process1/1
14945 hercules 60M 49M cpu12 20 0 0:02:28 3.1% process1/1
14945 hercules 86M 78M cpu9 53 0 0:02:34 1.3% process1/2
14945 hercules 91M 83M cpu31 43 0 0:02:39 0.7% process1/2
14945 hercules 92M 83M cpu9 53 0 0:02:41 0.6% process1/2
14945 hercules 92M 83M cpu15 45 0 0:02:42 0.6% process1/2
14945 hercules 92M 84M sleep 32 0 0:02:43 0.6% process1/2
14945 hercules 92M 84M sleep 33 0 0:02:44 0.6% process1/2
14945 hercules 93M 84M sleep 32 0 0:02:45 0.6% process1/2
14945 hercules 93M 85M sleep 43 0 0:02:46 0.6% process1/2
14945 hercules 93M 85M cpu11 23 0 0:02:47 0.6% process1/2
当我通过GUI运行作业时,没有使用其他虚拟处理器内核,在我的情况下,它在单个处理器内核cpu31上运行。我觉得这就是为什么当我从命令行运行作业时,它比通过GUI运行作业更快完成的原因。PRSTAT统计当作业通过GUI运行时显示:-
13555 hercules 40M 27M sleep 59 0 0:00:01 0.1% process2/1
13555 hercules 45M 33M sleep 55 0 0:00:01 0.2% process2/2
13555 hercules 45M 33M sleep 59 0 0:00:01 0.1% process2/2
13652 hercules 39M 29M sleep 59 0 0:00:00 0.1% cacad_main_prin/1
13555 hercules 45M 33M sleep 59 0 0:00:01 0.1% process2/2
17810 hercules 38M 27M run 41 0 0:00:01 0.1% process1/1
17810 hercules 53M 42M run 30 0 0:00:04 0.6% process1/1
17810 hercules 53M 42M run 30 0 0:00:08 1.0% process1/1
17810 hercules 53M 42M cpu31 30 0 0:00:12 1.3% process1/1
17810 hercules 53M 42M run 20 0 0:00:16 1.5% process1/1
17810 hercules 54M 42M cpu31 30 0 0:00:20 1.7% process1/1
13545 hercules 4492K 2756K cpu31 51 0 0:00:01 0.1% process3/1
17810 hercules 54M 43M run 20 0 0:00:24 1.8% process1/1
17810 hercules 54M 43M cpu31 30 0 0:00:27 1.9% process1/1
17810 hercules 54M 43M cpu31 30 0 0:00:31 2.0% process1/1
13545 hercules 4492K 2756K cpu31 55 0 0:00:01 0.1% process3/1
17810 hercules 54M 43M cpu31 20 0 0:00:35 2.1% process1/1
17810 hercules 54M 43M cpu31 20 0 0:00:39 2.1% process1/1
17810 hercules 55M 43M cpu31 20 0 0:00:43 2.2% process1/1
17810 hercules 55M 44M run 20 0 0:00:46 2.2% process1/1
13545 hercules 4492K 2756K cpu31 56 0 0:00:02 0.1% process3/1
17810 hercules 55M 44M cpu31 10 0 0:00:50 2.2% process1/1
13545 hercules 4492K 2756K sleep 42 0 0:00:03 0.1% process3/1
17810 hercules 55M 44M cpu31 10 0 0:00:54 2.3% process1/1
17810 hercules 55M 44M run 0 0 0:00:58 2.3% process1/1
17810 hercules 55M 44M cpu31 10 0 0:01:02 2.3% process1/1
17810 hercules 56M 44M cpu31 11 0 0:01:06 2.3% process1/1
17810 hercules 56M 45M cpu31 0 0 0:01:10 2.3% process1/1
13545 hercules 4492K 2756K sleep 59 0 0:00:04 0.1% process3/1
17810 hercules 56M 45M cpu31 1 0 0:01:13 2.3% process1/1
17810 hercules 56M 45M cpu31 0 0 0:01:17 2.3% process1/1
17810 hercules 56M 45M cpu31 0 0 0:01:21 2.3% process1/1
17810 hercules 56M 45M cpu31 0 0 0:01:25 2.3% process1/1
17810 hercules 57M 45M cpu31 0 0 0:01:28 2.3% process1/1
17810 hercules 57M 46M run 0 0 0:01:32 2.3% process1/1
13545 hercules 4492K 2756K run 0 0 0:00:05 0.1% process3/1
17810 hercules 57M 46M cpu31 0 0 0:01:36 2.3% process1/1
17810 hercules 57M 46M cpu31 0 0 0:01:39 2.3% process1/1
13545 hercules 4492K 2756K run 59 0 0:00:06 0.1% process3/1
17810 hercules 57M 46M cpu31 50 0 0:01:43 2.3% process1/1
17810 hercules 57M 46M cpu31 40 0 0:01:47 2.3% process1/1
17810 hercules 58M 46M cpu31 40 0 0:01:51 2.3% process1/1
17810 hercules 58M 47M run 40 0 0:01:55 2.3% process1/1
17810 hercules 58M 47M run 0 0 0:01:58 2.3% process1/1
17810 hercules 58M 47M cpu31 30 0 0:02:02 2.3% process1/1
17810 hercules 58M 47M cpu31 30 0 0:02:06 2.3% process1/1
13545 hercules 4492K 2756K sleep 59 0 0:00:07 0.1% process3/1
当我的进程处于睡眠模式时,我已经删除了统计数据。那个时候,java进程正在cpu31上运行。
我想知道代码中是否有我需要查看的内容,或者它是否与以下内容有关。当从命令行运行进程时,各个子进程可以在不同的虚拟CPUS上运行。当从GUI运行时,它专用于特定的虚拟处理器核心,在我的情况下是cpu31。或者它与某些SERVER CONFIGURATION有关,其中通过命令行运行和通过GUI运行可以产生差异
GUI应用程序实际是如何执行工作的?工作是在按钮按下、鼠标点击等的事件处理程序中发生的,还是这些事件处理程序启动执行实际工作的线程?这一点很重要,因为GUI框架是单线程的,并且在一些操作系统中,窗口具有线程相关性(SO问题中提供了更多解释)。
如果您的事件处理程序没有启动新线程来执行实际工作,那么一切都在单个逻辑处理器上运行也就不足为奇了。由于所有GUI工作都必须在内核线程上运行,并且内核将每个线程保持在同一处理器上运行是完全合理的(由于处理器缓存,这有助于提高性能),因此内核将所有GUI工作(包括事件处理程序)安排在同一个处理器上。
控制台应用程序没有操作系统对线程的限制,因此Java运行时环境可以自由地使自己成为多线程的,然后根据自己的选择执行字节码。我只能假设Java运行时环境在多个处理器上运行应用程序是为了提高速度。
- 从命令行c++发送文本文件名
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 数组长度,为什么从命令行获取时不能使用它?
- 如何处理linux终端中带有负号(-)的C++中的命令行参数
- VS Code "command":"make"与终端窗口中的命令行"make"不同
- 未定义的引用 .. 使用 OpenCV 编译 C++ 代码时,从命令行
- 通过 Openssl 命令行加密,通过 c++ 解密
- CMake "--target install"无需"--build"命令行
- 更改命令行 qt5 源代码构建配置的正确/快速方法
- 使用 C++ 将命令行参数拆分为参数/向量
- 用于解析 win64 堆栈跟踪的命令行客户端(可以访问符号服务器)
- LLVM | codegen 用于带有命令行选项的程序输入功能
- 如何在OMNET++中添加专门的命令行参数?
- Makefile g++ 使用命令行中的 -D 变量进行编译,默认值
- 在命令行中创建快捷命令
- 在命令行上将输入显示到数组中时如何删除 ./a.out?
- 通过GUI的作业进程在同一个虚拟处理器上执行,或者通过命令行使用任何空闲的虚拟处理器
- 如何使用CMake通过命令行定义c++预处理器宏
- MSBUILD:在命令行中设置特定的预处理器 #define