zoukankan      html  css  js  c++  java
  • communication between threads 线程间通信 Programming Concurrent Activities 程序设计中的并发活动 Ada task 任务 Java thread 线程

    Computer Science An Overview _J. Glenn Brookshear _11th Edition

     activation 激活

    parallel processing 并行处理

    concurrent processing 并发处理

    Each programming language tends to approach the parallel processing paradigm from its own point of view, resulting in different terminology. For example, what we have informally referred to as an activation is called a task in the Ada vernacular and a thread in Java. That is, in an Ada program, simultaneous actions are performed by creating multiple tasks, whereas in Java one creates multiple threads. In either case, the result is that multiple activities are generated and executed in much the same way as processes under the control of a multitasking operating system.

    Perhaps the most basic action that must be expressed in a program involving parallel processing is that of creating new threads. If we want multiple activations of the spaceship program to be executed at the same time, we need a syntax for saying so. Such spawning of new threads is similar to that of requesting the execution of a traditional procedure. The difference is that, in the traditional setting, the program unit that requests the activation of a procedure does not progress any further until the requested procedure terminates (recall Figure 6.8), whereas in the parallel context the requesting program unit continues execution while the requested procedure performs its task (Figure 6.23). Thus to create multiple spaceships streaking across the screen, we would write a main program that simply generates multiple activations of the spaceship program, each provided with the parameters describing the distinguishing characteristics of that spaceship.

    A more complex issue associated with parallel processing involves handling communication between threads. For instance, in our spaceship example, the threads representing the different spaceships might need to communicate their locations among themselves in order to coordinate their activities. In other cases one thread might need to wait until another reaches a certain point in its computation, or one thread might need to stop another one until the first has accomplished a particular task.

  • 相关阅读:
    接口-DAO模式代码阅读及应用
    3.1-有理数类的设计

    树、二叉树、查找算法总结
    编辑器、编译器、文件、IDE等常见概念辨析
    二叉排序树
    markdown的一些语法
    数据结构小结(线性表)
    springMVC model传对象数组 jq 获取
    java.sql.SQLException: Data truncated for column 'lastSeason' at row 1
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6050465.html
Copyright © 2011-2022 走看看