• paip.提升性能--多核编程中的java .net php c++最佳实践 v2.0 cah


     paip.提升性能--多核编程中的java .net php c++最佳实践  v2.0 cah


    作者Attilax  艾龙,  EMAIL:1466519819@qq.com 
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax


     
     //////////多核编程的方法:
     1.等候jvm等直接支持多核
     2.框架实现 OpenMP 
     3.使用并发api  (FutureTask、ExecutorService  ) 推荐
     4.使用传统muilt thread 
     
     作者Attilax  艾龙,  EMAIL:1466519819@qq.com 
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax


     //////////////////根据可用CPU数决定线程数量
      int n=Runtime.getRuntime().availableProcessors();
    System.out.println(n);

    根据可用CPU数决定线程数量
    1
    static final int DEFAULT_IO_THREADS = Runtime.getRuntime().availableProcessors()
    用法一:判断所在服务器是否为多核,从而根据情况编写代码逻辑




    //////////////////////多核编程伪代码
     Result solve(Problem problem) {

    3 if (problem is small) directly solve problem

    5 else { 

    7 split problem into independent parts

    9 fork new subtasks to solve each part
    10 
    11 join all subtasks
    12 
    13 compose result from subresults 
    14 
    15 }
    16 
    17 }
    18
     


     
     参考:
     Java语言中使用OpenMP - richard_wu2005的专栏 - 博客频道 - CSDN.NET.htm
     关注Java7的多核_软件学园_科技时代_新浪网.htm
      java利用FutureTask、ExecutorService 在多核时代充分利用CPU运算 - Hecker385 - 博客园.htm
     
     
  • 相关阅读:
    [python] 类组合与聚合关系
    [python] 伪私有属性,防止变量名冲突
    [vim] 配置文件之常用命令模式
    [VIM] 编辑器---多行注释和取消注释及多行复制和黏贴
    [Visual Studio Code] 执行python
    [C] 编译器codeblocks安装注意
    字符串全排列
    集合全量子集提取
    random函数详解
    Solr常用命令总结
  • 原文地址:https://www.cnblogs.com/attilax/p/5964169.html
Copyright © 2020-2023  润新知