- 浏览: 256200 次
- 性别:
- 来自: 沈阳
-
最新评论
-
wahahachuang8:
GoEasy 实时推送支持IE6-IE11及大多数主流浏览器的 ...
关于服务器推送 -
vfgvfrgvs:
引用引用引用引用引用引用引用引用引用[list][*][lis ...
一个纯java的验证码识别算法 -
656615066lkl:
[color=brown][/color]cczxCZCX
一个纯java的验证码识别算法 -
keephope:
求教一下。是不是这个程序只能分辨出间距相等的验证码的内容呢
一个纯java的验证码识别算法 -
boke_xu:
你好,有关javaocr的问题想请教下你。
打开你的项目,运行 ...
一个纯java的验证码识别算法
1.1. A (Very) Brief History of Concurrency(关于并发的历史)
In the ancient past, computers didn't have operating systems; they executed a single program from beginning to end, and that program had direct access to all the resources of the machine. Not only was it difficult to write programs that ran on the bare metal, but running only a single program at a time was an inefficient use of expensive and scarce computer resources.
在计算机刚刚被发明使用的年代,还没有操作系统的概念。这个时候的计算机从头到尾执行每一个单独的程序。在程序在执行过程中,直接访问计算机的硬件资源。由于直接面向硬件编程,编写程序是非常困难的。而且在同一时间只能只能有一个程序来独占相对昂贵的、稀缺的计算资源是非常低效的。
Operating systems evolved to allow more than one program to run at once, running individual programs in processes: isolated, independently executing programs to which the operating system allocates resources such as memory, file handles, and security credentials. If they needed to, processes could communicate with one another through a variety of coarse-grained communication mechanisms: sockets, signal handlers, shared memory, semaphores, and files.
操作系统的出现改善了这一个困境,它开始允许在同一时间运行多个程序。在进程中运行彼此独立的程序(进程:能够彼此隔离的,独立的执行程序,这些程序所需要的诸如内存、文件句柄、安全认证等资源由操作系统为其分配)。如果需要,进程应该能够使用一些粗粒度的通讯机制在彼此之间互相通讯,这些通讯机制包括:socket、信号处理、共享内存、信号量以及文件等。
Several motivating factors led to the development of operating systems that allowed multiple programs to execute simultaneously:
如下这些因子激发了操作系统必须允许多个程序同时运行。
Resource utilization. Programs sometimes have to wait for external operations such as input or output, and while waiting can do no useful work. It is more efficient to use that wait time to let another program run.
资源利用。程序有时候必须等待外部操作比如输入输出等。并且这种等待通常不能够做有用的工作。因此使用这些等待的时间允许别的程序运行时更有意义的。
Fairness. Multiple users and programs may have equal claims on the machine's resources. It is preferable to let them share the computer via finer-grained time slicing than to let one program run to completion and then start another.
公平。多个用户或者程序对硬件资源应该具有公平的请求权限。因此对于从头到尾完整的运行一个程序这种使用模式而言,允许每个程序获得良好分割的时间片无疑是一种更好的选择。
Convenience. It is often easier or more desirable to write several programs that each perform a single task and have them coordinate with each other as necessary than to write a single program that performs all the tasks.
便利。编写几个程序,每个程序完成一个功能,每个程序根据需要进行合作比编写一个程序完成所有功能通常更加简单和可取。
In early timesharing systems, each process was a virtual von Neumann computer; it had a memory space storing both instructions and data, executing instructions sequentially according to the semantics of the machine language, and interacting with the outside world via the operating system through a set of I/O primitives. For each instruction executed there was a clearly defined "next instruction", and control flowed through the program according to the rules of the instruction set. Nearly all widely used programming languages today follow this sequential programming model, where the language specification clearly defines "what comes next" after a given action is executed.
在早期的时间共享的系统中,每隔一进程就是一台虚拟的冯•诺依曼机。它使用单独的内存空间来存储指令和数据,根据机器语言的语义顺序执行指令,通过操作系统级别的IO通道与外部世界交互。对于每一条执行完毕的指令,都有一条定义清晰的下一条指令。根据指令集的规则控制程序。当今几乎所有被广泛使用的语言都遵循这种程序模式,即:语言规范清楚的定义在一个给定的动作完毕之后,后续要执行的动作。
The sequential programming model is intuitive and natural, as it models the way humans work: do one thing at a time, in sequencemostly. Get out of bed, put on your bathrobe, go downstairs and start the tea. As in programming languages, each of these real-world actions is an abstraction for a sequence of finer-grained actionsopen the cupboard, select a flavor of tea, measure some tea into the pot, see if there's enough water in the teakettle, if not put some more water in, set it on the stove, turn the stove on, wait for the water to boil, and so on. This last step waiting for the water to boil also involves a degree of asynchrony. While the water is heating, you have a choice of what to dojust wait, or do other tasks in that time such as starting the toast (another asynchronous task) or fetching the newspaper, while remaining aware that your attention will soon be needed by the teakettle. The manufacturers of teakettles and toasters know their products are often used in an asynchronous manner, so they raise an audible signal when they complete their task. Finding the right balance of sequentiality and asynchrony is often a characteristic of efficient people and the same is true of programs.
顺序编程模式是非常直观和自然的,因为它符合人类的工作模式:先做一件事情,然后做下一件。起床,穿上浴衣,下楼,开始喝茶。在编程语言中,每一件现实世界中的动作都被抽象成细小粒度的行为。选择适合口味的茶,量取茶叶放入壶中,看看烧水壶中是否有足够的水,如果没有的话则放入水,把烧水壶放到火炉上。打开火炉,等待水沸腾,等等。最后一步等待水沸腾的过程同时也牵扯到一定程度的异步操作。当水被加热的时候,你可以选择做什么事情,只是去等待,或者利用这段时间去烤面包(另外一个异步任务),或者打开报纸,并且随时留意开水壶的情况。开水壶和烤炉的生产厂商知道他们的商品通常是以异步的方式被使用,所以他们增加的声音信号以表示任务的完成。寻找顺序执行和异步执行之间的平衡是一个高效率人士的特性,这一点同样可以用在程序身上。
The same concerns (resource utilization, fairness, and convenience) that motivated the development of processes also motivated the development of threads. Threads allow multiple streams of program control flow to coexist within a process. They share process-wide resources such as memory and file handles, but each thread has its own program counter, stack, and local variables. Threads also provide a natural decomposition for exploiting hardware parallelism on multiprocessor systems; multiple threads within the same program can be scheduled simultaneously on multiple CPUs.
激发进程出现的诱因同样也激发出了线程的出现。线程允许多个程序控制流在同一个进程中出现。他们能够共享进程内资源,例如内存、文件句柄。但是每一个线程都拥有属于自己的程序计数器、栈、以及本地变量。线程通常能够为在多处理器系统上开发硬件并行的程序提供自然分解。同一个程序中的多个线程可以被多cpu同时调度。
Threads are sometimes called lightweight processes, and most modern operating systems treat threads, not processes, as the basic units of scheduling. In the absence of explicit coordination, threads execute simultaneously and asynchronously with respect to one another. Since threads share the memory address space of their owning process, all threads within a process have access to the same variables and allocate objects from the same heap, which allows finer-grained data sharing than inter-process mechanisms. But without explicit synchronization to coordinate access to shared data, a thread may modify variables that another thread is in the middle of using, with unpredictable results.
线程有时候也会被称为轻量级的进程,大多数的现代把线程(而不是进程)当做基本的调度单位。在没有显式的调度的情况下,多个线程同时、异步执行。由于线程共享其所在进程的内存空间,一个进程中的所有线程可以访问相同的变量,而且可以从相同的对内存中创建对象,这意味着可以实现比进程间机制更细粒度的数据共享。但是在没有显式同步机制调度访问共享数据的情况下,一个线程可能会改变两外一个线程正在使用的数据,从而导致无法预计的后果。
In the ancient past, computers didn't have operating systems; they executed a single program from beginning to end, and that program had direct access to all the resources of the machine. Not only was it difficult to write programs that ran on the bare metal, but running only a single program at a time was an inefficient use of expensive and scarce computer resources.
在计算机刚刚被发明使用的年代,还没有操作系统的概念。这个时候的计算机从头到尾执行每一个单独的程序。在程序在执行过程中,直接访问计算机的硬件资源。由于直接面向硬件编程,编写程序是非常困难的。而且在同一时间只能只能有一个程序来独占相对昂贵的、稀缺的计算资源是非常低效的。
Operating systems evolved to allow more than one program to run at once, running individual programs in processes: isolated, independently executing programs to which the operating system allocates resources such as memory, file handles, and security credentials. If they needed to, processes could communicate with one another through a variety of coarse-grained communication mechanisms: sockets, signal handlers, shared memory, semaphores, and files.
操作系统的出现改善了这一个困境,它开始允许在同一时间运行多个程序。在进程中运行彼此独立的程序(进程:能够彼此隔离的,独立的执行程序,这些程序所需要的诸如内存、文件句柄、安全认证等资源由操作系统为其分配)。如果需要,进程应该能够使用一些粗粒度的通讯机制在彼此之间互相通讯,这些通讯机制包括:socket、信号处理、共享内存、信号量以及文件等。
Several motivating factors led to the development of operating systems that allowed multiple programs to execute simultaneously:
如下这些因子激发了操作系统必须允许多个程序同时运行。
Resource utilization. Programs sometimes have to wait for external operations such as input or output, and while waiting can do no useful work. It is more efficient to use that wait time to let another program run.
资源利用。程序有时候必须等待外部操作比如输入输出等。并且这种等待通常不能够做有用的工作。因此使用这些等待的时间允许别的程序运行时更有意义的。
Fairness. Multiple users and programs may have equal claims on the machine's resources. It is preferable to let them share the computer via finer-grained time slicing than to let one program run to completion and then start another.
公平。多个用户或者程序对硬件资源应该具有公平的请求权限。因此对于从头到尾完整的运行一个程序这种使用模式而言,允许每个程序获得良好分割的时间片无疑是一种更好的选择。
Convenience. It is often easier or more desirable to write several programs that each perform a single task and have them coordinate with each other as necessary than to write a single program that performs all the tasks.
便利。编写几个程序,每个程序完成一个功能,每个程序根据需要进行合作比编写一个程序完成所有功能通常更加简单和可取。
In early timesharing systems, each process was a virtual von Neumann computer; it had a memory space storing both instructions and data, executing instructions sequentially according to the semantics of the machine language, and interacting with the outside world via the operating system through a set of I/O primitives. For each instruction executed there was a clearly defined "next instruction", and control flowed through the program according to the rules of the instruction set. Nearly all widely used programming languages today follow this sequential programming model, where the language specification clearly defines "what comes next" after a given action is executed.
在早期的时间共享的系统中,每隔一进程就是一台虚拟的冯•诺依曼机。它使用单独的内存空间来存储指令和数据,根据机器语言的语义顺序执行指令,通过操作系统级别的IO通道与外部世界交互。对于每一条执行完毕的指令,都有一条定义清晰的下一条指令。根据指令集的规则控制程序。当今几乎所有被广泛使用的语言都遵循这种程序模式,即:语言规范清楚的定义在一个给定的动作完毕之后,后续要执行的动作。
The sequential programming model is intuitive and natural, as it models the way humans work: do one thing at a time, in sequencemostly. Get out of bed, put on your bathrobe, go downstairs and start the tea. As in programming languages, each of these real-world actions is an abstraction for a sequence of finer-grained actionsopen the cupboard, select a flavor of tea, measure some tea into the pot, see if there's enough water in the teakettle, if not put some more water in, set it on the stove, turn the stove on, wait for the water to boil, and so on. This last step waiting for the water to boil also involves a degree of asynchrony. While the water is heating, you have a choice of what to dojust wait, or do other tasks in that time such as starting the toast (another asynchronous task) or fetching the newspaper, while remaining aware that your attention will soon be needed by the teakettle. The manufacturers of teakettles and toasters know their products are often used in an asynchronous manner, so they raise an audible signal when they complete their task. Finding the right balance of sequentiality and asynchrony is often a characteristic of efficient people and the same is true of programs.
顺序编程模式是非常直观和自然的,因为它符合人类的工作模式:先做一件事情,然后做下一件。起床,穿上浴衣,下楼,开始喝茶。在编程语言中,每一件现实世界中的动作都被抽象成细小粒度的行为。选择适合口味的茶,量取茶叶放入壶中,看看烧水壶中是否有足够的水,如果没有的话则放入水,把烧水壶放到火炉上。打开火炉,等待水沸腾,等等。最后一步等待水沸腾的过程同时也牵扯到一定程度的异步操作。当水被加热的时候,你可以选择做什么事情,只是去等待,或者利用这段时间去烤面包(另外一个异步任务),或者打开报纸,并且随时留意开水壶的情况。开水壶和烤炉的生产厂商知道他们的商品通常是以异步的方式被使用,所以他们增加的声音信号以表示任务的完成。寻找顺序执行和异步执行之间的平衡是一个高效率人士的特性,这一点同样可以用在程序身上。
The same concerns (resource utilization, fairness, and convenience) that motivated the development of processes also motivated the development of threads. Threads allow multiple streams of program control flow to coexist within a process. They share process-wide resources such as memory and file handles, but each thread has its own program counter, stack, and local variables. Threads also provide a natural decomposition for exploiting hardware parallelism on multiprocessor systems; multiple threads within the same program can be scheduled simultaneously on multiple CPUs.
激发进程出现的诱因同样也激发出了线程的出现。线程允许多个程序控制流在同一个进程中出现。他们能够共享进程内资源,例如内存、文件句柄。但是每一个线程都拥有属于自己的程序计数器、栈、以及本地变量。线程通常能够为在多处理器系统上开发硬件并行的程序提供自然分解。同一个程序中的多个线程可以被多cpu同时调度。
Threads are sometimes called lightweight processes, and most modern operating systems treat threads, not processes, as the basic units of scheduling. In the absence of explicit coordination, threads execute simultaneously and asynchronously with respect to one another. Since threads share the memory address space of their owning process, all threads within a process have access to the same variables and allocate objects from the same heap, which allows finer-grained data sharing than inter-process mechanisms. But without explicit synchronization to coordinate access to shared data, a thread may modify variables that another thread is in the middle of using, with unpredictable results.
线程有时候也会被称为轻量级的进程,大多数的现代把线程(而不是进程)当做基本的调度单位。在没有显式的调度的情况下,多个线程同时、异步执行。由于线程共享其所在进程的内存空间,一个进程中的所有线程可以访问相同的变量,而且可以从相同的对内存中创建对象,这意味着可以实现比进程间机制更细粒度的数据共享。但是在没有显式同步机制调度访问共享数据的情况下,一个线程可能会改变两外一个线程正在使用的数据,从而导致无法预计的后果。
发表评论
-
使用commons-fileupload实现单个和多个文件上传
2013-06-24 16:19 944见如下: http://www.blogjava.net/s ... -
pgpool-I I的recovery
2013-06-06 19:51 970pgpool-I I のオンラインリカバリの概要 -
ウェブサーバの 暗号アルゴリズムの選び方
2013-03-26 10:59 996日语的一份关于ssl的加密算法的文档,有时间的话需要研究一下。 ... -
struts2 best practice-Why we need a framework.
2012-12-03 16:28 1032A web application framework is ... -
struts2 best practice-Use empty action components to forward to your results
2012-11-29 12:25 912Use empty action components to ... -
struts2中inceptor的执行顺序
2012-08-15 17:27 1056struts2中的inceptor是可以指定执行顺序的。 具 ... -
漫谈HTTPS(挖坑待填)
2012-04-23 09:13 1065漫谈HTTPS(挖坑待填) -
Java序列化之四: 进一步思考
2012-04-20 10:24 9861,当需要被序列化的类对象中的一部分成员变量是不可被序列化的, ... -
Java序列化之三: 常见实例分析
2012-04-20 10:20 15631,HTTPSession与Serializale ... -
Java序列化之二: 从代码开始
2012-04-19 14:20 13001,最简单,最典型的序列化代码。 附录1中给出的JAV ... -
Java序列化之一: 什么是JAVA序列化
2012-04-19 14:03 1977这几天受领导委托,做 ... -
一个纯java的验证码识别算法
2012-04-05 08:45 33312在进行性能测试时,某些时候需要输入验证码。手工输入是不可能的, ... -
連載二、Servlet 3.0の6つのEase of Development
2011-07-22 14:16 824Servlet 3.0では、EoDとして「Annotation ... -
連載一、Servlet 3.0の6つの主な変更点
2011-07-22 14:00 845Tomcat 7では、Tomcat 6に対して実装するサーブレ ... -
連載二、クロスサイトスクリプティング基本
2011-07-13 10:01 733XSSセキュリティホールによる起こり得る被害 ●cookie ... -
qmailによるSMTPサーバの構築
2011-06-15 14:41 12401、qmailの仕組み a、sendmailが、メッセー ... -
LDAP SCHEMA DESIGN(三)
2010-11-05 11:34 13543.2 Do not modify the standard ... -
LDAP SCHEMA DESIGN(二)
2010-11-04 09:42 12942 Requirements When considerin ... -
LDAP SCHEMA DESIGN_Synopsis (大纲)
2010-11-02 16:55 1518Synopsis (大纲) ... -
Chapter 4. Composing Objects(合成对象)
2010-01-13 11:02 1064Chapter 4. Composing Objects(组合 ...
相关推荐
A Brief History of Artificial Intelligence What It Is, Where We Are, and Where We Are Going by Michael Wooldridge (z-lib.org).pdf
A Brief History of Computing(2nd) 英文epub 第2版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
理解区块链就需要了解人文历史,而这本书以其独特的视角向我们讲述了人类的共识来源。
America history of twentieth century
在"pyramid_orb-1.1.zip"这个压缩包中,包含的是Pyramid ORB库的1.1版本源代码和可能的相关文件。Pyramid ORB库的设计目的是简化在Python环境中实现ORB算法的过程,使得开发者能够轻松地在图像处理任务中利用ORB特征...
标题和描述指出的文件是一个关于CH7211A的简介数据手册。CH7211A是一个半导体设备,它能够将DisplayPort信号通过USB Type-C连接器转换成HDMI/DVI信号。文件指出了该芯片是设计用于USB Type-C到HDMI转换器、适配器和...
《人类简史:从动物到上帝》是由以色列历史学家尤瓦尔·赫拉利(Yuval Noah Harari)所著的一本极具影响力的科普书籍。书中通过宏大的视角,跨越了生物学、历史学、经济学、政治学等多个学科领域,探讨了人类的过去...
总的来说,软件工程的历史是一部关于技术进步、理论发展和实践演进的故事。从硬件导向的早期实践,到更加注重抽象和设计的现代方法,软件工程始终追求提高软件质量、降低成本并增强复杂系统的实现能力。尽管随着时间...
标题与描述均提到了《Lee Smith - ARM简史》,这显然是一篇关于ARM架构发展历史的文章,由ARM公司的研究员Lee Smith撰写。文章不仅回顾了ARM的发展历程,还分享了作者在创业过程中的经验和教训。 ### ARM架构的起源...
《Addison.Wesley.UML.Distilled.A.Brief.Guide.3rd》是一本深入浅出地介绍统一建模语言(Unified Modeling Language,简称UML)的书籍,旨在为软件开发人员提供一个简明扼要的指南。本书由Addison Wesley出版社出版...
甲骨文数据库.11g.Release.1.].A.Brief.Look.at.Oracle.Database.11g.ppt
A64 brief v1.0 20150323.pdf A64 Camera模块开发说明文档.pdf A64 Camera自适应使用说明书_V1.10.pdf A64 dev tree&sysconfig使用文档.pdf A64 DragonBoard使用说明书.pdf A64 IIC设备驱动开发说明文档.pdf A64 ...
信息安全_数据安全_A Brief History of Attribution Mistakes 水坑攻击 信息安全 工控安全 安全现状 安全验证
《机械工程简史》A Brief History of Mechanical Engineering pdf文字版 基本信息: 出版社: Springer; 1st ed. 2017 (2016年8月19日) 丛书名: Materials Forming, Machining and Tribology 精装: 178页 ...
《过程代数简史》不仅是一篇关于过程代数历史的综述文章,也是对这一领域深入理解的邀请。它强调了过程代数作为并发理论基石的重要性,同时也提出了对未来的思考和挑战。Baeten的个人视角为我们提供了一个独特的窗口...
#### 一、我们的宇宙图像(Our Picture of the Universe) 本章节主要探讨了人类对宇宙的认知历程及其变化。在古代,人们普遍认为地球是宇宙的中心,随着时间的推移,这一观点逐渐被日心说所替代。随着科学技术的...
Simmonds J.G. A Brief on Tensor Analysis (2ed., UTM, Springer, 1997)(ISBN 038794088X)(T)(123s)
1.1 A Brief Introduction to C++ . . . . . . . . . . . . . . . . . . . 1.1.1 C++ is “Object-Oriented” . . . . . . . . . . . . . . . . 1.1.2 Why You Should Write Scientific Programs in C++ . . 1.1.3 ...
在本文中,作者探讨了项目管理的历史,并解释了为何我们应该从他人所做的工作中学习。项目管理作为一种概念,其实可以追溯到很久以前。如果我们思考人类文明历史上所建造的所有事物,那么我们有数千年的项目经验可以...