https://en.wikipedia.org/wiki/Data_dependency

(There’s some misleading expression on the flow/data dependency statement.)

1, what is data dependency

A data dependency in computer science is a situation in which a program statement (instruction) refers to the data of a preceding statement.

2, Bernstein Condition

The Bernstein Condition defines what data dependency’s logic format:

If above conditions are met, we say S2 depends on S1.

3, types

There’re 3 types of data dependencies: ante-dependency, flow(data) dependency and output dependency.

Their definitions as followed:

(1) ante-dependency

definition: I(S1) AND O(S2), S1->S2, S1 reads a memory location before S2 writes it.

To be more specific, S1->S2 means this is the correct order that S1 reads first before S2 writes, otherwise there may be execution error.

This is also known as WAR, writer-after-read.

Be aware that WAR is not an error; we should not confuse it with WAR hazard.

WAR hazard is a ‘hazard’, and WAR is the rule that’s violated that caused the hazard. The hazard happens because the rule of WAR is not followed.

Let’s see an example below:

1,  B = 3

2, A = B+1

3, B = 7

(2, 3) is an ante-dependency example.

In this example, S1 is (A=B+1), and S2 is (B=7), so I(S1) targets memory B (read from B), and O(S2) also targets memory B(write to B).

(2) flow/data dependency

definition: O(S1) AND I(S2), S1->S2, S1 writes a memory location before S2 reads it.

This is also named as RAW. Some people also call this true data dependency.

Note: Statement in wikipedia is a little misleading.

(3) output dependency

definition: O(S1) AND O(S2), S1->S2, both write to the same memory location

This is WAW.

4, how to reduce data dependency

One of the disadvantages is data dependency may hinder parallelism. One of the ways to avoid that is :

(1) use scoreboarding to avoid RAW;

(2) use register renaming to cover WAR and WAW.

Data Dependency的更多相关文章

  1. How to bind to data when the DataContext is not inherited【项目】

    http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherit ...

  2. data hazard in CPU pipeline

    1, background info 5 stages in CPU pipeline: IF, ID, EX, MM, WB IF – Instruction Fetch ID – Instruct ...

  3. 初识pipeline

    1.pipeline的产生 从一个现象说起,有一家咖啡吧生意特别好,每天来的客人络绎不绝,客人A来到柜台,客人B紧随其后,客人C排在客人B后面,客人D排在客人C后面,客人E排在客人D后面,一直排到店面 ...

  4. Falcon Genome Assembly Tool Kit Manual

    Falcon Falcon: a set of tools for fast aligning long reads for consensus and assembly The Falcon too ...

  5. C11 memory_order

    概念: 摘录自:http://preshing.com/20120913/acquire-and-release-semantics/ Acquire semantics is a property ...

  6. springdata+redis配置详解

    springdata设计初衷是位简化数据类型和数据的持久化存储,它并不局限是关系型数据库还是nosql数据库,都提供了简化的数据库连接,让数据获取变得更加的简单.所有这些的实现有统一的api提供. 本 ...

  7. The JSR-133 Cookbook for Compiler Writers(an unofficial guide to implementing the new JMM)

    The JSR-133 Cookbook for Compiler Writers by Doug Lea, with help from members of the JMM mailing lis ...

  8. 用Go造轮子-管理集群中的配置文件

    写在前面 最近一年来,我都在做公司的RTB广告系统,包括SSP曝光服务,ADX服务和DSP系统.因为是第一次在公司用Go语言实现这么一个大的系统,中间因为各种原因造了很多轮子.现在稍微有点时间,觉着有 ...

  9. Golang源码探索(三) GC的实现原理

    Golang从1.5开始引入了三色GC, 经过多次改进, 当前的1.9版本的GC停顿时间已经可以做到极短. 停顿时间的减少意味着"最大响应时间"的缩短, 这也让go更适合编写网络服 ...

随机推荐

  1. spring boot+vue.js发送post时一直415,swagger却很正常

    首先百度说要加header为applicaiton/json,加完后一直400,说json不符合格式,webstorm说要单引号,spring boot那边要双引号...... 后来不知道看了哪里说把 ...

  2. 使用bash关联数组统计单词

    使用bash关联数组统计单词 从bash 4开始支持关联数组,使用前需要声明,即 declare -A map map[key1]=value1 map[key2]=value2 map=([key1 ...

  3. 永久修改 putty字体大小

    修改前: 修改操作: 1. Window -> Appearance -> Font settings  -> Change 修改 修改 2.  返回登陆主界面  Session   ...

  4. POJ2406-Power Strings-KMP循环节/哈希循环节

    Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc&quo ...

  5. 学习笔记——CDQ分治

    再次感谢这位大佬的博客:https://www.cnblogs.com/ljc20020730/p/10395866.html CDQ分治,是一种在分治合并中计算前面值对后面答案的贡献的一种算法.今天 ...

  6. 剑指offer——25链表中环的入口节点

    题目描述 给一个链表,若其中包含环,请找出该链表的环的入口结点,否则,输出null.   题解: 使用快慢指针即可,若快慢指针会相遇,则有环,否则快指针先到空节点: 此时,快指针从此处一次移一步遍历, ...

  7. (c# )操作Excel的时候出现:不能使用对象或链接

    可能就是你打开了多个Excel进程没有关掉出现的问题. 编程:对文件操作的时候要养成关掉进程的习惯 在c#中操作完后关闭资源的代入如下: System.Runtime.InteropServices. ...

  8. Lombok 常用注解

    Lombok Lombok 能以简单的注解形式来简化 java 代码,提高开发人员的开发效率.例如开发中经常需要写的 javaBean,都需要花时间去添加相应的 getter/setter,也许还要去 ...

  9. 安装keepalived 出现configure: error: Popt libraries is required

    keepalived执行./configure --prefix=/usr/local/keepalived时报错:configure: error: Popt libraries is requir ...

  10. Android开发 AndroidStudio解决Error:moudle not specified

    问题描述 在使用Android Studio 进行Builder APKs的时候,如果发现无法degub, 进行配置的时候 没有module可以进行指定 问题原因 项目未与Grade Files 文件 ...