使用MultiThreading可以更快地读取文件 [英] Use MultiThreading to read a file faster

查看:112
本文介绍了使用MultiThreading可以更快地读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在2个线程的帮助下读取500 Mb的文件,这样读取文件的速度会快得多。有人请给我一些使用核心java概念的任务代码。

I want to read a file of 500 Mb with the help of 2 threads, so that reading the file will be much faster. Someone please give me some code for the task using core java concepts.

推荐答案

多线程不太可能使代码更快一点都不这是因为读取文件是一个受I / O限制的进程。您将受到磁盘速度的限制而不是您的处理器。

Multi-threading is not likely to make the code faster at all. This because reading a file is an I/O-bound process. You will be limited by the speed of the disk rather than your processor.

这篇关于使用MultiThreading可以更快地读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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