開發平台(Platform): (Ex: Win10, Linux, ...)
Linux
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
clang++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
利用multiprocess印出一行字,每個process只能印一個字元
例如印出Hello, World! 需要13個process照順序印出每個字元
餵入的資料(Input):
無
預期的正確結果(Expected Output):
Hello, World!
錯誤結果(Wrong Output):
大部分時候正確印出Hello, World! 但有時候是其他無法預期的錯誤結果
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
https://ideone.com/9RI620
補充說明(Supplement):
我是利用shared memory使每個process共用一塊記憶體存int sp
每個process印出 s[*sp]後將(*sp)++
第一次練習multiprocess,遇到這種狀況真的不知道怎麼debug
希望版上的大大可以指導一下QQ