开发者

What threading pratice is good 90% of the time? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

What practice or practices are good 90% of the time when working with threading with multiple cores?

Personally all i have done w开发者_运维问答as share immutable classes and pass (copy) data to a queue to the destine thread.


This is very vague - but there are a few basic precepts I'd always follow:

  1. Make sure threading makes sense before you implement it
  2. Focus on algorithms, not individual lines of code when designing for threading
  3. Thread at the highest level possible
  4. Prefer immutable data
  5. Synchronize data access appropriately
  6. Prefer high level threading libraries over low level, hand written threading code
  7. Measure (make sure 1. was true!)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜