Computer Science An Overview _J. Glenn Brookshear _11th Edition

Such communication needs have long been a topic of study among computer scientists, and many newer programming languages reflect various approaches to thread interaction problems. As an example, let us consider the communication problems encountered when two threads manipulate the same data. (This example is presented in more detail in the optional Section 3.4.) If each of two threads that are executing concurrently need to add the value three to a common item of data, a method is needed to ensure that one thread is allowed to complete its transaction before the other is allowed to perform its task. Otherwise they could both start their individual computations with the same initial value,which would mean that the final result would be incremented by only three rather than six. Data that can be accessed by only one thread at a time is said to have mutually exclusive access.

One way to implement mutually exclusive access is to write the program units that describe the threads involved so that when a thread is using shared data, it blocks other threads from accessing that data until such access is safe. (This is the approach described in the optional Section 3.4, where we identified the portion of a process that accesses shared data as a critical region.) Experience has shown that this approach has the drawback of distributing the task of ensuring mutual exclusion throughout various parts of the program—each program unit accessing the data must be properly designed to enforce mutual exclusion, and thus a mistake in a single segment can corrupt the entire system. For this reason many argue that a better solution is to embody the data item with the ability to control access to itself. In short, instead of relying on the threads that access the data to guard against multiple access, the data item itself is assigned this responsibility. The result is that control of access is concentrated at a single point in the program rather than dispersed among many program units. A data item augmented with the ability to control access to itself is often called a monitor.

We conclude that the design of programming languages for parallel processing involves developing ways to express such things as the creation of threads, the pausing and restarting of threads, the identification of critical regions, and the composition of monitors.

embody the data item with the ability to control access to itself的更多相关文章

  1. PowerDesigner提示This data item is already used in a primary identifier.的处理

    原文链接: http://blog.csdn.net/lopper/article/details/5293545 今天同事在编制一个数据库脚本的时候,提示了This data item is alr ...

  2. 远程连接服务器影像文件进行服务发布以及问题解决【the data item is inaccessible】

    场景模拟: 本机安装有arcgis desktop以及arcgis server10.1,server的站点账号为arcgis. 需要发布影像服务并进行切片,使用的影像数据存放在远程服务器上,影像较大 ...

  3. 解决PowerDesigner提示This data item is already used in a primary identifier

    解决PowerDesigner提示This data item is already used in a primary identifier 解决PowerDesigner提示This data i ...

  4. [Blue Prism] Data item 的使用

      1.用于存储各种数据类型的变量,支持的数据类型如下: Binary - 用于存储二进制 blob,例如文本文件. Date - 用于存储日期. 此数据类型与 DateTime 类似,只是 Date ...

  5. Cryptographic method and system

    The present invention relates to the field of security of electronic data and/or communications. In ...

  6. Cross-Domain Security For Data Vault

    Cross-domain security for data vault is described. At least one database is accessible from a plural ...

  7. ListView中item定位

    ListView 实现定位特定 item 最近在项目中需要使 ListView 能跳转到特定的 item,查阅文档后,发现 ListView 有以下几种方法可供使用: smoothScrollToPo ...

  8. Optimizing Performance: Data Binding(zz)

    Optimizing Performance: Data Binding .NET Framework 4.5 Other Versions   Windows Presentation Founda ...

  9. Tri-Training: Exploiting Unlabeled Data Using Three Classifiers

    Abstract – In many practical data mining applications such as web page classification, unlabeled tra ...

随机推荐

  1. wp8 入门到精通 WebClient Post

    WebClient wc = new WebClient(); var URI = new Uri("http://your_uri_goes_here"); //If any e ...

  2. hdu 3746 kmp求循环节

    题意就是将所给的字符串变成多个完整的循环(至少两个),然后给出最少需要添加的字符数.

  3. android 文字写在图片上

    在linearlayout中直接设置背景图片,背景图片会被拉伸.. 我们来试一下imagebutton 但是imagebutton无法添加文字.. button能同时添加文字和图片但是图片比例没法控制 ...

  4. zookeeper 4 letter 描述与实践

    命令示例描述 Conf echo conf | nc localhost 2181 (New in 3.3.0)输出相关服务配置的详细信息.比如端口.zk数据及日志配置路径.最大连接数,session ...

  5. 在CentOS 6上搭建私有的Docker Registry

    在CentOS 6上搭建私有的Docker Registry v2Registry概念 :Registry是一个无状态的, 高可扩展的服务器端应用程序, 用于存储和分发Docker Image. 依赖 ...

  6. Android 在布局容器中动态添加控件

    这里,通过一个小demo,就可以掌握在布局容器中动态添加控件,以动态添加Button控件为例,添加其他控件同样道理. 1.addView 添加控件到布局容器 2.removeView 在布局容器中删掉 ...

  7. PHP 读取逐条数据库记录,以及提交下拉菜单选项

    <?php $db_host=localhost; //MYSQL服务器名$db_user=root; //MYSQL用户名$db_pass="******"; //MYSQ ...

  8. mvc-2事件监听

    现代浏览器都支持的事件 click dbclick mouseover mousemove mouseout focus blur change(表单输入框特有) submit(表单特有) addEv ...

  9. BFS POJ 3278 Catch That Cow

    题目传送门 /* BFS简单题:考虑x-1,x+1,x*2三种情况,bfs队列练练手 */ #include <cstdio> #include <iostream> #inc ...

  10. MapReduce多线程下的错误

    最近在写一个MR调度程序,在以服务进程中同时开启了两个MapReduce线程.这两个MR共享同一份输入源,此时会造成Cast异常: java.lang.ClassCastException: org. ...