<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_AnyKoro_分类_PHP异步或并行</title><id>http://feed.cnblogs.com/blog/u/53802/category/333952/rss</id><updated>2012-05-27T23:43:17Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JosephLiu/category/333952.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/53802/category/333952/rss"/><entry><id>http://www.cnblogs.com/JosephLiu/archive/2011/11/09/2243298.html</id><title type="text">如何分析和提供PHP的并行问题</title><summary type="text">概述：对于分析并行问题最有效的方法就是递归式地将问题分隔成2个或多个相同类型的子问题，直到这些问题简单（和快速）到可以直接解决。然后将这些子问题的解决方案组合成为原问题的解决方案。实例：为了更好的解释，我们举个实例。在数据库中现在有几百万条的财政支付数据记录，现在你希望使用PHP并行地处理：1、首先将你的数据按逻辑块分组，将需要在同一个事物中处理的分成一组。如果你要为很多个账号处理支付信息的话，就根据账号进行分组。2、确定并行处理的个数。例如，如果我们的服务器是1U的双核CPU，那么我们就运行2个并发的子处理。3、将所有的记录进行分割，具体按照什么分割根据实际情况，比如中位数、因为中位数可以很</summary><published>2011-11-09T09:15:00Z</published><updated>2011-11-09T09:15:00Z</updated><author><name>AnyKoro</name><uri>http://www.cnblogs.com/JosephLiu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JosephLiu/archive/2011/11/09/2243298.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JosephLiu/archive/2011/11/09/2243298.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/JosephLiu/archive/2011/11/09/2243191.html</id><title type="text">PHP中的并行处理（简）</title><summary type="text">针对多核的cpu泛滥的今天，如何使用好这些CPU资源成了重要的话题。于是异步和并行便开始了大行其道。在PHP中也有异步或并行编程的概念。接下来让我们看具体的例子。并行处理现在我们需要跑两个任务，分别为job1.php和job2.phpjob1.php的代码如下：$jobname = 'job1';set_time_limit(0);$secs = 30;while ($secs) { echo 'current job is'.$jobname,'::',$secs,"\n"; flush(); @ob_flush(); ##</summary><published>2011-11-09T08:55:00Z</published><updated>2011-11-09T08:55:00Z</updated><author><name>AnyKoro</name><uri>http://www.cnblogs.com/JosephLiu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JosephLiu/archive/2011/11/09/2243191.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JosephLiu/archive/2011/11/09/2243191.html"/><content type="html"/></entry></feed>
