如何使用我的多核专用服务器来运行我的 java 应用程序?

发布于 2024-08-11 13:07:15 字数 280 浏览 5 评论 0原文

我有一个在 java 环境中构建的游戏,并且使用 JVM。

我有 4 个核心 @ 2.4Ghz,而我的服务器仅使用其中一个核心...

我已经尝试和搜索,但我仍然没有设置多个核心来运行游戏的指南,例如,1 个核心用于运行角色保存+ 加载,1 个核心用于服务器本身,1 个核心用于帮助其他需要更多功率的核心。

我什至不知道这是否可能,但这都是java中的,操作系统是windows server 2003,我已经尽力了,我只是不知道该怎么做。

请有人帮助我!

太感谢了!

I have a game built in a java environment and I use JVM.

I have 4 cores @ 2.4Ghz and my server is only using one of those cores...

I've tried and searched and I still have no guides to setup multiple cores to run the game like, say 1 core for running the character saving + loading, and 1 core for the server itself, and 1 core for a helper to help other cores that need more power.

I don't even know if this is possible but this is all in java the operating machine is windows server 2003 and I've tried so hard I just don't know what to do.

May someone please help me!

Thank you so much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小猫一只 2024-08-18 13:07:15

您不能使用 Java 直接将任务委托给特定的 CPU 核心,但如果您使用多个线程(直接或通过使用 java.util.concurrent 中的执行器实用程序类)实现程序,操作系统将在不同的线程/任务上运行不同的线程/任务。如果可能的话,核心。

要实现这一点,您当然必须了解多线程编程的基础知识和陷阱,学习如何在线程之间安全地交换数据,防止多个线程同时访问和修改关键数据等等。然而,这个话题太宽泛,无法用简短的答案来总结。

You cannot directly delegate tasks to specific CPU cores with Java, but if you implement your program using multiple threads (either directly or by using the executor utility classes in java.util.concurrent), the OS will run the different threads/tasks on different cores if it is possible.

To achieve this, you must of course understand the basics and pitfalls of multithreaded programming, learn how to exchange data safely between threads, prevent that several threads access and modify critical data simultaneously and so on. That topic however is far too broad to summarize here in a short answer.

无远思近则忧 2024-08-18 13:07:15

Java 默认情况下会利用多核。不幸的是,应用程序必须专门编码为多线程。游戏很可能正在事件调度线程中运行所有内容。需要更改应用程序才能利用多核。

好的一面是,像酷睿 i5 这样的处理器可以检测何时仅使用单个内核,并可以对该单个内核进行超频。这有助于不是或不能多线程的程序。

Java by default will take advantage of multiple cores. Unfortunately, an app must be specifically coded to be multithreaded. It's likely that the game is running everything in the Event Dispatch Thread. The application would need to be changed in order to take advantage of multiple cores.

On the bright side, processors like the Core i5 can detect when only a single core is being used, and can over-clock that single core. This helps programs which aren't or can't be multithreaded.

浴红衣 2024-08-18 13:07:15

还可以编写多个 JVM,每个 JVM 可以绑定到一组 CPU,并在它们之间使用必要的 RMI。这可能与编程相关。

One can also code multiple JVMs and each JVM can be bound to a set of CPUs, with the necessary RMI between them. This can be programming-related.

〃安静 2024-08-18 13:07:15

@Xepoch 有一些清晰的信息吗?我了解 RMI 部分,但是 JVM 如何绑定到 CPU 集。请记住,我在这里谈论的是 4 核处理器,因此对我来说是 4 个 CPU,而不是 4 个单核处理器。

Some clarilty on that@Xepoch? I understand the RMI part, but how JVM can be bound to set of CPUs. Remember here I am talking about 4-core processors so thats 4 CPUs for me instead of 4 single-core processors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文