- 博客(29)
- 收藏
- 关注
原创 死锁的概念、处理方法
1 产生死锁的原因 (1)竞争资源。进程竞争数量不足的资源。 (2)进程间推进顺序非法。进程请求和释放资源的顺序不当。2 产生死锁的必要条件 (1)互斥条件 进程对分配到的资源进行排他性使用,即在一段时间内某资源只由一个进程占用。 (2)请求和保持条件 进程在保持了至少一个资源的时候提出
2017-08-03 11:00:17
576
原创 Java对象创建的过程
当Java虚拟机遇到一条new指令时,首先将去检查这个指令的参数是否能在常量池中定位到一个类的符号引用。如果有符号引用,将检查这个符号引用代表的类是否已经被加载、解析和初始化过;如果没有,那必须先加载相应的类。 在类加载检查通过后,Java虚拟机将为对象分配内存。对象所需的内存空间在类加载完后便可以完全确定。 分配内存有两种方法: (1)指针碰撞
2017-08-02 10:34:31
229
转载 缓冲区溢出
1 什么是缓冲区 计算机程序一般都会使用到一些内存,这些内存或是程序内部使用,或是存放用户的输入数据,这样的内存一般称作缓冲区。2 什么是缓冲区溢出 向缓冲区内填充数据时超过了缓冲区本身的容量,而导致数据溢出到被分配空间之外的内存空间,使得溢出的数据覆盖了其他内存空间的数据。3 产生原因 计算机对接收的输入数据没有进行有效的
2017-07-26 10:06:00
458
原创 进程通信
进程通信是指进程之间进行信息交换(数据传输)进程通信的分类1.低级通信 (1)使用信号量实现进程间的互斥和同步。2.高级通信 (1)共享存储器系统 互相通信的进程通过共享某些数据结构或共享存储区进行通信。 (2)消息传递系统 1.直接通信:发送进程利用操作系统提供的发送命令,直接把消
2017-07-16 11:15:57
285
原创 进程和线程的区别
进程和线程的区别1. 在没有引入线程的操作系统中,进程是系统进行资源分配和调度的基本单位。但是在引入线程的操作系统中,进程是资源拥有的基本单位,线程则是作为调度和分派的基本单位。2.进程是操作系统中拥有资源的基本单位;而线程一般不拥有系统资源,同一个进程中的线程共享该进程拥有的资源。3.进程在创建、切换和撤销的时候系统的时空开销比较大;而线程的切换仅需要保存和设
2017-07-16 11:13:02
331
原创 进程的概念、状态转换和进程控制块
1. 为什么要引入进程 通常的程序是不能并发执行的,因为并发执行会使它们具有间断性、失去封闭性,并且其结果不可再现。 为了使程序能够并发执行,并且对程序加以描述及控制,引入了进程的概念。2. 进程的定义 进程是进程实体的运行过程,进程实体由程序段、相关的数据段和PCB三部分构成。在没有引入线程的操作系统中,进程是系统进行资源分配和调度的一个独
2017-07-16 10:59:06
2812
原创 算法概论习题8.8 证明精确的4SAT问题是NP完全问题
算法概论习题8.8 证明精确的4SAT问题是NP完全问题题目描述:8.8. In theEXACT 4SATproblem, the input is a set of clauses, each of which is a disjunction of exactlyfour literals, and such that each variable occurs at mo
2017-07-04 23:00:50
417
原创 LeetCode Algorithms 210. Course Schedule II
题目难度: Medium原题描述:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first ta
2017-06-25 23:02:30
203
原创 LeetCode Algorithms 113. Path Sum II
题目难度: Medium原题描述:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22,
2017-06-25 15:00:13
173
原创 LeetCode Algorithms 46. Permutations
题目难度: Medium原题描述:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1
2017-06-07 22:49:25
200
原创 LeetCode Algorithms 47. Permutations II
题目难度: Medium原题描述:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,
2017-06-01 21:01:10
222
原创 LeetCode Algorithms 55. Jump Game
题目难度: Medium原题描述:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that
2017-05-18 19:00:41
188
原创 LeetCode Algorithms 42. Trapping Rain Water
题目难度: Hard原题描述:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given
2017-05-11 20:16:34
242
原创 LeetCode Algorithms 34. Search for a Range
题目难度: Medium原题描述:Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the or
2017-05-06 14:53:29
258
原创 LeetCode Algorithms 33. Search in Rotated Sorted Array
题目难度: Medium原题描述:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target
2017-05-02 09:24:59
263
原创 LeetCode Algorithms 22. Generate Parentheses
题目难度: Medium原题描述:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))",
2017-04-21 14:31:43
222
原创 LeetCode Algorithms 5. Longest Palindromic Substring
题目难度: Medium原题描述:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "ab
2017-04-16 22:09:44
330
原创 LeetCode Algorithms 32. Longest Valid Parentheses
题目难度: Hard原题描述:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parenthese
2017-04-09 20:37:03
201
原创 LeetCode Algorithms 17. Letter Combinations of a Phone Number
题目难度: Medium原题描述:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is
2017-03-29 14:49:18
220
原创 LeetCode Algorithms 105. Construct Binary Tree from Preorder and Inorder Traversal
题目难度: Medium原题描述:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题目大意: 给出一
2017-03-25 20:55:34
197
原创 LeetCode Algorithms 19. Remove Nth Node From End of List
题目难度: Medium原题描述:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the
2017-03-23 21:40:09
208
转载 C++ 虚函数表解析
C++ 虚函数表解析 转自: http://blog.csdn.net/haoel/article/details/1948051/ 作者: 陈皓 前言C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让父类的指针有“多种形态”,这是一种泛型技术。所谓泛型技术,说白了就是试图使用不变的代码来
2017-03-22 10:32:48
156
转载 MySQL存储引擎--MyISAM与InnoDB区别
MySQL存储引擎--MyISAM与InnoDB区别 InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持。MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,但是不提供事务支持,而InnoDB提供事务支持以及外部键等高级数据库功能。 以下是一些
2017-03-20 21:46:21
265
原创 LeetCode Algorithms 98. Validate Binary Search Tree
题目难度: Medium原题描述:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:(1)The left subtree of a node contains only nodes with ke
2017-03-19 15:19:09
215
原创 LeetCode Algorithms 11. Container With Most Water
题目难度: Medium原题描述:Given n non-negative integers a1,a2, ..., an, where each represents a point at coordinate (i,ai). n vertical lines are drawn such that the two endpoints of linei is
2017-03-11 10:01:29
213
原创 LeetCode Algorithms 3. Longest Substring Without Repeating Characters
题目难度: Medium原题描述:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "
2017-03-10 17:06:12
208
原创 LeetCode Algorithms 241. Different Ways to Add Parentheses
题目难度: Medium原题描述:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are
2017-03-03 16:29:57
226
原创 LeetCode Algorithms 2. Add Two Numbers
原题描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r
2017-02-26 11:28:19
220
原创 LeetCode Algorithms 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use thesame
2017-02-23 10:11:34
228
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人