自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

lianliange85的专栏

裸奔者的米兰梦想!

  • 博客(246)
  • 资源 (4)
  • 收藏
  • 关注

转载 大小堆 排序

From:Binary Min — Max Heap  andexample of heapSortA binary heap is a heap data struc­ture cre­ated using a binary tree.binary tree has two rules -Binary Heap has to be com­plete bi

2016-11-30 18:44:57 637

转载 归并排序

WIKI definition:Conceptually, a merge sort works as follows:Divide the unsorted list into n sublists, each containing 1 element (a list of 1 element is considered sorted).Repeatedly merge su

2016-11-30 18:35:45 537

原创 外部排序

External sorting is required when the data being sorted do not fit into themain memory of a computing device (usuallyRAM) and instead they must reside in the slowerexternal memory (usually a

2016-11-30 18:19:40 690

转载 Content-Type Header Field

The purpose of the Content-Type field is todescribe the data contained in the body fully enough that the receiving user agent can pick an appropriate agent or mechanism topresent the data to the

2016-11-28 13:33:33 589

原创 python 面试( interview )

总结面试中关于python 的问题,包括 python 数据结构,python 第三方库, python 算法,python 性能:1. 闭包(closure):we have a closure in Python when a nested function references a value in its enclosing scope.The criteria

2016-11-25 17:08:24 1364

转载 Javascript运行环境异步机制

在C#,Java中,异步方法,通常是伴随多线程,并发等术语一起出现的,比如C#中的async方法,是运行在一个线程池线程上,并且在异步方法运行完成后,有一个回调函数通知主线程。那么由于Javascript是单线程的,它的异步又是怎么解释的?首先对异步方法给一个定义,什么样的方法算是异步方法。我认为异步方法最主要有2点,一个是不阻塞当前代码的执行,另一个是有回调方法。即异步方法运行完

2016-11-10 16:44:32 589

转载 Http header Etag

From:ETAG此文详细说明了ETAG的作用。我发现网上很多人都在询问ETAG的对于优化网站的作用,有些人直接建议关闭ETAG。这篇博文可以完整的说明ETAG的作用,是否关闭,或者如何配置,要根据自己网站的情况而定。开始ETAG测试首先在浏览器输入以下访问地址比如我们访问某网站:http://xxxxxxxx/第一次的http请求代码如下(只包含头部信息)——

2016-11-05 21:40:22 682

原创 Linux memory performance analysis

Memory metrics: 1.Free memoryCompared to most other operating systems, the free memory value in Linux should not bea cause for concern.“The Linux kernel allocates most unused memory as file sys

2016-11-04 15:19:29 686

原创 Generate high cpuload on specified cpu core

Purpose : generate CPU load on CPU cores to test server thoughput related to cpu switch.Step: 1. Set affinity mask to include cpu and only cpupthread_setaffinity_np(pthread_self(), sizeof(cpu_

2016-11-03 13:27:51 557

转载 hash table and hash algorithm

Good explaination from geeker:Usage and Lingo:Hash tables are used to quickly store and retrieve data (or records).Records are stored in buckets using hash keysHash keys are calculated by applyi

2016-11-01 17:23:58 331

原创 linux seq 锁实现

seq lock:  2.6版本内核引入Application: 用于读写共享数据;Benifit: 读者不影响写锁,单一的写者与多个读者并发执行;Implement: 利用序列计数器,写锁获取或释放都会使序列值加1,读取数据前和后检查序列号:     1.值为偶数,则没有写者持有锁;        2.利用异或 检查序列值是否发生改变,改变了则期间写者对其加1了。#i

2016-10-18 17:36:45 700

转载 threadPool example

Thread Pools are useful when you need to limit the number of threads running in your application at the same time. There is aperformance overhead associated with starting a new thread, and each thre

2016-10-12 18:35:40 391

转载 WSGI

Answer 1:SCGI (like FastCGI) is a (serialized) protocol suitable for inter-process communication between a web-server and a web-application.WSGI is a Python API, connecting two (or more) Pytho

2016-10-10 16:13:36 327

转载 kernel space and user space

1.What's the difference between kernel stack and user stack ?In short, nothing - apart from using a different location in memory(and hence a different value for the stackpointer register), and

2016-10-10 15:59:32 528

原创 asynchronous vs non-blocking

linux 同步异步 阻塞 非阻塞

2016-10-10 15:46:01 412

转载 Linux schedule introduction

In Linux kernel, the scheduler is invoked by periodic timer interrupt. This iscalled periodic scheduling which is essential for preempting tasks that have consumed more CPU cycles in order tooffer

2016-10-08 15:03:32 387

转载 Introduction to the Python Web Server Gateway Interface (WSGI)

In breif WSGI is a specification, laid out in PEP 333, for astandardized interface between Web servers and Python Web frameworks/applications.The goal is to provide a relatively simple yet com

2016-09-25 16:04:50 332

转载 connect nonblock mode

非阻塞connect(non-block mode connect)套接字执行I/O操作有阻塞和非阻塞两种模式。在阻塞模式下,在I/O操作完成前,执行操作的函数一直等候而不会立即返回,该函数所在的线程会阻塞在这里。相反,在非阻塞模式下,套接字函数会立即返回,而不管I/O是否完成,该函数所在的线程会继续运行。客户端调用connect()发起对服务端的socket连接,如果客户端的socket

2016-09-24 19:09:46 953

转载 Non blocking IO web server

Many IO related system calls, like read(2), will block, that is not return, until there is activity.  A socket can be placed in "non-blocking mode" which means that these system calls will return im

2016-09-23 17:46:20 539

转载 Real time system

The most common designs are:Event-driven – switches tasks only when an event of higher priority needs servicing; called preemptive priority, or priority scheduling.Time-sharing – switches tasks

2016-09-22 18:37:36 956

转载 Apache thrift

RPC (Remote Procedure Call) is likecalling a function, only that it is present remotely on a different serveras a service. A service exposes many such functions/procedure to its client. And client

2016-09-21 16:04:15 385

转载 linux_for_each_entry

在Linux内核源码中,经常要对链表进行操作,其中一个很重要的宏是list_for_each_entry:意思大体如下:         假设下面几个结点,则第一个member代表head,list_for_each_entry的作用就是循环遍历每一个pos中的member子项。list_for_each_entry应用:         它实际上是一个 for 循

2016-02-16 15:48:54 561

转载 Linux 双链表 list_for_each_entry 实现

们知道list_for_each_entry会用到list_entry,而list_entry用到container_of,所以首先讲讲container_of。在讲container_of之前我们不得不提到offsetof,因为在container_of中会使用到它,所以我们看下来,把list_for_each_entry函数的用法理顺我们对整个Linux中经常用到的一些函数就会比较

2016-02-16 15:44:30 550

转载 内核双链表 list_entry实现

list_entry(ptr, type, member)语句理解  list_entry(ptr, type, member)语句定义在文件include/linux/list.h中。00342: /**00343:  *list_entry-getthestructforthisentry00344:  *@ptr:the&structlist_headpointer.00

2016-02-16 14:15:30 562

原创 write 操作文件注意事项

多线程同时写文件可能存在的问题:1.文件被另一个线程占用,fd不可写,导致write失败;2.write 拷贝大量数据到文件时,一次操作不能全部写入,需要循环检测,重复写入才能保证数据完整性。/* record the tty information */typedef struct LocoTty_s{    U32     tid;            /**< the tty

2015-12-06 15:33:58 1271

原创 TCP 流协议和消息分帧的理解

TCP提供一种面向连接的、可靠的字节流服务。面向连接意味着两个使用TCP的应用(通常是一个客户和一个服务器)在彼此交换数据包之前必须先建立一个TCP连接。应用数据被分割成TCP认为最适合发送的数据块。这和UDP完全不同,应用程序产生的数据长度将保持不变。由TCP传递给IP的信息单位称为报文段或段(segment)。两个应用程序通过TCP连接交换8bit字节构成的字节流。TCP不

2015-12-06 15:06:05 7898 1

转载 arp resolution

Origin:点击打开链接ARP协议的报文格式结构ether_header定义了以太网帧首部;结构arphdr定义了其后的5个字段,其信息用于在任何类型的介质上传送ARP请求和回答;ether_arp结构除了包含arphdr结构外,还包含源主机和目的主机的地址。定义常量#define EPT_IP   0x0800    /* type: I

2015-11-02 14:50:03 492

原创 C Macro UG

/** set a bit in bit32. loc from 0~31 */#define BIT_SET(bit32, loc)     ((bit32) |= (0x1 /** clear a bit in bit32. loc from 0~31 */#define BIT_CLEAR(bit32,loc)    ((bit32) &= ~(0x1 /**

2015-09-15 14:39:56 679

转载 C 左移 右移 opration

先说左移,左移就是把一个数的所有位都向左移动若干位,在C中用int i = 1;i = i 也就是说,1的2进制是000...0001(这里1前面0的个数和int的位数有关,32位机器,gcc里有31个0),左移2位之后变成 000...0100,也就是10进制的4,所以说左移1位相当于乘以2,那么左移n位就是乘以2的n次方了(有符号数不完全适用,因为左移有可能导致符号变化,下

2015-09-15 14:33:46 817 1

转载 同步 异步 阻塞 非阻塞机制

知乎:阻塞”与"非阻塞"与"同步"与“异步"不能简单的从字面理解,提供一个从分布式系统角度的回答。1.同步与异步同步和异步关注的是消息通信机制 (synchronous communication/ asynchronous communication)所谓同步,就是在发出一个*调用*时,在没有得到结果之前,该*调用*就不返回。但是一旦调用返回,就得到返回值了。换句话说,就

2015-08-26 23:22:19 545

转载 getchar and getch

1.从缓冲区读走一个字符,相当于清除缓冲区2.前面的scanf()在读取输入时会在缓冲区中留下一个字符'\n'(输入完s[i]的值后按回车键所致),所以如果不在此加一个getchar()把这个回车符取走的话,gets()就不会等待从键盘键入字符,而是会直接取走这个“无用的”回车符,从而导致读取有误3.getchar()是在输入缓冲区顺序读入一个字符(包括空格、回车和Tab)getcha

2015-08-24 22:25:35 515

转载 JAVA中CLASS.FORNAME的含义

Class.forName(xxx.xx.xx) 返回的是一个类, .newInstance() 后才创建一个对象 Class.forName(xxx.xx.xx);的作用是要求JVM查找并加载指定的类,也就是说JVM会执行该类的静态代码段Class aClass = Class.forName(xxx.xx.xx); Object anInstance = aClass.newInstance(

2015-08-08 18:35:48 533

转载 big O notation

大O符号是一种算法复杂度的相对表示方式。这个句子里有一些重要而严谨的用词:相对(relative):你只能比较相同的事物。你不能把一个做算数乘法的算法和排序整数列表的算法进行比较。但是,比较2个算法所做的算术操作(一个做乘法,一个做加法)将会告诉你一些有意义的东西;表示(representation):大O(用它最简单的形式)把算法间的比较简化为了一个单一变量。这个变量的选

2015-06-28 23:14:49 1962

转载 数字签名

1 引言  为了确保数据传输的安全性,不得不采取一系列的安全技术,如加密技术、数字签名、身份认证、密钥管理、防火墙、安全协议等。其中数字签名就是实现网上交易安全的核心技术之一,它可以保证信息传输的保密性、数据交换的完整性、发送信息的不可否认性、交易者身份的确定性等。  2 数字签名的概念  数字签名在ISO7498—2标准中定义为:“附加在数据单元上的一些数据,或是对数据单

2015-06-25 15:11:14 1872

转载 How To "arp -a" In IPv6

原文:ipv6 ndpI am seeing a lot of searches for "arp -a" "IPv6". So, you want to know how to perform "arp -a" in IPv6? Well, I'll show you. The equivalent of ARP (Address Resolution Protocol) in

2015-05-05 23:44:33 4342

转载 IPV6 get mac(NDP)

You want to use the neigh function of the ip command to show IPv6 neighbours, like so:$ ip -6 neighfe80::200:ff:fe00:0 dev eth0 lladdr 00:0e:54:24:23:21 router REACHABLEfe80::202:b0ff:fe01:2ab

2015-05-05 23:31:32 1001

转载 IPv6邻居发现协议

IPv6邻居发现协议NDP(Neighbor Discovery Protocol,邻居发现协议)是IPv6的一个关键协议,它组合了IPv4中的ARP、ICMP路由器发现和ICMP重定向等协议,并对它们作了改进。作为IPv6的基础性协议,NDP还提供了前缀发现、邻居不可达检测、重复地址监测、地址自动配置等功能。1.地址解析:地址解析是一种确定目的节点的链路层地址的方法。NDP中的地址解析功

2015-05-05 23:27:58 20840 1

转载 shell awk 用法总结

关于NR和FNR的典型应用:现在有两个文件格式如下:#cat account张三|000001李四|000002#cat cdr000001|10000001|20000002|30000002|15想要得到的结果是将用户名,帐号和金额在同一行打印出来,如下:张三|000001|10张三|000001|20李四|000002|30

2015-02-10 13:33:36 977

转载 shell 进制转换

shell 脚本默认数值是由10 进制数处理,除非这个数字某种特殊的标记法或前缀开头. 才可以表示其它进制类型数值。如:以 0 开头就是 8 进制.以0x 开头就是16 进制数.使用方法:其它进制转为10进制八进制转十进制:[chengmo@centos5 ~]$ ((num=0123));[chengmo@centos5 ~]$ echo $num

2015-02-10 13:23:04 592

转载 taskset- CPU affinity

Nametaskset - retrieve or set a process's CPU affinitySynopsistaskset [options] mask command [arg]...taskset [options] -p [mask] pidDescriptionTaskset is used to set or retrieve th

2015-02-05 23:41:08 846

C语言程序设计(经典版)

C语言程序设计,详细介绍了C语法,经典例子,高清,带目录

2018-11-16

gpu 虚拟化介绍

gpu 虚拟化介绍 gpu虚拟化用户手册,作为研究gpu虚拟化的参考

2018-11-15

嵌入式linux系统开发详解

嵌入式linux系统开发详解,基于ARM平台,包含一些详细的开发案例

2018-11-15

空空如也

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

TA关注的人

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