自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 Java并发编程艺术---java并发编程机制的底层实现原理

2.1volatile的应用volatile是轻量级的synchronized,它在多处理器开发中保证了变量的“可见性”。由于使用volatile不会引起线程的上下文切换,所以如果使用得当,会比synchronized的使用和执行成本更低。2.1.1volatile的定义与实现原理对volatile修饰的变量进行反编译的时候,可以看到会有一个lock前缀的指令,这个指令在多核处理器下回做如下两件事情:(1)将当前处理器缓存行的数据写回到系统内存。(2)这个写回内存的操作会使在其他CPU里缓存了该内

2020-05-13 10:16:48 162 1

原创 JAVA并发编程的艺术---第一章:并发编程的挑战

1.1上下文切换从人物保存到再加载的过程就是一次上下文切换1.1.1 多线程一定快吗答案是不一定的,当并发执行累加操作不查过百万次时,速度会比串行执行累加操作要慢。为什么并发执行速度会比串行慢?这是因为线程有创建和上下文切换的开销。可是使用Lmbench3测试上下文切换的时长。使用vmstat可以测量上下文切换的次数。1.1.3如何减少上下文切换无锁并发编程CAS算法使用最少线程协程:在单线程里实现多任务的调度,并在单线程里维持多个任务间的切换。1.1.4减少上下文切换实战通过减少

2020-05-12 19:45:02 183

原创 并发编程学习第二章

(1)无状态对象永远是线程安全的。(2)竞争条件:检查再运行,使用一个潜在的过期值作为决定下一步操作的依据。(3)检查再运行的常见手法:惰性初始化。惰性初始化中的竞争条件会破坏其正确性。...

2020-04-24 12:25:16 148

原创 并发编程学习第一章

第一章线程的风险相关名词解释:(1)活跃度:安全意味着“什么坏事都没有发生”,而活跃度关注的是“好事情最终发生了”。当一个活动进入到某种它永远无法再继续执行的状态时活跃度失败就发生了。(2)远程方法调用:RMI使你能够调用在另外一个JVM上运行的对象的方法。...

2020-04-23 23:10:01 117

转载 spring注解

https://www.cnblogs.com/liaojie970/p/7879917.html

2019-05-09 14:04:17 90

转载 Spring—请求映射之URL路径映射

https://www.cnblogs.com/Jsonlu/p/4849183.htmlSpring2.5引入注解式处理器支持,通过@Controller 和 @RequestMapping注解定义我们的处理器类。并且提供了一组强大的注解:需要通过处理器映射DefaultAnnotationHandlerMapping和处理器适配器AnnotationMethodHandlerAdapt...

2019-05-09 10:16:20 1542

转载 @ResponseBody 和 @RequestBody 的作用(转)

@ResponseBody 和 @RequestBody 的作用(转)链接:https://www.cnblogs.com/daimajun/p/7152970.html图片: 带尺寸的图片: 居中的图片: 居中并且带尺寸的图片: 当然,我们为了让用户更加便捷,我们增加了图片拖拽功能。如何插入一段漂亮的代码片去博客设置页面,选择一款你喜欢的代码片高亮样式,下面展示同样高亮的 代码片...

2019-05-09 10:12:42 78

原创 PAT B1003

#include <iostream>#include<stdio.h>#include<cstring>using namespace std;char s[11][110];int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%s",s[i]); }

2016-03-22 16:39:17 240

转载 C++函数重定义、重载、重写

C++函数重定义、重载、重写重写 (override):父类与子类之间的多态性。子类重新定义父类中有相同名称和参数的虚函数。1) 被重写的函数不能是 static 的。必须是 virtual 的 ( 即函数在最原始的基类中被声明为 virtual ) 。2) 重写函数必须有相同的类型,名称和参数列表 (即相同的函数原型)3) 重写函数的访问修饰符可以不同。尽管 virtual 是 private

2016-03-08 13:51:08 258

原创 PATB1019

#include <iostream>#include<stdio.h>#include<algorithm>using namespace std;int main(){ int n,t[4],m,a,f; scanf("%d",&n); do { f=n; for(int i=3;i>=0;i--) {

2016-03-04 19:31:50 381

原创 PATB1023

#include <iostream>#include <stdio.h>using namespace std;int main(){ int a[10]; for(int i=0;i<10;i++) { scanf("%d",&a[i]); } if(a[0]!=0){ for(int i=1;;i++) {

2016-02-25 10:02:50 318

原创 PATB1020

#include <iostream>#include<stdio.h>#include<algorithm>using namespace std;struct yuebing{ double sum1; double sum2; double d;}y[1010];bool cmp( yuebing a,yuebing b){ if(a.d!=b.d

2016-02-25 09:41:19 273

原创 ccf201403-2窗口

#include <iostream>#include<cstdio>using namespace std;int main(){ int xy[10][5],dj[10][2]; bool s=false; int n,m,x,y,t1,t2,t3,t4,t5; scanf("%d%d",&n,&m); for(int i=0;i<n;i++)

2016-02-18 13:25:34 425

原创 图像旋转ccf

#include <iostream>#include <cstdio>using namespace std;int a[1010][1010];int main(){ int n,m; scanf("%d%d",&n,&m); for(int i=0;i<n;i++) { for(int j=0;j<m;j++) s

2016-02-17 17:52:37 333

翻译 PATB1009

!PATB1009(http://img.blog.csdn.net/20160216184105416)#include <iostream>#include<stdio.h>using namespace std;int main(){ char a[90][90]; int mun=0; while(scanf("%s",a[mun])!=EOF) {

2016-02-16 18:42:18 342

原创 codeup5901 回文串

#include <iostream>#include <stdio.h>#include <string.h>using namespace std;int main(){ int n; bool b=0; char a[256]; scanf("%s",a); n=strlen(a); for(int i=0;i<n/2;i++)

2016-02-16 17:38:49 200

原创 PAT B1036

#include <stdio.h>#include<cmath>using namespace std;int main(){ double n; char a; scanf("%lf %c",&n,&a); for(int i=0;i<n;i++) { printf("%c",a); } printf("\n");

2016-02-14 11:20:26 247

原创 冒泡排序

#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ int a[10],t; bool b; for(int i=0;i<10;i++) { scanf("%d",&a[i]); } for(int i=0;i<

2016-02-03 10:09:24 183

原创 codeup

#include <iostream>#include<stdio.h>#include<math.h>using namespace std;int main(){ double a,b,c,r1,r2,d=4.0; scanf("%lf%lf%lf",&a,&b,&c); d=b*b-d*a*c; d=sqrt(d); r1=(-b+d)/(2*

2016-01-31 12:26:16 435

原创 1002. A+B for Polynomials (25)

#include<iostream>#include<malloc.h>#include<iomanip>using namespace std;typedef struct node{ int e; double c; struct node *next;}link;int main(){ int k1,k2,count,e1; double c

2016-01-27 14:25:37 187

原创 1001. A+B Format (20)

#include<iostream>#include<cstdlib>using namespace std;int main(){ int a,b,c,stack[100],p=0; cin>>a>>b; c=a+b; if(abs(c)<10) cout<<c; else{ do{ a=abs(c%1

2016-01-27 14:22:56 184

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除