Implementation of a simple time slice rotation multi-channel program kernel code
Zhang Han + Original Works reprinted please indicate the source + "Linux Kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000
First, explain the core code of the program.
void __init my_start_kernel(void){int i = 0;while(1){i++;if(i%100000 == 0)printk(KERN_NOTICE "my_start_kernel here %d \n",i);}}
This is the startup function of the kernel code. It is written in C language. The loop is executed 100000 times each time and a statement is output.
void my_timer_handler(void){printk(KERN_NOTICE "\n>>>>>>>>>>>>>>>>>my_timer_handler here<<<<<<<<<<<<<<<<<<\n\n");}
This code is called when it is interrupted by time, and a statement is output each time it is called.
Then the code is integrated into Linux Kernel-3.9.4.
Or download mykernel_for_linux3.9.4sc.patch.
Then download the linux kernel-3.9.4
Decompress the downloaded package.
Enter the decompressed Folder:
Cd linux-3.9.4 to compile your code into linux-3.9.4
Patch-p1 <../mykernel_for_linux3.9.4sc.patch
Make allnoconfig
Make finally installs QEMU and runs the kernel.
Finally, run the kernel
The running result shows that the display of the terminal is constantly changing, and the section (if the flash is too fast, you can increase the value in the function to slow down the change speed)