04 2016 档案

摘要:一、前言 完成了JUC的锁框架的分析后,现在分析JUC集合框架,之前分析过的集合框架,很大程度上都不是线程安全的,其在多线程环境下会出现很多问题,为了保证在多线程环境下仍然能够正确安全的访问集合,出现了JUC下的集合框架,下面逐一进行介绍分析。 二、JUC集合框架图 下面给出JUC中的集合框架,之后 阅读全文
posted @ 2016-04-26 17:39 leesf 阅读(3681) 评论(0) 推荐(5) 编辑
摘要:一、前言 在分析了锁框架的其他类之后,下面进入锁框架中最后一个类ReentrantReadWriteLock的分析,它表示可重入读写锁,ReentrantReadWriteLock中包含了两种锁,读锁ReadLock和写锁WriteLock,可以通过这两种锁实现线程间的同步,下面开始进行分析。 二、 阅读全文
posted @ 2016-04-24 21:28 leesf 阅读(3723) 评论(7) 推荐(9) 编辑
摘要:一、前言 分析了CountDownLatch源码后,下面接着分析Semaphore的源码。Semaphore称为计数信号量,它允许n个任务同时访问某个资源,可以将信号量看做是在向外分发使用资源的许可证,只有成功获取许可证,才能使用资源。下面开始分析Semaphore的源码。 二、Semaphore的 阅读全文
posted @ 2016-04-21 14:30 leesf 阅读(3691) 评论(1) 推荐(10) 编辑
摘要:一、前言 分析完了CyclicBarrier后,下面分析CountDownLatch,CountDownLatch用于同步一个或多个任务,强制他们等待由其他任务执行的一组操作完成。CountDownLatch典型的用法是将一个程序分为n个互相独立的可解决任务,并创建值为n的CountDownLatc 阅读全文
posted @ 2016-04-20 20:35 leesf 阅读(8076) 评论(2) 推荐(13) 编辑
摘要:一、前言 有了前面分析的基础,现在,接着分析CyclicBarrier源码,CyclicBarrier类在进行多线程编程时使用很多,比如,你希望创建一组任务,它们并行执行工作,然后在进行下一个步骤之前等待,直至所有的任务都完成,和join很类似,下面,开始分析源码。 二、CyclicBarrier数 阅读全文
posted @ 2016-04-18 19:13 leesf 阅读(4717) 评论(3) 推荐(9) 编辑
摘要:一、前言 在分析了AbstractQueuedSynchronier源码后,接着分析ReentrantLock源码,其实在AbstractQueuedSynchronizer的分析中,已经提到过ReentrantLock,ReentrantLock表示下面具体分析ReentrantLock源码。 二 阅读全文
posted @ 2016-04-13 22:07 leesf 阅读(7433) 评论(7) 推荐(8) 编辑
摘要:一、前言 京东的一道笔试题,大意如下。 小东与其他人玩游戏,每个人都有候选票,投票票数最多的人获胜,在投票之前可以预测每个人有多少票,请问小东最少需要从别人那里拉多少票才能保证她获胜,拉完票之后其他人的票数可能为0。 如有如下输入: 2 1 4 第一行表示总共有两个候选人,并且小东的预测票数为1,另 阅读全文
posted @ 2016-04-12 21:33 leesf 阅读(1731) 评论(10) 推荐(5) 编辑
摘要:1. Description One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it 阅读全文
posted @ 2016-04-11 21:27 leesf 阅读(688) 评论(0) 推荐(0) 编辑
摘要:一、前言 操作系统的重要性不言而喻,学习操作系统对我们理解计算机的工作流程是非常有利的,也很有利于我们学习掌握其他语言,因为语言中的很多概念都是直接和操作系统相关的,学好操作系统就是基础中的基础,所以,很有必要好好掌握操作系统这门基础知识。 二、何为操作系统 操作系统(OS,Operating Sy 阅读全文
posted @ 2016-04-11 10:09 leesf 阅读(7217) 评论(3) 推荐(16) 编辑
摘要:一、前言 在锁框架中,AbstractQueuedSynchronizer抽象类可以毫不夸张的说,占据着核心地位,它提供了一个基于FIFO队列,可以用于构建锁或者其他相关同步装置的基础框架。所以很有必要好好分析。 二、AbstractQueuedSynchronizer数据结构 分析类,首先就要分析 阅读全文
posted @ 2016-04-08 10:16 leesf 阅读(17420) 评论(13) 推荐(35) 编辑
摘要:1. Description Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. 阅读全文
posted @ 2016-04-06 16:58 leesf 阅读(933) 评论(0) 推荐(1) 编辑
摘要:1. Description Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: 阅读全文
posted @ 2016-04-05 11:47 leesf 阅读(366) 评论(0) 推荐(0) 编辑
摘要:1. Description You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the we 阅读全文
posted @ 2016-04-04 10:35 leesf 阅读(779) 评论(0) 推荐(0) 编辑
摘要:一、题目描述 腾讯实习在线笔试的一道题目。 根据输入的数字(< 1000),输出这样的"蛇形"矩阵,如下。输入n,输出(n * n)阶矩阵,满足由外到内依次增大。 如: 输入2,则输出如下矩阵 1 2 4 3 输入3,则输出如下矩阵 1 2 3 8 9 4 7 6 5 输入4,则输出如下矩阵 1 2 阅读全文
posted @ 2016-04-03 21:38 leesf 阅读(1095) 评论(0) 推荐(4) 编辑
摘要:1. Description The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the 阅读全文
posted @ 2016-04-03 14:41 leesf 阅读(495) 评论(0) 推荐(0) 编辑
摘要:1. Description Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, 阅读全文
posted @ 2016-04-03 14:41 leesf 阅读(849) 评论(0) 推荐(0) 编辑
摘要:1. Description Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary repre 阅读全文
posted @ 2016-04-03 08:54 leesf 阅读(387) 评论(0) 推荐(0) 编辑
摘要:一、前言 最开始打算分析ReentrantLock,但是分析到最后,发现离不开LockSuport的支持,所以,索性就先开始分析LockSupport,因为它是锁中的基础,是一个提供锁机制的工具类,所以先对其进行分析。 二、LockSupport源码分析 2.1 类的属性 public class 阅读全文
posted @ 2016-04-02 17:03 leesf 阅读(5296) 评论(10) 推荐(16) 编辑
摘要:集合框架源码分析框架目录如下 1. 【集合框架】Java集合框架综述 2. 【集合框架】JDK1.8源码分析之HashMap(一) 3. 【集合框架】JDK1.8源码分析之LinkedHashMap(二) 4.【集合框架】JDK1.8源码分析之HashMap & LinkedHashMap迭代器(三 阅读全文
posted @ 2016-04-01 16:53 leesf 阅读(3075) 评论(2) 推荐(6) 编辑
摘要:一、前言 在分析完了集合框架后,很有必要接着分析java并发包下面的源码,JUC(java.util.concurrent)源码也是我们学习Java迈进一步的重要过程。我们分为几个模块进行分析,首先是对锁模块的分析。 二、锁框架图 在Java并发中,锁是最重要的一个工具,因为锁,才能实现正确的并发访 阅读全文
posted @ 2016-04-01 10:51 leesf 阅读(5062) 评论(0) 推荐(8) 编辑

喜欢请打赏

扫描二维码打赏

了解更多

点击右上角即可分享
微信分享提示