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. Python 利用微信端口查看列车时刻表

    import requests """ 该程序查看列车时刻 """ url0 = 'http://www.webxml.com.cn/Web ...

  2. 使用Docker创建数据容器

    使用Docker创建数据容器 翻译自: Data-only container madness 1.什么是数据容器? 数据容器就是本身只创建一个volume供其他容器共享,创建完后即退出,不执行任何任 ...

  3. Centos7.5安装kafka集群

    Tags: kafka Centos7.5安装kafka集群 Centos7.5安装kafka集群 主机环境 软件环境 主机规划 主机安装前准备 安装jdk1.8 安装zookeeper 安装kafk ...

  4. JVM内核-原理、诊断与优化学习笔记(六):类装载器

    文章目录 class装载验证流程 class装载验证流程 class装载验证流程 -加载 class装载验证流程 -链接 验证 链接 -> 验证 文件格式的验证 元数据验证(class文件简单语 ...

  5. Spring源码由浅入深系列二 类结构

    BeanFactory 上一章中,我们提过Spring的依赖注入容器是BeanFactory.BeanFactory是一个基础接口,它有一个默认实现类:DefaultListableBeanFacto ...

  6. 牛客练习赛43B Tachibana Kanade Loves Probability

    题目链接:https://ac.nowcoder.com/acm/contest/548/C 题目大意 略 分析 利用快速幂先移到 k1 位,然后开始一个一个取余数. 代码如下 #include &l ...

  7. 【牛客挑战赛32E】树上逆序对

    题目 数据范围非常奇怪,询问的逆序对个数\(k\leq 30000\),我们应该可以把所有的情况都求出来 发现对于树上两点\(x,y\),如果\(x\)是\(y\)的祖先,那么绝对值较大的点的符号决定 ...

  8. 实时收集Storm日志到ELK集群

    背景 我们的storm实时流计算项目已经上线几个月了,由于各种原因迟迟没有进行监控,每次出现问题都要登录好几台机器,然后使用sed,shell,awk,vi等各种命令来查询原因,效率非常低下,而且有些 ...

  9. 计算a,b,c的排列组合

    递归实现,思路的确有点难得想: public void SortAll(List<string> list,int start,int end) { if (start==end) { f ...

  10. 火狐浏览器缓存导致JS已经改变的ID没改变

    问题主要就是火狐浏览器缓存. 比如,自己写一个JS,如下: $(document).ready(function () { $("#bigRoom").live("cli ...