kernel

Write file from kernel land

久未见 提交于 2020-02-02 03:43:09
问题 I would like to write into a log file from the kernel space. I can create, open & close file (/var/log/my_kern_module.log) but if I try to write something into, my module crash... So I know read/write file from kernel space is bad, but I must do it in this module. Do you have any suggestion to help me ? thx Here you can find the code who perform write on my kernel module. It code run into a thread (kthread) mutex_lock(&gl_mtx_writelog); printk(KERN_EMERG "Readed : %s\n", buffer); fd = filp

虚拟化技术xen的简介和安装

本秂侑毒 提交于 2020-02-01 10:25:20
虚拟化技术的分类: 1,模拟:Emulation ​ Qemu,PearPC,Bochs 2,完全虚拟化:Full Virtualization,Native Virtualization ​ HVM:hardware virtualization machine ​ vmware workstation,virtualBox,Parallels desktop(mac),KVM,xen 3,半虚拟化:pava-virtualization ​ 必须修改guestOS的内核,让它知道自己不是允许在物理机器删上,而是允许在虚拟环境中。 ​ 使用hypercall调用物理机的cpu ​ xen,UML(user-mode Linux) 4,容器虚拟化 ​ docker,openvz,LXC(linux container),libcontainer,virtuozzo,linux V Server 5,库级别虚拟化 ​ wine xen 剑桥大学开发的开源vmm(virtual machine monitor),虚拟机监视器。 xen是安装在物理机器上的。 xen只控制物理机器的cpu和内存,I/O控制,交给了在它上面安装的第一个虚拟内核(叫dom0)。处理dom0的虚拟机叫:domU,在domU上的I/O操作,都是直接发给dom0,dom0再去操作硬件控制器。domU上的I

VMware Workstation 10+Centos7(64位)共享文件夹

瘦欲@ 提交于 2020-02-01 04:58:44
这一两天一直在研究VMware Workstation自带的共享文件夹的功能,期间出了不少问题,在公司搭建的是vm10.0+centos07,在家搭建的是VM 7+centos07... 公司环境搭建: 共享访问方式: 1.VM10挂载的操作系统和主机系统当做一个局域网,可以通过浏览网络来进行访问,当然这种方式没有用VM10自带的共享文件夹访问舒畅 2.用VM10的共享功能, 一、vm10.0+centos07 首先,在VM10中选择安装 这样会在centos中安装一个cdrom,具体的路径为:/run/media/root/VMware Tools,上面有个VMwareTools-9.6.2-1688356.tar.gz的文件包。, 我们可以先用tar命令进行归档 第一步:cp :/run/media/root/VMware Tools/VMwareTools-9.6.2-1688356.tar.gz /tmp,把这个文件拷贝到tmp下 第二步:cd /tmp进入临时目录,ls 查看刚才的文件是否在这个目录下 第三步:tar zxvf VMwareTools-5.5.0-18463.tar.gz 解压这个文件 第四步:cd vmware-tools-distrib进行vmware-tools-distrib目录 第五步:./vmware-install.pl 执行这个文件

Laplacian kernels of higher order in image processing

痴心易碎 提交于 2020-01-30 07:55:06
问题 In literature on digital image processing you find examples of Laplace kernels of relatively low orders, typically, 3 or 5. I wonder, is there any general way to build Laplace kernels or arbitrary order? Links or/and references would be appreciated. 回答1: The Laplace operator is defined as the sum of the second derivatives along each of the axes of the image. (That is, it is the trace of the Hessian matrix): ∇ I = ( ∂ 2 /∂ x 2 + ∂ 2 /∂ y 2 ) I There are two common ways to discretize this: Use

Laplacian kernels of higher order in image processing

杀马特。学长 韩版系。学妹 提交于 2020-01-30 07:54:39
问题 In literature on digital image processing you find examples of Laplace kernels of relatively low orders, typically, 3 or 5. I wonder, is there any general way to build Laplace kernels or arbitrary order? Links or/and references would be appreciated. 回答1: The Laplace operator is defined as the sum of the second derivatives along each of the axes of the image. (That is, it is the trace of the Hessian matrix): ∇ I = ( ∂ 2 /∂ x 2 + ∂ 2 /∂ y 2 ) I There are two common ways to discretize this: Use

NUMA特性禁用

寵の児 提交于 2020-01-29 22:03:22
numa把一台计算机分成多个节点(node),每个节点内部拥有多个CPU,节点内部使用共有的内存控制器,节点之间是通过互联模块进行连接和信息交互。 因此节点的所有内存对于本节点所有的CPU都是等同的,对于其他节点中的所有CPU都不同。因此每个CPU可以访问整个系统内存,但是访问本地节点的内存速度 最快(不经过互联模块),访问非本地节点的内存速度较慢(需要经过互联模块),即CPU访问内存的速度与节点的距离有关,该距离成为Node Distance。 查看当前numa的节点情况: numactl --hardware 节点之间的距离(Node Distance)指从节点1上访问节点0上的内存需要付出的代价的一种表现形式。 Numa内存分配策略有一下四种: 缺省default:总是在本地节点分配(当前进程运行的节点上)。 绑定bind:强制分配到指定节点上。 交叉interleavel:在所有节点或者指定节点上交叉分配内存。 优先preferred:在指定节点上分配,失败则在其他节点上分配。 查看当前系统numa策略: numactl --show 因为numa默认的内存分配策略是优先在进程所在CPU的本地内存中分配,会导致CPU节点之间内存分配不均衡, 当某个CPU节点内存不足时,会导致swap产生,而不是从远程节点分配内存,这就是swap insanity现象。

代码注释示例

你。 提交于 2020-01-29 17:03:08
/** @brief Blurs an image using a Gaussian filter. The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported. @param src input image; the image can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. @param dst output image of the same size and type as src. @param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero's and then they are computed from sigma. @param sigmaX Gaussian kernel standard

Linux系统NBD驱动安装拓展篇

亡梦爱人 提交于 2020-01-28 18:08:16
前言 : 最近在安装中标麒麟机器的时候,发现麒麟的操作系统找不到src.rpm包,且系统内部也没有内核文件,导致正常方法安装NBD驱动无法实施。故这里找了另一种办法帮助此类型操作系统安装NBD驱动。 一、 中标麒麟系统类型及内核信息 系统镜像名称 内核版本 Kylin-4.0-1E-desktop_20160401-final-x86_64-2016-04-01 3.16.0-23-generic NeoKylin-Linux-Advanced-Server-6.7 2.6.32-573.el6.x86_64 NeoKylin-sws-3.2(64) 2.6.32-220.2.1.2.ky3.2.x86_64 YHKylin-4.2-5-x86_64-server 2.6.32-431.29.2.3.ky3.1.x86_64 对于以上4个内核版本的机器,其中3.16.0-23-generic和ubuntu(ubuntu-14.10-desktop-amd64)内核版本一模一样,而且/lib/modules/3.16.0-23-generic/kernel/drivers/block文件夹下已经有编译好的nbd.ko文件,测试发现可以插入到目标机器麒麟系统中。 二、查找相同内核的其他Linux系统: 例如红帽系统: 三、常规安装NBD驱动 在相同内核的系统

Operating System Kernel

雨燕双飞 提交于 2020-01-28 03:35:52
Operating System Kernel Kernel is the core part of operating system and responsible for all major activities of this operating system. Kernel consists of various modules and it interacts directly with the low level hardware. Kernel Operating System Kernel is the core part of operating system Operating system (OS) is a collection of software that manages computer hardware resources It acts as an interface between software and hardware of the computer system. It acts as an interface between user and hardware of the computer It plays an important role in memory management, task management,

Why linux kernel use trap gate to handle divide_error exception?

故事扮演 提交于 2020-01-27 20:55:56
问题 In kernel 2.6.11.5, divide zero exception handler is set up as: set_trap_gate(0,&divide_error); According to "Understanding The Linux Kernel", Intel trap gate cannot be accessed by a User Mode process. But it's quite possible that a user mode process also generate a divide_error . So why Linux implement it in this way? [Edit] I think that the question is still open, since set_trap_gate() sets DPL value of IDT entry to 0, which means only CPL=0 (read kernel) code can execute it, so it's