<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[ZionLife的博客]]></title><description><![CDATA[人生在于折腾]]></description><link>https://blog.youkuaiyun.com/ZionLife</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; ZionLife]]></copyright><item><title><![CDATA[Java并发编程学习笔记（2）硬件基础]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/79649053</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/79649053</guid><author>ZionLife</author><pubDate>Thu, 22 Mar 2018 09:20:24 +0800</pubDate><description><![CDATA[概述

这篇笔记记录了多线程编程中的硬件基础。从处理器的存储系统出发，在硬件层面解释了多线程编程中的可见性、有序性问题产生的原因及解决方案中的硬件支持。





高速缓存



引入高速缓存的原因

现代处理器处理能力要远远胜于主内存的访问速率。为了弥补处理器与主内存之间速率的鸿沟，在他们之间引入了高速缓存（Cache）。 
高速缓存是一种存取速率远比主存快，但容量远远小于主存的存储部件。每个处...]]></description><category></category></item><item><title><![CDATA[Java并发编程学习笔记（1）基本概念]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/79564319</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/79564319</guid><author>ZionLife</author><pubDate>Thu, 15 Mar 2018 10:31:19 +0800</pubDate><description><![CDATA[线程的生命周期状态


NEW：一个已创建而未启动的线程出于该状态。
RUNNABLE：该状态可以被看成一个复合状态，包含两个子状态：READY和RUNNING。前者表示线程可以被线程调度器（Scheduler）进行调度而使之处于RUNNING状态。后者表示该线程只在运行。执行Thread.yield()线程可能由RUNNING转换为READY。处于READY子状态的线程也被称为活跃线程。


 ...]]></description><category></category></item><item><title><![CDATA[线程池深入解析笔记]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/79519834</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/79519834</guid><author>ZionLife</author><pubDate>Sun, 11 Mar 2018 20:36:37 +0800</pubDate><description><![CDATA[https://www.jianshu.com/p/117571856b28 
https://juejin.im/entry/58fada5d570c350058d3aaad



概述

这篇笔记也是整理于寒假实习期间，由于美颜相机demo中的缩略图渲染功能涉及到多线程，使用了线程池减少资源开销，所以整理一下线程池笔记，以便以后查询（待完善）。 
使用线程池的主要目的在于： 
1. 降低资源消...]]></description><category></category></item><item><title><![CDATA[Activity启动过程]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/79519782</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/79519782</guid><author>ZionLife</author><pubDate>Sun, 11 Mar 2018 20:31:37 +0800</pubDate><description><![CDATA[概述

Activty是四大组件之首，重要性不言而喻。这篇笔记整理于寒假实习期间，大致总结Activity的启动流程，由于整个启动过程实在太绕，调用链太长，暂时没有完整分析一遍，空缺的看需要再补充。分析过程以API-26为基础。

几个基础对象


ActivityManagerService：简称AMS，服务端对象，负责系统中的所有Activity的生命周期。
ActivityThread：Ap...]]></description><category></category></item><item><title><![CDATA[Dalvik虚拟机内存管理与垃圾回收相关]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/79519689</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/79519689</guid><author>ZionLife</author><pubDate>Sun, 11 Mar 2018 20:22:46 +0800</pubDate><description><![CDATA[概述

这篇笔记摘抄自老罗的博客： 
http://blog.youkuaiyun.com/luoshengyang/article/details/41338251 
http://blog.youkuaiyun.com/luoshengyang/article/details/41822747 
Dalvik虚拟机内存分配的底层依赖是基于Doug Lea编写的dlmalloc内存分配器的，在Heap上完成。按照分配规...]]></description><category></category></item><item><title><![CDATA[Broadcast相关总结]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78206917</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78206917</guid><author>ZionLife</author><pubDate>Wed, 11 Oct 2017 18:42:30 +0800</pubDate><description><![CDATA[个人对广播使用得不多，在目前接触的项目开发中暂时没有使用到广播作为组件间交流工具，仅仅是在做应用复活的时候，接触过利用系统广播拉活的机制（现在已经不那么灵验了）。不过广播接收者作为Android四大组件之一，其重要性自然不言而喻 ，也是各类面试的常客，还是得好好总结一番。定义广播是一种广泛应用的在应用程序之间传输信息的机制，Android中我们要发送的广播内容是一个Intent，这个Intent中可]]></description><category></category></item><item><title><![CDATA[OkHttp深入理解（5）CallServerInterceptor]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78202983</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78202983</guid><author>ZionLife</author><pubDate>Wed, 11 Oct 2017 14:04:30 +0800</pubDate><description><![CDATA[这是整个拦截器链中的最后一个拦截器，经过了前面拦截器进行的准备工作，在CallServerInterceptor中会真正向服务器发起请求。intercept方法的代码不多： @Override public Response intercept(Chain chain) throws IOException {
    RealInterceptorChain realChain = (RealIn]]></description><category></category></item><item><title><![CDATA[OkHttp深入理解（4）ConnectInterceptor]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78195893</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78195893</guid><author>ZionLife</author><pubDate>Tue, 10 Oct 2017 18:35:38 +0800</pubDate><description><![CDATA[CacheInterceptor中如果没能成功使用缓存，接下来就要准备向服务器发起请求。所以接下来的拦截器就是ConnectInterceptor。ConnectInterceptor的主要职责是负责与服务器建立起连接。ConnectInterceptor的intercept方法很精简，直接上源码：  @Override public Response intercept(Chain chain)]]></description><category></category></item><item><title><![CDATA[MVC与MVP对比]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78186590</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78186590</guid><author>ZionLife</author><pubDate>Mon, 09 Oct 2017 20:48:17 +0800</pubDate><description><![CDATA[MVC模式MVC的全称是Model-View-Controller，模型-视图-控制器。MVC是一种框架模式而非设计模式。GOF把MVC看作是三种设计模式——观察者模式、策略模式与组合模式的合体，核心是观察者模式，也就是一个基于发布/订阅者模型的框架。在Android开发中，View对应的是各个布局文件，Controller对应的是Activity，而Model层主要是对应于从本地或网络获取数据、处]]></description><category></category></item><item><title><![CDATA[OkHttp深入理解（3）BridgeInterceptor与CacheInterceptor]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78179441</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78179441</guid><author>ZionLife</author><pubDate>Mon, 09 Oct 2017 09:33:35 +0800</pubDate><description><![CDATA[上一篇笔记主要记录了RetryAndFollowUpInterceptor的功能，主要负责根据response决定是否对请求进行重定向。这篇笔记记录链中的下两个结点BridgeInterceptor与CacheInterceptor。
BridgeInterceptor
  BridgeInterceptor负责在request阶段对请求头添加一些字段，在response阶段对响应进行一些gzip解]]></description><category></category></item><item><title><![CDATA[OkHttp深入理解（2）RetryAndFollowUpInterceptor]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78176664</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78176664</guid><author>ZionLife</author><pubDate>Sun, 08 Oct 2017 19:22:00 +0800</pubDate><description><![CDATA[OkHttp的精髓之一就在于Interceptor。其内部已经为我们定制了五个Interceptor——RetryAndFollowUpInterceptor、BridgeInterceptor、CacheInterceptor、ConnectInterceptor、CallServerInterceptor。除了系统预设的五个Interceptor之外，我们还可以自定义Interceptor实现各]]></description><category></category></item><item><title><![CDATA[OkHttp深入理解（1）综述]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78174538</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78174538</guid><author>ZionLife</author><pubDate>Sun, 08 Oct 2017 13:42:52 +0800</pubDate><description><![CDATA[用OkHttp这么久，一直只知道基本用法， 没有去深入探究，以至于遇到一些需求的时候不知道该如何实现，在网络请求部分中写了许多冗余代码，对于有代码洁癖的我来说简直太痛苦了。现在查阅了许多资料，也慢慢看了一些源码，总算有了粗略的了解。
    OkHttp的总体流程大致如下：


      
    首先通过OkHttpClient.Builder创建一个client对象，然后通过Req]]></description><category></category></item><item><title><![CDATA[责任链模式]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/78160684</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/78160684</guid><author>ZionLife</author><pubDate>Thu, 05 Oct 2017 11:26:19 +0800</pubDate><description><![CDATA[概述
    责任链模式（Chain of Responsibility），是行为型设计模式之一。在编程中，将每一个节点看做是一个对象，每一个对象拥有不同的处理逻辑，将一个请求从链式的首端发出，沿着链的路径一次传递给每一节点对象，直到有对象处理这个请求为止。

定义
    使多个对象都有机会处理请求，从而避免了请求的发送者和接收者之间的耦合关系。将这对象连成一条链，并沿着这条链传递该请求]]></description><category></category></item><item><title><![CDATA[性能优化系列之fragment的懒加载]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/77983497</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/77983497</guid><author>ZionLife</author><pubDate>Thu, 14 Sep 2017 17:57:11 +0800</pubDate><description><![CDATA[自从实习以来一直在忙着赶项目进度，没有时间（懒）总结。现在终于有空总结一下这两个多月的收获了。从性能优化中的fragment懒加载开始梳理吧。
     项目中使用ViewPager+Fragment，拿练手项目xMusic来说吧，在MainActivity中有两个fragment，一个是本地播放页面，一个是“发现”页面，“发现”页面包含广告轮播图和推荐歌单，图片资源比较多。正常打开app时两个]]></description><category></category></item><item><title><![CDATA[观察者模式与Fragment间通信]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/73703060</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/73703060</guid><author>ZionLife</author><pubDate>Sun, 25 Jun 2017 11:53:19 +0800</pubDate><description><![CDATA[前两天腾讯电话面试，被狠狠地虐了一把。本来以为还有周末两天可以好好准备，居然投完简历半个钟就打电话过来了，心塞。面试官提到一个问题，fragment间怎样实现通信。我回答通过Activity做中介。面试官要求用低耦合的方式，一时没想起。后来上网找了一下发现可以通过观察者模式来实现。虽然也是通过Activity做中介，但是不是直接在Fragment中通过操控另一个Fragment方式，而是在frag]]></description><category></category></item><item><title><![CDATA[HashTable/HashMap/ConcurrentHashMap]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/73522280</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/73522280</guid><author>ZionLife</author><pubDate>Tue, 20 Jun 2017 23:09:52 +0800</pubDate><description><![CDATA[概述：


     Hashtable 是散列表，存储的是键值对（key-value）的映射。Hashtable 继承与Dictionary，实现了Map、Cloneable、Serializable接口。它是线程安全的。Hashtable 中的映射不是有序的。
     Hashtable 有四个构造函数，分别是：



// 默认构造函数。
public Hashtable]]></description><category></category></item><item><title><![CDATA[给EditText左右两边设置图片与监听（drawableLeft/drawableRight）/弹出键盘]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/70665222</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/70665222</guid><author>ZionLife</author><pubDate>Mon, 24 Apr 2017 21:24:54 +0800</pubDate><description><![CDATA[设置图片：



Drawable phoneDrawableLeft = getResources().getDrawable(R.mipmap.phone_login, null);
phoneDrawableLeft.setBounds(0, 0, drawableDimension, drawableDimension);


Drawable phoneDrawableR]]></description><category></category></item><item><title><![CDATA[ListView原理概述]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/70256067</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/70256067</guid><author>ZionLife</author><pubDate>Thu, 20 Apr 2017 10:56:07 +0800</pubDate><description><![CDATA[ListView的源码特别长，流程特别多，看完郭神的解析博客（http://blog.youkuaiyun.com/guolin_blog/article/details/44996879）还是一脸懵逼。这篇文章根据郭神的文章，尝试记录下ListView源码的总体思路。





RecycleBin


     首先ListView继承自AbsListView。AbsListView中有]]></description><category></category></item><item><title><![CDATA[进程同步与互斥]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/70213863</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/70213863</guid><author>ZionLife</author><pubDate>Mon, 17 Apr 2017 17:25:33 +0800</pubDate><description><![CDATA[同步与互斥的概念


     ①、间接相互制约关系（互斥）：若某一进程要求使用某种资源，而该资源正被另一进程使用，并且该资源不允许两个进程同时使用，那么该进程只好等待已占有资源的进程释放资源后再使用。这种制约关系的基本形式是“进程-资源-进程”。
          这种制约关系源于多个同种进程需要互斥地共享某种系统资源，互斥是设置在同种进程之间达到互斥地访问资源的谜底。
    
]]></description><category></category></item><item><title><![CDATA[View的工作流程]]></title><link>https://blog.youkuaiyun.com/ZionLife/article/details/70188536</link><guid>https://blog.youkuaiyun.com/ZionLife/article/details/70188536</guid><author>ZionLife</author><pubDate>Sat, 15 Apr 2017 23:33:04 +0800</pubDate><description><![CDATA[概述  


     View的绘制流程是从ViewRoot的performTraversals开始的，经过measure、layout和draw三个过程才能最终将一个View绘制出来。



MeasureSpec
     

      View的measure过程在绘制的三个流程中是最复杂的。这里先看measure中关键的一个类——MeasureSpec。]]></description><category></category></item></channel></rss>