kernel

bcc-tools工具之offcputime

痞子三分冷 提交于 2020-01-17 02:04:06
先了解什么是off-cpu On-CPU : where threads are spending time running on-CPU. Off-CPU : where time is spent waiting while blocked on I/O, locks, timers, paging/swapping, etc. 从上面的意思基本上了解offcputime的意思是什么了:用于测量某一进程被阻塞的时间。 老样子,还是从help开始说起: usage: offcputime [-h] [-p PID | -t TID | -u | -k] [-U | -K] [-d] [-f] [--stack-storage-size STACK_STORAGE_SIZE] [-m MIN_BLOCK_TIME] [-M MAX_BLOCK_TIME] [--state STATE] [duration] Summarize off-CPU time by stack trace positional arguments: duration duration of trace, in seconds optional arguments: -h, --help show this help message and exit -p PID, --pid PID trace this

why to use these weird nesting structure

和自甴很熟 提交于 2020-01-16 19:37:52
问题 i'm trying to study the linux kernel and reading the kernel code, but i can't understand the structure they use for the page structure as shown below: i mean,why they use union nested in the struct which nested in the union (the code is simplified...) struct page { unsigned long flags; struct address_space *mapping; struct { union { pgoff_t index; void *freelist; }; union { unsigned counters; struct { union { atomic_t _mapcount; struct { unsigned inuse:16; unsigned objects:15; unsigned frozen

【一篇入魂】网络编程中的五种IO模型

点点圈 提交于 2020-01-16 14:35:22
我们在进行编程开发的时候,经常会涉及到同步,异步,阻塞,非阻塞,IO多路复用等概念,这几个概念有区别,但是有时候也容易混淆,如果不总结一下的话很容易受到困扰,下面就记录一下这几个概念的理解。 Unix网络编程中的五种IO模型 Blocking IO - 阻塞IO NoneBlocking IO - 非阻塞IO IO multiplexing - IO多路复用 signal driven IO - 信号驱动IO asynchronous IO - 异步IO 由于 signal driven IO 在实际使用中并不常用,所以这里只讨论剩下的四种IO模型。 在讨论之前先说明一下IO发生时涉及到的对象和步骤,对于一个network IO,它会涉及到两个系统对象: application 调用这个IO的进程 kernel 系统内核 那他们经历的两个交互过程是: 阶段1 wait for data 等待数据准备 阶段2 copy data from kernel to user 将数据从内核拷贝到用户进程中 之所以会有同步、异步、阻塞和非阻塞这几种说法就是根据程序在这两个阶段的处理方式不同而产生的。了解了这些背景之后,我们就分别针对四种IO模型进行讲解。 Blocking IO - 阻塞IO 在linux中,默认情况下所有的socket都是blocking,一个典型的读操作流程大概如下图:

Symfony2.3, How to register a 3rd party bundle in Kernel, and load it from a Controller?

痴心易碎 提交于 2020-01-16 04:06:06
问题 I would like to get some help with symfony2 regarding the bundle registration in the Kernel, Ive read most of symfony2 cookbook and doc for exemple : How to install 3rd party Bundles But yet everytime I failed doing so. I am using symfony 2.3 with composer, both up to date. Today I would like to use a 3rd party bundle called "google/apiclient" found on packagist.org, therefor i add the following line "google/apiclient": "dev-master" to my composer.json file which is located at the root of my

如何修改主机名hostname

匆匆过客 提交于 2020-01-16 03:39:53
hostname是Linux系统下的一个内核参数,它保存在/proc/sys/kernel/hostname下,但是它的值是Linux启动时从rc.sysinit读取的。而/etc/rc.d/rc.sysinit中HOSTNAME的取值来自与/etc/sysconfig/network下的HOSTNAME [root@navinfo kernel]# cat /proc/sys/kernel/hostname navinfo 在/etc/rc.d/rc.sysinit中,有如下逻辑判断,当/etc/sysconfig/network下hostname值为localhost或者localhost.localdomain时,将会使用/etc/hosts中IP地址对应的hostname来重新设置系统的hostname。 如何修改hostname? 1: hostname DB-Server echo DB-Server > /proc/sys/kernel/hostname sysctl kernel.hostname=DB-Server 这三个命令是等价的 –运行后立即生效(新会话生效),系统重启后失效 2 : 修改/etc/sysconfig/network下的HOSTNAME变量 –重启永久生效 3:修改/etc/hosts –重启永久生效 127.0.0.1 localhost

“ error: unknown field ‘compat_ioctl’ specified in initializer ” while creating dummy ioctl

折月煮酒 提交于 2020-01-15 18:51:44
问题 static const struct inode_operations msdos_dir_inode_operations = { .create = msdos_create, .lookup = msdos_lookup, .unlink = msdos_unlink, .mkdir = msdos_mkdir, .rmdir = msdos_rmdir, .rename = msdos_rename, .setattr = fat_setattr, .getattr = fat_getattr, .compat_ioctl = my_ioctl, ---->error }; i also tried with unlocked_ioctl but same error occured [root@localhost fat]# make make -C /lib/modules/3.11.10-100.fc18.x86_64/build M=/home/aditya/linux-3.12.6/fs/fat modules make[1]: Entering

Homemade Kernel linker global variables and inline Strings cannot be accessed

吃可爱长大的小学妹 提交于 2020-01-15 15:18:30
问题 I have followed some tutorials on the web and created my own kernel. It is booting on GRUB with QEMU succesfully. But I have the problem described in this SO question, and I cannot solve it. I can have that workaround described, but I also need to use global variables, it would make the job easier, but I do not understand what should I change in linker to properly use global variables and inline strings. main.c struct grub_signature { unsigned int magic; unsigned int flags; unsigned int

Homemade Kernel linker global variables and inline Strings cannot be accessed

≯℡__Kan透↙ 提交于 2020-01-15 15:16:54
问题 I have followed some tutorials on the web and created my own kernel. It is booting on GRUB with QEMU succesfully. But I have the problem described in this SO question, and I cannot solve it. I can have that workaround described, but I also need to use global variables, it would make the job easier, but I do not understand what should I change in linker to properly use global variables and inline strings. main.c struct grub_signature { unsigned int magic; unsigned int flags; unsigned int

Homemade Kernel linker global variables and inline Strings cannot be accessed

点点圈 提交于 2020-01-15 15:16:28
问题 I have followed some tutorials on the web and created my own kernel. It is booting on GRUB with QEMU succesfully. But I have the problem described in this SO question, and I cannot solve it. I can have that workaround described, but I also need to use global variables, it would make the job easier, but I do not understand what should I change in linker to properly use global variables and inline strings. main.c struct grub_signature { unsigned int magic; unsigned int flags; unsigned int

Homemade Kernel linker global variables and inline Strings cannot be accessed

我们两清 提交于 2020-01-15 15:16:07
问题 I have followed some tutorials on the web and created my own kernel. It is booting on GRUB with QEMU succesfully. But I have the problem described in this SO question, and I cannot solve it. I can have that workaround described, but I also need to use global variables, it would make the job easier, but I do not understand what should I change in linker to properly use global variables and inline strings. main.c struct grub_signature { unsigned int magic; unsigned int flags; unsigned int