如何在java中进行多处理,以及期望的速度提升? [英] how to do multiprocessing in java, and what speed gains to expect?

查看:129
本文介绍了如何在java中进行多处理,以及期望的速度提升?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个使用Java对csv文件进行数据处理的新手。为此,我使用Java(线程池)的多线程功能将csv文件批量导入Java,并在每个行上执行一些操作。在我的四核上,多线程加速了这个过程。

I am a newbie using Java to do some data processing on csv files. For that I use the multithreading capabilities of Java (pools of threads) to batch-import the csv files into Java and do some operations on each of their lines. On my quad-core, multithreading speeds up the process a lot.

我很想知道多处理如何/是否会加速操作?如果是这样,是否有可以在某处获得的教程?(Java Basic Tutorial提到了一个类,但我对语法不熟悉,不能自己理解该类:

I am curious to know how/whether multiprocessing would speed up the operations even more? If so, is there a tutorial available somewhere? (the Java Basic Tutorial mentions a class, but I am not familiar enough with the syntax to understand the class by myself:

来自 http://download.oracle.com/javase/ tutorial / essential / concurrency / procthread.html


Java虚拟机的大多数实现都以单个$ b $运行b进程.Java应用程序可以使用
ProcessBuilder对象创建其他进程。多进程应用程序超出本课程的范围
[他们在哪里解释?]


推荐答案


我很想知道多处理如何加速操作甚至更多?

I am curious to know how/whether multiprocessing would speed up the operations even more?

不,实际上它可能会使情况变得更糟。如果你是从多线程切换到多处理,然后您将多次有效地启动JVM。启动JVM并非易事。实际上,桌面计算机上的JVM启动方式与企业公司启动JVM的方式不同,只是为了减少小程序为典型最终用户启动的等待时间。

No, in fact it would likely make it worse. If you were to switch from multithreading to multiprocessing, then you would effectively launch the JVM multiple times. Starting up a JVM is no simple effort. In fact, the way the JVM on your desktop machine starts is different from the way an enterprise company starts their JVM, just to reduce wait time for applets to launch for the typical end-user.

这篇关于如何在java中进行多处理,以及期望的速度提升?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆