class Program
{
static void Main(string[] args)
{
Stopwatch s = new Stopwatch();
s.Start();
EvenNumbersSum();
OddNumbersSum();
s.Stop();
Console.WriteLine("before using multiple threads"+s.ElapsedMilliseconds);
s = new Stopwatch();
s.Start();
Thread t1 = new Thread(EvenNumbersSum);
Thread t2 = new Thread(OddNumbersSum);
t1.Start();
t2.Start();
t1.Join();
t2.Join();
s.Stop();
Console.WriteLine("after using multiple threads"+s.ElapsedMilliseconds); } public static void EvenNumbersSum()
{
double sum=;
for(int i=;i<=;i++)
{
if(i%==)
{
sum += i;
}
}
Console.WriteLine("sum= "+sum);
} public static void OddNumbersSum()
{
double sum = ;
for (int i = ; i <= ; i++)
{
if (i % == )
{
sum += i;
}
}
Console.WriteLine("sum= " + sum);
}
}

Part 97 Performance of a multithreaded program的更多相关文章

  1. Part 95 to 96 Deadlock in a multithreaded program

    Part 95   Deadlock in a multithreaded program class Program { static void Main(string[] args) { Cons ...

  2. Design a high performance cache for multi-threaded environment

    如何设计一个支持高并发的高性能缓存库 不 考虑并发情况下的缓存的设计大家应该都比较清楚,基本上就是用map/hashmap存储键值,然后用双向链表记录一个LRU来用于缓存的清理.这篇文章 应该是讲得很 ...

  3. 【转】Multithreaded Python Tutorial with the “Threadworms” Demo

    The code for this tutorial can be downloaded here: threadworms.py or from GitHub. This code works wi ...

  4. [转] Vmware vs Virtualbox vs KVM vs XEN: virtual machines performance comparison

    http://www.ilsistemista.net/index.php/virtualization/1-virtual-machines-performance-comparison.html? ...

  5. Introduction to Multi-Threaded, Multi-Core and Parallel Programming concepts

    https://katyscode.wordpress.com/2013/05/17/introduction-to-multi-threaded-multi-core-and-parallel-pr ...

  6. regardless of how many processors are devoted to a parallelized execution of this program

    https://en.wikipedia.org/wiki/Amdah's_law Amdahl's law is often used in parallel computing to predic ...

  7. Timer.5 - Synchronising handlers in multithreaded programs

    This tutorial demonstrates the use of the boost::asio::strand class to synchronise callback handlers ...

  8. R12: Improving Performance of General Ledger and Journal Import (Doc ID 858725.1 )

    In this Document   Purpose   Scope   Details   A) Database Init.ora Parameters   B) Concurrent Progr ...

  9. Optimizing Item Import Performance in Oracle Product Hub/Inventory

    APPLIES TO: Oracle Product Hub - Version 12.1.1 to 12.1.1 [Release 12.1] Oracle Inventory Management ...

随机推荐

  1. Architecture of Device I/O Drivers, Device Driver Design

    http://www.kalinskyassociates.com/Wpaper4.html Architecture of Device I/O Drivers Many embedded syst ...

  2. The source attachment does not contain the source for the file SignatureParser.class错误

    在myeclipse整合tomcat的完毕后,再启动tomcat的时候会出现这样的错误,呵呵,错误的大致意思是什么相关联错误,其实是myeclipse新加入的tomcat的模式出现错误了,myecli ...

  3. 读loadBalance技术的一些笔记

    以前知道loadbalance的原理,但是仅仅是浅浅的了解过,今天看了一篇 10多年前 一位大神级别人物 写的文章 顿时学习了 http://www.linuxvirtualserver.org/zh ...

  4. Android集成支付宝接口 实现在线支付

    手机的在线支付,被认为是2012年最看好的功能,我个人认为这也是移动互联网较传统互联网将会大放光彩的一个功能. 人人有手机,人人携带手机,花钱买东西,不再需要取钱付现,不再需要回家上网银,想买什么,扫 ...

  5. JS的注意点

    JS的跨域访问问题. http://www.cnblogs.com/rush/archive/2012/05/15/2502264.html JS能操作的范围:HTTP协议的内容.但是不能直接访问re ...

  6. MYSQL 5.7 主从复制 -----GTID说明与限制 原创

    http://www.cnblogs.com/cenalulu/p/4309009.html http://txcdb.org/2016/03/%E7%B3%BB%E7%BB%9F%E8%A1%A8- ...

  7. 解决faststone capture在台式机上录制屏幕视频没有声音的问题

    点击屏幕录像机: 在弹出的屏幕录像机窗口中选择录制音频,然后点击选项按钮: 在弹出的选项按钮中选择视频选项,将所有的多选框都选中,注:最后一个选项录制windows XP的工具提示最好也选上,我发现如 ...

  8. 关于js-binding中Layer触摸事件的优化

    关于js-binding中Layer触摸事件的优化 cocos2d-x 3.7 1. 目前js中监听触摸事件带来的不便(特别是cocosbuilder) 在目前的js-binding中,如果要监听la ...

  9. SOA资料

    实施: 基于J2EE体系架构搭建符合SOA架构的运营管理平台 成功经验: 携程旅行网在SOA架构方面的探索 SOA在互联网系统中的应用

  10. TCP/IP协议原理与应用笔记20:直接交付 和 间接交付

    1. 直接交付 和 间接交付 直接交付:分组的目的与分组的发送接口在同一个IP网络中 间接交付:分组的目的与分组的发送接口在不同的IP网络中 如图: 2. 交付过程: (1)交付方式判别 分组的目的I ...