分类: LINUX
2008-07-22 20:03:50
#include
#include
int krun(void *);
static int __init kthread_init(void)
{
pid_t kid;
int i;
for(i=0;i<10;++i)
{
kid = kernel_thread(krun,NULL,0);
printk("<1>In parent process %d\n",i);
printk("<1>child thread id is %d\n",kid);
}
return 0;
}
int krun(void *param)
{
printk("<1>In child process : %d\n",current->pid);
}
static void __exit kthread_exit(void)
{
return ;
}
MODULE_LICENSE("GPL");
MODULE_AUTHOR("GaryNeville");
module_init(kthread_init);
module_exit(kthread_exit);