[問題] pthread可以自己分配thread要到哪個CPU上執行嗎?

看板C_and_CPP (C/C++)作者 (Cobra)時間14年前 (2011/09/27 10:06), 編輯推噓3(303)
留言6則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) linux 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) pthread 問題(Question): 有辦法自己指定thread要到哪個cpu上執行嗎? 或是可以有get cpu id等function知道cpu的id嗎? 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.225.128

09/27 10:20, , 1F
SetThreadAffinityMask
09/27 10:20, 1F

09/27 10:22, , 2F
抱歉,誤會一場,上面 api 是在 win, linux 上要再查一下
09/27 10:22, 2F

09/27 15:52, , 3F
tool "schedutils"也可順便參考它的 code
09/27 15:52, 3F

09/27 20:03, , 4F
請愛用man page好嗎...
09/27 20:03, 4F

09/27 20:03, , 5F
man pthreads ...
09/27 20:03, 5F

09/29 16:18, , 6F
sched_setaffinity()
09/29 16:18, 6F
文章代碼(AID): #1EWI-cSg (C_and_CPP)
文章代碼(AID): #1EWI-cSg (C_and_CPP)