Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2598284
  • 博文数量: 333
  • 博客积分: 4817
  • 博客等级: 上校
  • 技术积分: 4413
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-28 10:51
文章分类

全部博文(333)

文章存档

2017年(20)

2016年(57)

2015年(27)

2014年(20)

2013年(21)

2012年(164)

2011年(24)

分类: 嵌入式

2013-01-06 10:23:19


多核间用MSMC全局变量同步的问题?提问:

我在做多核的同步的时候,定义了一个int型的flag,并且把它放到了MSMC中。在core0中将其值改写为1,但在其他核中该值依然是0,并没有随着core0改变。

怀疑是cache一致性的问题,于是加入了CACHE_invL1d((void *)(&flag),sizeof(int),CACHE_WAIT);但结果依旧。

麻烦帮我看一下。


回答:

The operations on Core 0 are:

Write Flag at shared memory

If(Cache is enabled for access shared memory)

{

 If(L2 Cache Size>0)

 {

   CACHE_wbL2(flag address, size of flag);

 }

 Else if(L1D Cache Size>0)

 {

   CACHE_wbL1D(flag address, size of flag);

 }

}

The operations on Core 1 are:

If(Cache is enabled for access shared memory)

{

 If(L2 Cache Size>0)

 {

   CACHE_invL2(flag address, size of flag);

 }

 Else if(L1D Cache Size>0)

 {

   CACHE_invL1D(flag address, size of flag);

 }

}

If(Prefetch buffer is enabled for access Core X’s L2 RAM)

{

 Invalidate Prefetch Buffer;

}

Read Flag at shared memory

链接:

阅读(4408) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~