Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多线程技术在使用过程中有哪些注意事项? #101

Open
tbfungeek opened this issue Feb 14, 2020 · 0 comments
Open

多线程技术在使用过程中有哪些注意事项? #101

tbfungeek opened this issue Feb 14, 2020 · 0 comments

Comments

@tbfungeek
Copy link
Owner

这个问题比较宽泛,如果大家又兴趣可以在这个issue下提交自己的答案:
这里只提几点个人的看法:

  • 在使用并行队列来执行大量 block 时,当某个 block 所在线程被锁住时,并行队列会创建大量线程以至于占用了过多资源而影响到主线程。这里可以用一个全局的 serial queue pool 来尽量控制全局线程数。
  • 在解决资源竞争的问题的时候可以考虑是否可以使用异步串行队列将操作串行化。
  • 要十分注意是否有导致死锁的问题存在
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant