Implementation of a simple time slice rotation multi-channel program kernel code

Source: Internet
Author: User

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)

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.