登录
首页 » Windows Socket编程 »  各个线程任务分配是这样实现的。在开始下载时,文件平均分成若干块进行下载。如第一个线程一开始的任务是从文件的0位置开始下载一直到72908位置处。线程1每次下载...

 各个线程任务分配是这样实现的。在开始下载时,文件平均分成若干块进行下载。如第一个线程一开始的任务是从文件的0位置开始下载一直到72908位置处。线程1每次下载...

于 2022-03-20 发布 文件大小:93.98 kB
0 267
下载积分: 2 下载次数: 1

代码说明:

 各个线程任务分配是这样实现的。在开始下载时,文件平均分成若干块进行下载。如第一个线程一开始的任务是从文件的0位置开始下载一直到72908位置处。线程1每次下载一块数据后就要调整任务,如第一次下载了20800字节的数据,那么线程1的任务将改为:20800-72908。如此下去,直到任务为72908-72908时表示线程1完成了当前的下载任务。此时,线程1就分析各个线程的任务,找出任务最为繁忙的一个线程:如线程3:14816-218724。那么线程1就自动去调整任务,拿50%的任务来再次下载。周而复始直到各个线程都完成任务。不过这里有一点需要注意:为了避免重复下载部分数据,在调整任务的时候,起始的文件便移量必须加上接受缓冲器的字节数,因为如前面所举的列子来看。线程1和线程3在平衡负载的时候,线程正在下载数据,如果所剩的数据比接受缓冲器的大小还小,线程1和线程3的部分下载数据将会重复。   在调整任务和分析任务的时候,会发现一个问题。就是读取文件数据太过频繁。于是我用了一个数据结构。在下载文件的过程中始终打开配置文件,这样速度提高了很多。在文件下载完毕后关闭文件。-various threads assignment is achieved. At the beginning of the download, the paper divided into a number of pieces of the download. As a thread of a task is to start from the position paper of 0 to start the download has 72,908 locations Department. Thread a download each one will have to adjust the data tasks, such as the first downloaded 20,800 gigabytes of data, then threaded a task will be re :20800- 72908. This situation continues until the mandate of 72908-72908 said threaded a completion of the cu

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 分别遵循 TCP 和 UDP 协议的, 了解2个协议的主要区别, 了解其各自的优缺点....
    分别遵循 TCP 和 UDP 协议的编程, 了解2个协议的主要区别, 了解其各自的优缺点.-were followed TCP and UDP programming, understanding the two main differences between the agreement and understanding of their respective strengths and weaknesses.
    2022-05-05 12:43:56下载
    积分:1
  • 网络监控软件
    网络监控软件 -Network monitoring software network monitoring software
    2023-01-21 19:55:04下载
    积分:1
  • The Simple Times is an openly
    The Simple Times is an openly-available publication devoted to the promotion of the Simple Network Management Protocol. In each issue, The Simple Times presents technical articles and featured columns, along with a standards summary and a list of Internet resources. In addition, some issues contain summaries of recent publications and upcoming events.
    2022-02-25 15:27:52下载
    积分:1
  • C# SOCKET programming, asynchronous means of communication to provide client and...
    C# SOCKET编程,异步通讯方式,提供客户端和服务端。-C# SOCKET programming, asynchronous means of communication to provide client and server.
    2022-08-16 09:06:39下载
    积分:1
  • 一个功能齐全的浏览器源代码. MICROSOFT FOUNDATION CLASS LIBRARY : BCGControlBar .MICROSOFT FOU
    一个功能齐全的浏览器源代码. MICROSOFT FOUNDATION CLASS LIBRARY : BCGControlBar .MICROSOFT FOUNDATION CLASS LIBRARY : BCGIEDemo.MICROSOFT FOUNDATION CLASS LIBRARY : CustToolBarTest-a fully functional browser source code. MICROSOFT CLASS LIBRARY FOUNDATION : BCGControlBar. MICROSOFT CLASS LIBRARY FOUNDATION : BCGIEDemo.MICROSOFT CLASS LIBRARY FOUNDATION : CustToolBarTest
    2022-08-19 21:25:54下载
    积分:1
  • 最新的borland社区聊天的客户端
    最新的borland社区聊天的客户端程序-latest community chat client
    2022-04-30 10:47:16下载
    积分:1
  • 用低层音频函数实现局域网音频实时传送的小序 C
    用低层音频函数实现局域网音频实时传送的小程序 C-audio function with the lower LAN audio real-time transmission of small programs in C
    2022-03-05 16:51:24下载
    积分:1
  • 信使小精灵,是一个简易的聊天工具。主要是演示了网络的主要步骤。本序使用封装好的函数库,使得应用层不需要考虑网络消息是如何被接受和发送的,也不需要考虑数据粘...
    信使小精灵,是一个简易的聊天工具。主要是演示了网络编程的主要步骤。本程序使用封装好的函数库,使得应用层不需要考虑网络消息是如何被接受和发送的,也不需要考虑数据粘包和丢包的刺手问题,你只要调用相应的函数就可以了。函数库为你做好了这些工作。你只需要定义自己的协议头和消息结构体,定义好网络消息的回调函数就可以了。-messenger elf is a simple chat tools. A major demonstration is the main network programming steps. The programs use Packaging good libraries, makes application layer need not consider the network news is how it has been accepted and sent, and do not need sticky packets of data and packet loss of a thorn in hand, as long as you call the corresponding function on it. Functions well as your work. You only need to define its own agreement head and the structure of news, the definition of a good network news callback function on it.
    2022-01-26 00:49:46下载
    积分:1
  • jsp实现图形验证码,用于实现jsp图形验证码
    jsp实现图形验证码,用于实现jsp图形验证码-Verification Code realize graphics jsp, jsp used to realize graphics Verification Code
    2023-06-03 21:45:03下载
    积分:1
  • 1、用户注册自动生成用户目录,并判断是否发送邮件(可选jmail、Cdonts、Aspemail组件) 2、网站列表、网站排行、首页酷站推荐,首页显示网站分...
    1、用户注册自动生成用户目录,并判断是否发送邮件(可选jmail、Cdonts、Aspemail组件) 2、网站列表、网站排行、首页酷站推荐,首页显示网站分类,并显示当天最新注册用户 3、首页显示:共有站点数、每天可注册数、当天注册人数 4、用户登录随机验证码功能,并对用户密码进行64位md5加密,并记录登录次数、登录时间、登录IP 5、WEB管理功能,可批量删除、复制、移动文件,文件改名,删除或建立目录,并可通过WEB直接下载所有类型文件,可在线编辑所有Ascall类型文件,并具有源码查找替换功能 6、内置高速无组件文件上传系统,可实时通过WEB上传文件 7、空间占用统计,精确显示空间使用状况 8、计数器功能,自动生成用户计数器代码,用户可选择计数器样式、初始化计数,并具有防刷新功能 9、修改用户资料、修改密码功能-1, registered users automatically generate user directory, and to determine whether to send mail (optional jmail, Cdonts, Aspemail components) 2, the website lists, site rankings, Home Kuzhan recommendation, Home website shows classification, and display the same day the latest three registered users, the Home show : A total number of sites, daily registration number, registration number four day, users random functional verification codes and user password encryption md5 64, and recorded the number of login, login time, logged 5 IP, WEB management functions, batch delete, copy, transfer dynamic document, renamed
    2022-08-16 13:23:34下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载