当前位置: 首页 > news >正文

5 还有网站的域哪有深圳网站页面设计

5 还有网站的域,哪有深圳网站页面设计,济南建设工程信息网,wordpress做的网站缓存缓存行#xff1a;缓存行越大#xff0c;局部性空间效率越高#xff0c;但读取时间慢缓存行越小#xff0c;局部性空间效率越低#xff0c;但读取时间快取一个折中值#xff0c;目前多用#xff1a;64字节public class CacheLinePadding { //执行时间在4s左右public…缓存缓存行缓存行越大局部性空间效率越高但读取时间慢缓存行越小局部性空间效率越低但读取时间快取一个折中值目前多用64字节public class CacheLinePadding { //执行时间在4s左右public volatile static long[] arrnew long[2];public static void main(String[] args) throws Exception{Thread t1new Thread(()-{for (long i0;i 10_0000_0000L;i){arr[0]i;}});Thread t2new Thread(()-{for (long i0;i 10_0000_0000L;i){arr[1]i;}});t1.start();t2.start();final long start System.nanoTime();t1.join();t2.join();final long end System.nanoTime();System.out.println((end-start)/1000000);}}public class T02_CacheLinePadding { //执行在2s左右public volatile static long[] arrnew long[16];public static void main(String[] args) throws Exception{Thread t1new Thread(()-{for (long i0;i 10_0000_0000L;i){arr[0]i;}});Thread t2new Thread(()-{for (long i0;i 10_0000_0000L;i){arr[8]i;}});t1.start();t2.start();final long start System.nanoTime();t1.join();t2.join();final long end System.nanoTime();System.out.println((end-start)/1000000);}}缓存行对齐对于有些特别敏感的数字会存在线程高竞争的访问为了保证不发生伪共享可以使用缓存航对齐的编程方式JDK7中很多采用long padding提高效率eg:JDK8加入了Contended注解(实验)需要加上JVM -XX:-RestrictContendedpublic class T03_CacheLinePading {Contendedvolatile long x;Contendedvolatile long y;public static void main(String[] args) throws Exception{ //0.6sT03_CacheLinePading t3new T03_CacheLinePading();Thread t1new Thread(()-{for (long i0;i 1_0000_0000L;i){t3.xi;}});Thread t2new Thread(()-{for (long i0;i 1_0000_0000L;i){t3.yi;}});t1.start();t2.start();final long start System.nanoTime();t1.join();t2.join();final long end System.nanoTime();System.out.println((end-start)/1000000);}}乱序执行/*** CPU的乱序执行*/public class DisorderTest {private static int x0,y0;private static int a0,b0;//第44448次 (0,0)public static void main(String[] args) throws InterruptedException {int i 0;for (; ; ) {i;x 0;y 0;a 0;b 0;Thread one new Thread(new Runnable() {public void run() {//由于线程one先启动下面这句话让它等一等线程two. 读着可根据自己电脑的实际性能适当调整等待时间.shortWait(100000);a 1;x b;}});Thread other new Thread(new Runnable() {public void run() {b 1;y a;}});one.start();other.start();one.join();other.join();String result 第 i 次( x , y );if (x 0 y 0) {System.err.println(result);break;} else {//System.out.println(result);}}}public static void shortWait(long interval){long start System.nanoTime();long end;do{end System.nanoTime();}while(start interval end);}}禁止乱序CPU层面Intel - 原语(mfence lfence sfence) 或者锁总线JVM层级8个hanppens-before原则 4个内存屏障 (LL LS SL SS)as-if-serial : 不管硬件什么顺序单线程执行的结果不变看上去像是serial合并写Write Combining Buffer一般是4个字节由于ALU速度太快所以在写入L1的同时写入一个WC Buffer满了之后再直接更新到L2
http://www.yutouwan.com/news/180758/

相关文章:

  • 网站建设公司价格外国做的中国动画视频网站
  • 如何做微信朋友圈网站微信商城怎么进
  • 邢台网站建设电话民宿推广平台有哪些
  • 网站备案网站名称怎么填网站被iframe
  • 网站推广只能使用在线手段进行。系统开发毕业设计
  • 网站首页的文字下拉怎么做免费咨询的图片
  • wordpress英文美食主题公司网站怎么做优化
  • 进贤网站建设广告发布
  • 莱阳网站定制php网站建设模板下载
  • 网站内图片变换怎么做wordpress 文章id 链接
  • 想做网站北京网站建设的服务
  • 深圳网站开发四川大良网站建设
  • 做网站的工作好做吗广州网页设计公司公司
  • 福清市建设局官方网站wordpress报价
  • 凡科网免费网站域名注册文件关键词搜索工具
  • 幕墙装饰工程网站模板建设网站公司怎么建站
  • flash+xml地图网站外贸wordpress模板下载
  • 图文网站建设汽车营销服务网站建设
  • 网站建设文化市场东莞公司网站开发
  • 查询网站后台地址标准的网络推广计划书的目录
  • 企业网站建站技术那些网站可以做公司的推广
  • 设计师 必备的网站wordpress haiyuan
  • 网站公司图片网站建设宣传视频
  • 网站违法和做网站得有关系兼职做效果图设计到哪个网站找
  • 微信网站开发制作公司什么建站平台好
  • 网站开发费用税文件什么上传到wordpress
  • 东营网站排名优化公司网站建设方案书是啥
  • 医院网站建设安全协议做网站技术含量
  • 网页设计与网站建设期末考试响水网站建设找哪家好
  • 哪个网站建站好营销型网站建设的指导原则