Parallel Virtual Machine

As already mentioned earlier, our parallelization of the collision detection methods presented earlier was implemented using Parallel Virtual Machine or PVM ([ GBD+94 ]). PVM is the result of ongoing research into the use of heterogenous networks in computing at the University of Tennessee, Oak Ridge National Laboratory and other universities. It is essentially a system that allows a network of very different types of computers to be used as a single, parallel computers for example as in  4.2 . Of course, a specific type of computer can only be used if a version specific for the architecture of the computer is available.

More precisely, the system consists of two parts. The first part is a daemon program, called pvmd3 or pvmd. This daemon must run on every computer in the network that is to be used in the computing network. If there is no daemon available for this system, the system cannot be used. The daemon allows a computer to be used in different PVM's. The second part in the PVM system is a library. This library contains a number of tools and routines necessary to start up programs, add or remove computers from the virtual machine etc. In the current implementation of PVM, three programming languages are supported, namely C, C++ and FORTRAN, since these languages are most often used in scientific computing.


    Figure 2: PVM allows easy use of heterogeneous computer networks \begin{figure} \begin{center}  \includegraphics [width=7cm] {pvm_het.eps} \end{center}\end{figure}

Now, when designing an application using PVM, you have to take into account that the basic element of computation is a task. Such a task usually corresponds with a UNIX task. It can, using the functionality offered by the PVM library, start up and kill other tasks, communicate with them and much more. A complete description and manual can be found in [GBD+94]. It is important to notice that the execution of tasks can be handled completely by the PVM daemon. We can let PVM decide on which computer and when exactly the task is effectively executed (of course, as fast as possible and taking into account the dependencies between the computations performed in the tasks). On the other hand, if you know that a certain computer is particularly fast in handling the computation needed by a certain task, it is perfectly possible to assign that task to that computer. As you can see, PVM allows great flexibility in parallel and concurrent computation and at the same time provides an abstract interface to the network of computers so you don't have to worry about specific implementations for different architectures.

<think>好的,用户遇到了Java虚拟机初始化时无法分配位图的错误,导致无法创建JVM。我需要根据提供的引用信息来分析问题。首先,报错信息显示是并行垃圾回收需要的位图分配失败,这可能与堆内存大小和系统可用内存有关。用户引用的三个例子中,错误信息都提到了无法为堆分配足够的位图空间,比如引用1中的堆大小为31457280KB(约30GB),引用2是4165632KB(约4GB),引用3是8192000KB(约8GB)。看起来当堆内存设置过大时,JVM尝试为并行GC分配位图,但系统内存不足以支持这个请求。 接下来,我应该考虑可能的原因。首先,位图内存的计算可能与堆大小有关。并行GC需要使用位图来跟踪内存中的对象,这些位图的大小通常与堆大小成比例。如果堆设置得太大,位图所需的内存可能超过系统的可用内存,导致分配失败。比如,引用1中的错误是堆30GB,但位图需要983040KB,也就是大约960MB,而系统可能没有足够的连续内存来分配这个位图。 解决方案方面,首先应该建议用户减少堆内存大小。因为错误是由于堆设置过高导致位图分配失败,适当降低-Xmx参数的值可能解决问题。例如,用户当前的堆是4173824KB(约4GB),可以尝试减小到3GB或更低,看看是否有效。 其次,可以考虑更换垃圾回收器。并行GC可能对位图内存需求较高,改用G1GC或者Serial GC可能减少内存开销。例如,使用-XX:+UseG1GC参数来启用G1垃圾回收器,这可能不需要同样大的位图空间。 另外,检查系统的物理内存和交换空间是否足够。如果系统总内存不足,即使堆设置合理,也可能无法分配所需的内存。用户需要确保系统有足够的可用内存,包括物理内存和交换空间。 还可以调整JVM的启动参数,比如使用-XX:-UseParallelGC来禁用并行GC,或者减少并行GC线程数,这可能会降低位图的内存需求。例如,通过-XX:ParallelGCThreads=2来减少线程数,从而减少内存占用。 此外,确认JVM版本和位数是否匹配。32位的JVM有内存限制,无法分配大内存,切换到64位JVM可能解决这个问题。同时,确保操作系统支持所需的内存分配,特别是在容器环境中可能需要调整内存限制。 最后,如果用户是在容器中运行,比如Docker,需要检查容器的内存限制是否足够。容器默认的内存限制可能较低,导致JVM无法分配足够的位图内存,这时需要调整容器配置,增加内存限制。 总结来说,解决方案的步骤应该是:调整堆大小、更换GC算法、检查系统内存、调整JVM参数、确认JVM版本和容器设置。用户需要根据具体情况逐步尝试这些方法,直到问题解决。</think>### Java虚拟机位图分配错误解决方案 当Java虚拟机初始化时出现`Unable to allocate bitmaps for parallel garbage collection`错误,通常与堆内存分配过大或系统可用内存不足相关。以下是分步解决方案: --- #### **1. 降低堆内存设置** 并行垃圾回收(Parallel GC)需要为堆内存分配位图(bitmaps),其计算公式为: $$ \text{位图大小} = \frac{\text{堆大小}}{16 \times 8} \times \text{ParallelGCThreads} $$ 若堆内存设置过高,位图可能超出系统可用内存范围[^1][^2]。 **操作步骤:** - 在启动参数中减少`-Xmx`和`-Xms`值: ```bash java -Xmx3g -Xms1g YourApplication ``` - 逐步降低堆大小,直到错误消失。 --- #### **2. 更换垃圾回收器** 并行GC对位图内存需求较高,改用其他垃圾回收器可能缓解问题: - **G1 GC**(推荐): ```bash java -XX:+UseG1GC -Xmx4g YourApplication ``` - **Serial GC**(单线程场景): ```bash java -XX:+UseSerialGC -Xmx4g YourApplication ``` --- #### **3. 检查系统内存限制** - **物理内存**:通过`free -h`(Linux)或任务管理器(Windows)确认可用内存是否充足。 - **容器环境**:若在Docker/Kubernetes中运行,检查内存限制: ```yaml # Docker示例 resources: limits: memory: "6Gi" ``` --- #### **4. 调整JVM参数** - 减少并行GC线程数: ```bash java -XX:ParallelGCThreads=2 -Xmx4g YourApplication ``` - 禁用压缩指针(仅限64位JVM): ```bash java -XX:-UseCompressedOops -Xmx4g YourApplication ``` --- #### **5. 验证JVM版本与环境** - 确认使用**64位JVM**(32位JVM最大堆限制为2-4GB)。 - 更新JDK版本(某些旧版本存在内存分配优化问题)。 --- #### **典型错误场景示例** 若堆设置为`4173824KB`(约4GB),位图大小计算为: $$ \frac{4173824KB}{16 \times 8} \approx 32608KB $$ 若并行GC线程数为8,总位图需求为: $$ 32608KB \times 8 = 260864KB \approx 255MB $$ 若系统可用内存不足255MB,则触发错误[^3]。 --- #### **总结步骤** 1. 降低堆内存 → 2. 更换GC算法 → 3. 检查系统内存 → 4. 调整JVM参数 → 5. 更新环境。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值