Почти все потоки работают только в одном Linux-процессе. Как я могу изменить свое приложение, чтобы сделать его несколько-cpu. Когда я использую jstack команду для просмотра стека процесса я могу видеть, что большая часть работы выполняется с помощью этого процессаКак я могу создавать потоки java в разных системах?
sudo -u orca jstack 15370
2016-05-17 13:50:45
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode):
"SET:4" daemon prio=10 tid=0x0000000000b5a000 nid=0x3c70 waiting on condition [0x00007fcf206af000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.processChannels(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"SET:3" daemon prio=10 tid=0x0000000000b58800 nid=0x3c6f waiting on condition [0x00007fcf207b0000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.processChannels(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"SET:2" daemon prio=10 tid=0x0000000000b57000 nid=0x3c6e waiting on condition [0x00007fcf208b1000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.processChannels(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"SET:1" daemon prio=10 tid=0x0000000000b55800 nid=0x3c6d waiting on condition [0x00007fcf209b2000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.processChannels(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.ConnSet$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"InconmingConnMgr" daemon prio=10 tid=0x0000000000a81800 nid=0x3c6c runnable [0x00007fcf20ab3000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
- locked <0x00000006000383a0> (a sun.nio.ch.Util$2)
- locked <0x0000000600038390> (a java.util.Collections$UnmodifiableSet)
- locked <0x000000060000fe68> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
at com.orca.pf.tc50.rt_manager.connection_manager.VehicularConnectionManagerBase.processChannels(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.VehicularConnectionManagerBase.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.VehicularConnectionManagerBase$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"processRequestForActualGoSafe" daemon prio=10 tid=0x0000000000a7e800 nid=0x3c69 waiting on condition [0x00007fcf20bb4000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.ManagerBase$3.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"collectConnStatsGoSafe" daemon prio=10 tid=0x0000000000a7c000 nid=0x3c68 waiting on condition [0x00007fcf20cb5000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.ManagerBase.collectStatistics(Unknown Source)
at com.orca.pf.tc50.rt_manager.ManagerBase.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.ManagerBase$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"InconmingRequestMgr" daemon prio=10 tid=0x0000000000b0c800 nid=0x3c67 runnable [0x00007fcf20db6000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
- locked <0x00000006000661f8> (a sun.nio.ch.Util$2)
- locked <0x00000006000661e8> (a java.util.Collections$UnmodifiableSet)
- locked <0x0000000600066208> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
at com.orca.pf.tc50.rt_manager.phprequest.PHPSocket.processRequests(Unknown Source)
at com.orca.pf.tc50.rt_manager.phprequest.PHPSocket.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.phprequest.PHPSocket$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"InconmingConnMgr" daemon prio=10 tid=0x0000000000b08800 nid=0x3c66 runnable [0x00007fcf20eb7000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
- locked <0x0000000600066340> (a sun.nio.ch.Util$2)
- locked <0x0000000600066330> (a java.util.Collections$UnmodifiableSet)
- locked <0x00000006000355e0> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
at com.orca.pf.tc50.rt_manager.connection_manager.VehicularConnectionManagerBase.processChannels(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.VehicularConnectionManagerBase.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.connection_manager.VehicularConnectionManagerBase$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"CypressFrameGenerator" daemon prio=10 tid=0x0000000000a91800 nid=0x3c65 in Object.wait() [0x00007fcf20fb8000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000060007a790> (a com.orca.pf.tc50.rt_manager.cypress.CypressFrameGenerator)
at java.lang.Object.wait(Object.java:503)
at com.orca.pf.tc50.rt_manager.cypress.CypressFrameGenerator.backgroundProcess(Unknown Source)
- locked <0x000000060007a790> (a com.orca.pf.tc50.rt_manager.cypress.CypressFrameGenerator)
at com.orca.pf.tc50.rt_manager.cypress.CypressFrameGenerator.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.cypress.CypressFrameGenerator$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"VqXmlGenerator" daemon prio=10 tid=0x0000000000a94800 nid=0x3c64 in Object.wait() [0x00007fcf210b9000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006000663e8> (a com.orca.pf.tc50.rt_manager.VQuebec.XmlGeneratorVQuebec)
at java.lang.Object.wait(Object.java:503)
at com.orca.pf.tc50.rt_manager.VQuebec.XmlGeneratorVQuebec.backgroundProcess(Unknown Source)
- locked <0x00000006000663e8> (a com.orca.pf.tc50.rt_manager.VQuebec.XmlGeneratorVQuebec)
at com.orca.pf.tc50.rt_manager.VQuebec.XmlGeneratorVQuebec.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.VQuebec.XmlGeneratorVQuebec$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"MtqXmlGenerator" daemon prio=10 tid=0x0000000000b17000 nid=0x3c63 in Object.wait() [0x00007fcf211ba000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000600066488> (a com.orca.pf.tc50.rt_manager.mtqxml.XmlGeneratorMTQ)
at java.lang.Object.wait(Object.java:503)
at com.orca.pf.tc50.rt_manager.mtqxml.XmlGeneratorMTQ.backgroundProcess(Unknown Source)
- locked <0x0000000600066488> (a com.orca.pf.tc50.rt_manager.mtqxml.XmlGeneratorMTQ)
at com.orca.pf.tc50.rt_manager.mtqxml.XmlGeneratorMTQ.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.mtqxml.XmlGeneratorMTQ$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"TimeZoneCheck" daemon prio=10 tid=0x0000000000b14800 nid=0x3c62 waiting on condition [0x00007fcf212bb000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.timezone.TimeZoneChangedManager.checkProc(Unknown Source)
at com.orca.pf.tc50.rt_manager.timezone.TimeZoneChangedManager.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.timezone.TimeZoneChangedManager$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"processNewPingOptionActivation" daemon prio=10 tid=0x0000000000b13000 nid=0x3c61 in Object.wait() [0x00007fcf213bc000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000600066c70> (a com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager)
at java.lang.Object.wait(Object.java:503)
at com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager.realTimeBackground(Unknown Source)
- locked <0x0000000600066c70> (a com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager)
at com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"pingOptionsNightlyProcess" daemon prio=10 tid=0x0000000000a9b000 nid=0x3c60 waiting on condition [0x00007fcf214bd000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager.backgroundProcess(Unknown Source)
at com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.ping_options.PingOptionsManager$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"processTripStats" daemon prio=10 tid=0x0000000000aa0000 nid=0x3c5b in Object.wait() [0x00007fcf215be000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006000670d8> (a com.orca.pf.tc50.rt_manager.stats.ReportStatistics)
at java.lang.Object.wait(Object.java:503)
at com.orca.pf.tc50.rt_manager.stats.ReportStatistics.processStatsThread(Unknown Source)
- locked <0x00000006000670d8> (a com.orca.pf.tc50.rt_manager.stats.ReportStatistics)
at com.orca.pf.tc50.rt_manager.stats.ReportStatistics.access$000(Unknown Source)
at com.orca.pf.tc50.rt_manager.stats.ReportStatistics$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"processRequestForActualTC50" daemon prio=10 tid=0x0000000000a2c800 nid=0x3c5a waiting on condition [0x00007fcf216bf000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.ManagerBase$3.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"collectConnStatsTC50" daemon prio=10 tid=0x0000000000a2b800 nid=0x3c59 waiting on condition [0x00007fcf217c0000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.tc50.rt_manager.ManagerBase.collectStatistics(Unknown Source)
at com.orca.pf.tc50.rt_manager.ManagerBase.access$100(Unknown Source)
at com.orca.pf.tc50.rt_manager.ManagerBase$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"DB connection reaper" daemon prio=10 tid=0x00000000009fb000 nid=0x3c54 waiting on condition [0x00007fcf218c1000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.databasepool.DatabaseConnectionPool.run(Unknown Source)
"DB connection reaper" daemon prio=10 tid=0x00000000009c0800 nid=0x3c42 waiting on condition [0x00007fcf219c2000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.pf.databasepool.DatabaseConnectionPool.run(Unknown Source)
"Log Sync" daemon prio=10 tid=0x000000000094c000 nid=0x3c3f waiting on condition [0x00007fcf21ad9000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.orca.app.logger.LoggerFile.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
"Service Thread" daemon prio=10 tid=0x00000000007dc800 nid=0x3c3c runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" daemon prio=10 tid=0x00000000007da800 nid=0x3c3b waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0x00000000007d7800 nid=0x3c3a waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" daemon prio=10 tid=0x00000000007cf000 nid=0x3c39 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" daemon prio=10 tid=0x00000000007b4800 nid=0x3c2b in Object.wait() [0x00007fcf2318d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000600021248> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
- locked <0x0000000600021248> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler" daemon prio=10 tid=0x00000000007b2800 nid=0x3c2a in Object.wait() [0x00007fcf2328e000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000600020c58> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:503)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
- locked <0x0000000600020c58> (a java.lang.ref.Reference$Lock)
"Main/ConsoleGoSafe" prio=10 tid=0x0000000000746000 nid=0x3c0a runnable [0x00007ffdefc84000]
java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
at java.net.ServerSocket.implAccept(ServerSocket.java:530)
at java.net.ServerSocket.accept(ServerSocket.java:498)
at com.orca.pf.tc50.console.EmbeddedConsole.run(Unknown Source)
at com.orca.pf.tc50.rt_manager.console.ManagerConsole.run(Unknown Source)
at com.orca.pf.tc50.rt_manager.ManagerTC50.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at MDLoader.main(MDLoader.java:24)
"VM Thread" prio=10 tid=0x00000000007ae800 nid=0x3c29 runnable
"GC task thread#0 (ParallelGC)" prio=10 tid=0x000000000075c000 nid=0x3c16 runnable
"GC task thread#1 (ParallelGC)" prio=10 tid=0x000000000075d800 nid=0x3c17 runnable
"GC task thread#2 (ParallelGC)" prio=10 tid=0x000000000075f800 nid=0x3c18 runnable
"GC task thread#3 (ParallelGC)" prio=10 tid=0x0000000000761800 nid=0x3c19 runnable
"GC task thread#4 (ParallelGC)" prio=10 tid=0x0000000000763000 nid=0x3c1a runnable
"GC task thread#5 (ParallelGC)" prio=10 tid=0x0000000000765000 nid=0x3c1b runnable
"GC task thread#6 (ParallelGC)" prio=10 tid=0x0000000000767000 nid=0x3c1c runnable
"GC task thread#7 (ParallelGC)" prio=10 tid=0x0000000000769000 nid=0x3c1d runnable
"VM Periodic Task Thread" prio=10 tid=0x00000000007ef800 nid=0x3c3d waiting on condition
JNI global references: 157
https://github.com/OpenHFT/Java-Thread-Affinity – bedrin
Что заставляет вас думать, что "один процесс" означает "моно" CPU? Один процесс может работать на нескольких процессорах. Попробуйте запустить «верх», а затем нажмите «1». –
Тем не менее потоки выполняются на разных процессорах по умолчанию. Вам не нужно ничего делать. Библиотека привязки потоков может использоваться, если вам нужно * вручную ее контролировать. Это очень редко, что вам нужно. – Kayaman