[转]并行任务,线程池,工作窃取算法
记得在上个月,微博上有一则热议的新闻:小学数学老师布置作业,要求“数一亿粒米” 网友大多数是以吐槽的态度去看待这件事,也有人指出能用估算的方法,这是一道考察发散思维的题目。 一开始我也觉得这个题目很荒唐,似乎是不可能完成的任务。但这个细细想来值得玩味,我在思考一个问题:如果从计算机的角度去看,如何才能最快速地数一亿粒米呢?
Just One Pure ITer
记得在上个月,微博上有一则热议的新闻:小学数学老师布置作业,要求“数一亿粒米” 网友大多数是以吐槽的态度去看待这件事,也有人指出能用估算的方法,这是一道考察发散思维的题目。 一开始我也觉得这个题目很荒唐,似乎是不可能完成的任务。但这个细细想来值得玩味,我在思考一个问题:如果从计算机的角度去看,如何才能最快速地数一亿粒米呢?
Callable&Funture / CountdownLatch / Fork/Join
by leelight · Published October 19, 2018 · Last modified October 20, 2018
1. 1.前言 想必热爱游戏的同学小时候,都幻想过要是自己要是能像鸣人那样会多重影分身之术,就能一边打游戏一边上课了,可惜漫画就是漫画,现实中并没有这个技术,你要么只有老老实实的上课,要么就只有逃课去打游戏了。虽然在现实中我们无法实现多重影分身这样的技术,但是我们可以在计算机世界中实现我们这样的愿望。
Follow:
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |