The experiments involved in this article are blog http://blog.csdn.net/tianshuai11/article/details/7465587For example, read the above blog and digest the following example.
I. Module Method
Jiq. c
# Include
Makefile
KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd)obj-m := jiq.o modules:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesclean:rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions.PHONY: modules modules_install clean
Test:
Root @ Ubuntu :~ /Desktop/jiq # Make
Ro
crashkernel = auto lang = en kernel = volgroup/lv_root keyboardtype = pc keytable = US rd_no_dm rhgb quiet
Initrd/initramfs-3.2.84.img
Note: isolcups must be followed by root and cannot be placed at the end (for personal testing, the specific reasons need to be identified)
(2) check whether the isolation is successful:
[[Email protected] ~] # Ps-elo psr, argS | awk '{if ($1 = 3) Print $0 }'
3 [kworker/u: 0]
3 [migration/3]
3 [
queue
One or more protocol drivers can request multiple Spi_message requests at the same time to the controller driver, and these spi_message are also in the form of a linked list below the queue field that represents the spi_master structure of the controller:struct Spi_master { struct device dev; ...... BOOL queued; struct Kthread_worker kworker; struct task_struct
: observe the program f s uid pid ppid c pri ni addr sz wchan tty time spent 0 S 1000 8594 8583 0 80 0-2318 wait pts/1 00:00:00 bash0 T 1000 882 8 8594 0 80 0-12020 signal pts/1 00:00:00 vim0 R 1000 8877 8594 0 80 0-1177-pts/1 00:00:00 psF: Program permission S: Program Status R: running state, s: sleep mode, can wake up, D: Can not wake up the sleep state, such as waiting for I/OT: Stop State, Z: BotNet state, the program has been terminated but cannot be removed from the memory UID: IDPID of t
Spi_message requests to the controller at the same time, and these spi_message are also in the form of a linked list under the Queue field representing the controller's spi_master structure:
struct Spi_master {
struct device dev;
......
BOOL queued;
struct Kthread_worker kworker;
struct task_struct *kworker_task;
struct kthread_work pump_m
information about the PIDAll programs of the user under the PS au display terminalrunning an instanceExample One: Ps-la | More$ ps-la |moref S UID PID PPID C PRI NI ADDR SZ Wchan TTY time CMD5 20100800-13212 Ep_pol?00:02:Systemd0 20200800-0 Kthrea?00:00:XX kthreadd1 S0320800-0 Smpboo?00:00:ksoftirqd/01 S052060-20-0 worker?00:00:XX kworker/0:0H1 S0720-40--0 Smpboo?00:00:migration/01 S0820800-0 RCU_GP?00:00:XX rcu_bh0 20920800-0 rcu_no?00:00:XX rcuob/0
of the hardware schematic diagram5) Run a program with only the business logic layer code to read the ADC values and view the system status.Discover the system process status through top view a kworker process has an exception, found that the process CPU utilization is 20%~30%.Continue to find the data and discover that the kworker process is actually a kernel thread that handles queues in the kernel.Seein
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.