kernel

Understanding Scheduling and /proc/[pid]/sched

戏子无情 提交于 2020-01-23 18:23:05
问题 I have a single threaded application that is (spinning and) pinned to a core with taskset and CPU isolation (i.e. isolcpus=12-23 nohz_full=21,22,23 rcu_nocbs=12-23; I have 2 CPUs, and 12 core each -- Skylake): exec taskset -c 22 setuidgid myuser envdir ./env -c = /opt/bin/UtilityServer > /tmp/logs/utility-server.log For some reason, after running few hours, I checked the stats: UtilityServer (1934, #threads: 1) ------------------------------------------------------------------- se.exec_start

Linux_I/O模型

隐身守侯 提交于 2020-01-23 11:31:02
I/O模型(I/O Models) 阻塞式I/O(blocking I/O) 非阻塞式I/O(nonblocking I/O) I/O多路复用(I/O multiplexing) 信号驱动I/O(signal driven I/O) 异步I/O(asynchronous I/O) 对于一个network I/O涉及两个系统对象,一个是调用I/O的进程(process),另一个是系统内核(kernel)。 下面用read操作来当做例子,当一个read操作发生时涉及的两个步骤: 等待内核将数据准备好 内核将准备好的数据拷贝到进程,也就是从kernel space拷贝到user space 对于一个socket的read操作,第一步通常是等待网络数据。当包到达时,会先拷贝到内核的内存中。然后第二步,把数据从内核的缓冲区拷贝到应用程序的缓冲区。 阻塞式I/O(blocking I/O) 姜太公钓鱼,愿者上钩。鱼竿丢下去,就等到鱼上来,啥事不干,啥事也干不了。 当应用程序调用recvfrom这个system call,kernel只有等到准备好数据,把数据拷贝到应用程序的缓冲区,才会返回。应用程序在调用recvfrom后,如果kernel没有准备好数据,会被“睡觉”。进程一直阻塞着,在呼叫recvfrom这个system call之后,直到kernel返回数据,或者错误。 blocking

Why is the close function is called release in `struct file_operations` in the Linux kernel?

浪子不回头ぞ 提交于 2020-01-23 04:54:20
问题 I'm trying to make a linux kernel module, which supports open, close, read and write operations. So I want to register these functions via struct file_operations, however I can't find 'close' entry in the struct. I think I should use 'release' instead of 'close', but I wonder why the name is 'release' and not 'close'? 回答1: Because the file may be opened multiple times, when you close a descriptor, only on the last close call for the last reference to the file invokes release. So there is a

When doing asynchronous I/O, how does the kernel determine if an I/O operation is completed?

做~自己de王妃 提交于 2020-01-23 03:13:32
问题 Some background on why I'm asking this. I asked this question a few hours ago When a goroutine blocks on I/O how does the scheduler identify that it has stopped blocking? which had the answer All I/O must be done through syscalls, and the way syscalls are implemented in Go, they are always called through code that is controlled by the runtime. This means that when you call a syscall, instead of just calling it directly (thus giving up control of the thread to the kernel), the runtime is

XGBoost crashing kernel in jupyter notebook

∥☆過路亽.° 提交于 2020-01-23 03:07:13
问题 I don't know how to make the XGBoost classifier work. I am running the code below on jupyter notebook, and it always generates this message "The kernel appears to have died. It will restart automatically." from xgboost import XGBClassifier model = XGBClassifier() model.fit(X, y) There is no problem with importing the XGBClassifier, but it crashes upon fitting it to my data. X is a 502 by 33 all-numeric dataframe, y is the set of 0 or 1 labels for each row. Does anyone know what could be the

add another field to user_struct

随声附和 提交于 2020-01-22 15:32:45
问题 I want to add new field ( to store number of ready process of this user ) to user_struct in file linux-source/kernel/user.c struct user_struct { atomic_t ready_processes; /* I add this field */ /* not important fields */ } where to initialize this field correctly ? 回答1: In order to add a new field to user_struct , you need to do 3 things: Definition of user_struct is in file sched.h(include/linux/sched.h) You should add your field in that struct . struct user_struct { atomic_t ready_processes

How do I know if my server has NUMA?

两盒软妹~` 提交于 2020-01-22 05:21:10
问题 Hopping from Java Garbage Collection, I came across JVM settings for NUMA. Curiously I wanted to check if my CentOS server has NUMA capabilities or not. Is there a *ix command or utility that could grab this info? 回答1: I'm no expert here, but here's something: Box 1, no NUMA: ~$ dmesg | grep -i numa [ 0.000000] No NUMA configuration found Box 2, some NUMA: ~$ dmesg | grep -i numa [ 0.000000] NUMA: Initialized distance table, cnt=8 [ 0.000000] NUMA: Node 4 [0,80000000) + [100000000,280000000)

How do I know if my server has NUMA?

不想你离开。 提交于 2020-01-22 05:21:06
问题 Hopping from Java Garbage Collection, I came across JVM settings for NUMA. Curiously I wanted to check if my CentOS server has NUMA capabilities or not. Is there a *ix command or utility that could grab this info? 回答1: I'm no expert here, but here's something: Box 1, no NUMA: ~$ dmesg | grep -i numa [ 0.000000] No NUMA configuration found Box 2, some NUMA: ~$ dmesg | grep -i numa [ 0.000000] NUMA: Initialized distance table, cnt=8 [ 0.000000] NUMA: Node 4 [0,80000000) + [100000000,280000000)

Android APP测试的日志文件抓取

房东的猫 提交于 2020-01-21 22:20:01
1 log文件分类简介   实时打印的主要有:logcat main,logcat radio,logcat events,tcpdump,还有高通平台的还会有QXDM日志   状态信息的有:adb shell cat /proc/kmsg ,adb shell dmesg,adb shell dumpstate,adb shell dumpsys,adb bugreport,工程 模式等   2 LOG抓取详解   l 实时打印 adb logcat -b main -v time>app.log 打印应用程序的log adb logcat -b radio -v time> radio.log 打印射频相关的log,SIM STK也会在里面,modem相关的ATcommand等,当然跟QXDM差的很远了。 adb logcat -b events -v time 打印系统事件的日志,比如触屏事件。。。 //android log的抓取 adb logcat //kernel log的抓取 adb shell cat /proc/kmsg //log 信息的保存 mkdir /data/anr logcat *:V > /data/anr/android demsg >/data/anr/kernel //按ctrl+c结束log输出 adb pull /data/anr .

Would Richardson–Lucy deconvolution work for recovering the latent kernel?

半城伤御伤魂 提交于 2020-01-21 19:46:27
问题 I am aware that Richardson–Lucy deconvolution is for recovering the latent image, but suppose we have a noisy image and the original image. Can we find the kernel that caused the transformation? Below is a MATLAB code for Richardson-Lucy deconvolution and I am wondering if it is easy to modify and make it recover the kernel instead of the latent image . My thoughts are that we change the convolution options to valid so the output would represent the kernel, what do you think? function latent