Open Nav

并发编程

以下是资料介绍,如需要完整的请充值下载.
1.无需注册登录,支付后按照提示操作即可获取该资料.
2.资料以网页介绍的为准,下载后不会有水印.仅供学习参考之用.
   帮助中心
资料介绍:




并发编程



  面向对象提供了一个将程序划分成相互独立的模块的方法。时常还会碰到,要把程序分解开,让它的各个部分都能独立运行的问题。

  每一种能独立运行的小任务就是线程(thread)。编程的时候,可以认为线程都是能独立运行的,和拥有自己的CPU。实际上,是一些下层机制在为你分割CPU的时间,只是你没有想到罢了。这种做法能让多线程的编程变成更加简单的任务。

  一个进程(process)是一种有自己地址空间的" (self-contained)"程序。通过在不同的任务之间定时切换CPU,多任务(multitasking)操作系统营造出一种同一个时间可以有多个进程(程序)在同时运行的效果。线程是进程内部的独立的的指令数据流。一个进程能包含多个并发执行的线程。

  多线程有很多可能的用处,但大体上,你会让程序的某一部分试着联系一个专门事件或资源,你不想让它把整个程序都给阻塞了。因此,你创建一个与该事件或资源相关的线程,让它独立于主程序分开来运行。

  学习并发编程就像是进入一个新的世界,同时学习一种新的编程语言,最起码也得接受一套新的语言概念。随着绝大多数的微电脑操作系统对多线程的支持,编程语言和库也做了扩展。总而言之,多线程编程:

[资料来源:http://doc163.com]



1. 看上去不但神秘,而且还要求一个对编程思想方法的转变

2. 其它语言对多线程的支持相似,所以理解线程就等于掌握了一种通用语言

  虽然支持多线程会让Java变成更复杂的语言,但这并不全是JAVA的错--线程狡猾。





外文原文(复印件)

      Concurrency

Objects provide a way to divide a program into independent sections. Often, you also need to turn a program into separate, independently running subtasks.

Each of these independent subtasks is called a thread, and you program as if each thread runs by itself and has the CPU to itself. Some underlying mechanism is actually dividing up the CPU time for you, but in general, you don't have to think about it, which makes programming with multiple threads a much easier task.

A process is a self-contained running program with its own address space. A multitasking operating system is capable of running more than one process (program) at a time, while making it look like each one is chugging along on its own, by periodically switching the CPU from one task to another. A thread is a single sequential flow of control within a process. A single process can thus have multiple concurrently executing threads.
[版权所有:http://DOC163.com]


There are many possible uses for multithreading, but in general, you'll have some part of your program tied to a particular event or resource, and you don't want that to hold up the rest of your program. So, you create a thread associated with that event or resource and let it run independently of the main program.

Concurrent programming is like stepping into an entirely new world and learning a new programming language, or at least a new set of language concepts. With the appearance of thread support in most microcomputer operating systems, extensions for threads







  • 关于资料
    提供的资料属本站所有,真实可靠,确保下载的内容与网页资料介绍一致.
  • 如何下载
    提供下载链接或发送至您的邮箱,资料可重复发送,若未收到请联系客服.
  • 疑难帮助
    下载后提供一定的帮助,收到资料后若有疑难问题,可联系客服提供帮助.
  • 关于服务
    确保下载的资料和介绍一致,如核实与资料介绍不符,可申请售后.
  • 资料仅供参考和学习交流之用,请勿做其他非法用途,转载必究,如有侵犯您的权利或有损您的利益,请联系本站,经查实我们会立即进行修正! 版权所有,严禁转载
    doc163.com Copyright © 2012-2024 苏ICP备2021029856号-4