[問題] kthread問題

看板C_and_CPP (C/C++)作者 (henry)時間12年前 (2013/12/19 10:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
開發平台(Platform): Linux 問題(Question): 最近練習在Linux上寫一個簡單的kernel module並建立kthread 使用for印出log 可以遇到一些問題 以下為程式碼 int run(void *data) { int i; for (i=0; i<10; i++) printk("kthread\n"); return 0; } static int kthread_init(void) { threads = kthread_create(run, NULL, "kthread1"); wake_up_process(threads); return 0; } 我在insmod之後去/var/log/messages看log印出來的是 Jun 23 09:17:56 localhost kernel: kthread Jun 23 09:17:56 localhost kernel: last message repeated 9 times 這邊沒有什麼問題 但是當我for loop增加到1000000之後 似乎就沒有辦法正確執行 Jun 23 13:57:16 localhost kernel: kthread Jun 23 13:57:17 localhost kernel: last message repeated 921 times 不是應該要印出 repeated 999999 times嗎? 希望有經驗的大大可以幫忙一下 感謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.11.17.212 ※ 編輯: henry4343 來自: 124.11.17.212 (12/19 10:02)
文章代碼(AID): #1IibEGgs (C_and_CPP)
文章代碼(AID): #1IibEGgs (C_and_CPP)