如何创建多个线程来检索文件 [英] how to create multiple threads for retrieving the files

查看:60
本文介绍了如何创建多个线程来检索文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的工作中,我遇到了为更少的执行时间创建多个线程的问题。我不知道如何为多个文件创建线程。每个文件应该只处理一个线程但不能处理多个线程。我能怎么做。任何人都可以给我一些关于PLZ的想法。

On my work i get problem for creating multiple threads for the less execution time.i dont get any idea how to create threads for multiple files.each file should process only one thread.but not multiple threads. how can i do. can any one can give me idea about plz.

推荐答案

我同意评论如果你不会使用相同的资源(在你的情况下硬盘驱动器)更多线程不会加速你的工作,并可能因上下文切换而减慢速度。无论如何,ThreadPool是你的问题的解决方案
I agree with comment that if you wont to work with same resource (in your case HDD) more threads will not spead-up your work and may slow it down due to context switching. Anyway ThreadPool is the solution for your problem


这篇关于如何创建多个线程来检索文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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