自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(74)
  • 资源 (1)
  • 收藏
  • 关注

原创 fio debug, 打开log

打开fio的log:1.10. Command line options (link)--debug=typeEnable verbose tracing type of various fio actions. May be all for all types or individual types separated by a comma (e.g. --debug=file,mem will enable file and memory debugging). Currently, add

2020-08-16 10:19:51 1102

原创 undefined reference to `Json::Value::Value`/CMake find wrong gcc version

编译时报错现象:undefined reference to `Json::Value::Value根据这个链接的说法,you have jsoncpp compiled with a different C++ ABI than you link against. The easiest solution is to use exactly the same compiler-version to build both library and executable. jsoncpp使用了其他的c+

2020-08-14 10:15:30 1559

原创 Centos/redhat下GLIBCXX_3.4.20的问题

编译一些软件的时候会出现类似如下问题:rror: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned long, unsigned lo

2020-08-13 10:49:34 3753 1

原创 qemu VM 设置网络

本文介绍如何为由qemu启动的VM(虚拟机)配置网络,使得VM可以访问host网络和外部网络,以及可以让host以及外部通过网络访问VM的服务(比如web/http).这里使用tun/tap虚拟设备为VM配置网络,qemu的命令参数如下,关于tun/tap,参考blog,和物理网卡一样可以配置IP、可以发送数据。-device e1000,mac=00:16:3e:01:01:01,netdev=net0-netdev tap,id=net0,ifname=tap1,script=no,down

2020-08-11 13:45:47 2100 1

原创 块设备虚拟化

https://www.cnblogs.com/Bozh/p/5788402.html这个文章介绍了块设备的虚拟化,非常详细,包括文件系统的框架,cache。他的KVM虚拟化的文章目录:https://www.cnblogs.com/Bozh/p/5788431.html

2020-08-06 17:52:35 203

转载 基于AMD-V KVM QEMU 的虚拟化

qemu的原理:http://soulxu.github.io/blog/2014/08/11/use-kvm-api-write-emulator/这个文章介绍了一个非常小巧的qemu实现,介绍了qemu最核心的原理,理清了qemu和kvm的关系,以及CPU的host mode和guest mode的使用。https://www.cnblogs.com/Bozh/p/5753379.html这个文章结合上面的文章,介绍了更多的细节。基于AMD-V KVM QEMU 的虚拟化,下面是我的

2020-08-06 17:49:41 1484

原创 内存虚拟化

参考:https://www.cnblogs.com/Bozh/p/5777077.html直接看最后的嵌套式页表就行了。

2020-08-06 16:28:18 186

原创 CPU虚拟化

可以参考:https://mp.weixin.qq.com/s/FGjl0t1G9C9WvB_kFKE0oQ https://www.cnblogs.com/Bozh/p/5757274.html这两篇文章介绍了AMD-V/Intel-V中的 guest (non-root) mode 和host (root) mode。为什么要引入AMD-V/Intel-V?AMD-V/Intel-V的本质是引入guest (non-root) mode 和host (root) mode。为什么要引

2020-08-06 16:27:06 371

原创 在虚拟机中访问host文件的过程

基本配置信息:虚拟机是由qemu启动,qemu使用kernel kvm启动虚拟机,VM是普通的linux系统。qemu通过virtio-9p在host和guest之间共享文件qemu 参数:-fsdev local,id=exp1,path=/tmp/,security_model=none-device virtio-9p-pci,fsdev=exp1,mount_tag=v_tmpOn the client it can be mounted with:$ mount -t 9p

2020-08-06 16:05:53 1240

原创 linux aio & libaio

Find two excellent blog to introduce linux aio and libaio usage.https://github.com/littledan/linux-aiohttps://jin-yang.github.io/post/linux-program-aio.html

2020-08-05 17:56:54 97

转载 makefile default target

How does “make” app know default target to build if no target is specified?$ makewhich target to build?By default, it begins by processing the first target that does not begin with a . aka the default goal; to do that, it may have to process other ta

2020-06-17 19:32:05 1176

转载 Squash commits into one with Git

Step 1: choose your starting commitgit rebase --interactive [commit-hash]Where [commit-hash] is the hash of the commit just before the first one you want to rewrite from.Step 2: picking and squa...

2020-04-26 20:33:39 250

转载 _Generic keyword in C

A major drawback of Macro in C/C++ is that the arguments are strongly typed checked i.e. a macro can operate on different types of variables(like char, int ,double,..) without type checking. /...

2020-04-24 19:14:48 136

转载 ubuntu: How to Copy selection to clipboard automatically like putty?

ubuntu中设置鼠标选中即复制的功能。主要命令和设置:it's possible.sudo apt-get install parcellitethen in the settings check "use primary" and "synchronize clipboards". it works....

2020-04-20 20:17:22 217

原创 win10总是很快自动休眠的解决方案

https://www.zhihu.com/question/39263412

2020-04-15 16:01:49 393

转载 Design a stack that supports getMin()/push/pop in O(1) time

See blog.will figure out why later.

2020-04-03 09:25:17 139

转载 How to access physical addresses from user space in Linux?

see stackoverflow.Will need dig more to see the details.

2020-04-03 09:15:50 132

原创 thread: detached state

for detached state thread.

2020-04-03 07:57:15 277

转载 swap(a,b)

1. method 1#include <stdio.h> void swap(int* xp, int* yp) { if (xp == yp) // Check if the two addresses are same return; *xp = *xp + *yp; *yp = *xp - *yp; *xp = *xp - *yp; } in...

2020-03-30 11:32:40 680

原创 max(a, b) and more

Summary from link1 and link2.The “maximum” function is commonly defined as a macro in standard C as follows:#define max(a,b) ((a) > (b) ? (a) : (b)) But this definition computes either a or...

2020-03-30 09:59:27 292

原创 container_of()

Add comments to container_of() wiki to understand its implementation.the Linux kernel uses offsetof() to implement container_of(), which allows something like a mixin type to find the structure that...

2020-03-30 08:46:31 162

原创 reentrant & thread safe with examples

Wiki says, In computing, a computer program or subroutine is called reentrant if multiple invocations can safely run concurrently. The concept applies even on a single processor system, where a reentr...

2020-03-29 17:31:45 102

原创 offsetof()

Add comments to offsetof() wiki to understand its implementation.The "traditional" implementation of the macro relied on the compiler obtaining the offset of a member by specifying a hypothetical st...

2020-03-29 15:46:07 222

原创 运算符优先级和结合性

这篇文章的表总结的很好。这里大概总结一下,便于记忆。运算符的优先级基本符合常识,除了下面5里面的按位运算符,优先级从高到低依次是:1. 取struct 成员的, 后缀++/--, 和函数调用(),例如(. / -> / [])2. 一元操作符, 前缀++/--,例如(+ / - / ! / ~ / * / & / (type) / sizeof )3. 运算符(* /...

2020-03-29 11:02:57 187

原创 Type conversions

All come from section 2.7 of the c programming language 2nd edition. BTW, this book is highly recommended for learning C, it's simple and illustrates the very important aspects of C.When an operator...

2020-03-29 09:50:34 133

转载 程序输出

1. copy from blogmain(){ int a[5]={1,2,3,4,5}; int *ptr=(int *)(&a+1); printf("%d,%d",*(a+1),*(ptr-1));}输出:2,5*(a+1)就是a[1],*(ptr-1)就是a[4],执行结果是2,5&a+1不是首地址+1,系统会认为加一个a数组的偏移...

2020-03-28 16:05:12 321

原创 static variableS with same name

1. 多个c文件,每个文件都包含static int a;2. 一个c文件中,有一个全局static int a;,在某个函数中,也有一个相同定义static int a;这两种情况都是合法的,另外这些变量a都是存放在同一个data段,那么C怎么区分各个变量的呢?Since there can be as many function-local statics with the sam...

2020-03-28 15:46:05 98

原创 size_t

According to the 1999 ISO C standard (C99), size_t is an unsigned integer type of at least 16 bit (see sections 7.17 and 7.18.3).size_t 能存储理论上可行的任何类型(包括数组)对象的最大大小。other articles1. https://www.em...

2020-03-28 15:14:10 144

原创 malloc(0) & free(NULL)

man malloc / man freeThe malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or...

2020-03-28 15:07:38 320

原创 c 常见问题

1. 用预处理指令#define声明一个常数,用以表明1年中有多少秒(忽略闰年问题)#define SEC_YEAR(365*24*60*60UL) 1)C中数据的默认匹配类型顺序(int,long,long long),都不是unsighed;2)int类型在标准中定义为最小16位,long最小32位,所以如果用signged数据类型表示这个常数,会放不下,所以需要使用unsigned...

2020-03-28 10:22:07 94

转载 What is the type of a constant in C? (U, UL, ULL, L, F)

Copied from here.When we write expressions like this in C:bool b = 1234567890 > 09876;What are the types of those constants? The number 1234567890 - what is its type? How does C represent i...

2020-03-28 09:56:34 394

转载 c struct with array of zero length (1 length or empty length in C99)

details see stackoverflow.struct s { int n; double d[];};int m = /* some value */;struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));This is a way to have variable sizes of...

2020-03-28 09:06:39 99

原创 c struct bitfield (结构体位域)

两篇非常棒的文章。1. 再谈c语言位域2. Section bitfields简要总结一下:C99 guarentees that bit-fields will be packed as tightly as possible, provided they don’t cross storage unit boundariesNote that the base type o...

2020-03-27 18:00:57 641

原创 The Slab Allocator

Save space for The Slab Allocator.

2020-03-23 16:03:22 112

原创 The Buddy System Algorithm

save space for The Buddy System Algorithm

2020-03-23 16:02:30 280

转载 why not 'switch case' accept float point in condition?

A switch case example as below. The expression used in switch must be integral type ( int, char and enum). Any other type of expression is not allowed. Why?int main() { int x = 2; switch (...

2020-03-23 15:57:45 99

原创 c sort function in library: qsort()

目录qsort() in C libraryexamplereferenceqsort() in C libraryUsually sort is the first step for an algorithm. In C, there is one library function for sort: qsort.It's prototype and introducti...

2020-03-21 08:44:52 131

原创 How time is updated when tick interrupts are disabled

In Understanding the Linux Kernel, there is paragram pasted below. It states why jiffies_64 is correct in long run even several timer interrupt are lost.cur_timer points to the timer_hpet object: in...

2020-03-12 20:02:22 129

原创 process switch in interrupt handler or sleep in interrupt handler

ULK:The price to pay for allowing nested kernel control paths is that an interrupt handlermust never block, that is, no process switch can take place while an interrupt handleris running. In fact,...

2020-03-10 13:34:29 181

原创 multithread: why main thread exit leads to other threads exit?

In linux multithread program, when main thread exit, other threads will exit too, why? How to keep other thread running when main thread exit?Consider following program, when main thread exit, new t...

2020-03-09 18:00:44 189

空空如也

空空如也

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

TA关注的人

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