parallel programming. this causual litery nots represents my recent progress in parallel programming in c#.It`s interesting.
not to say extra words,let`s start the code.
pasted below:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks; namespace paraldemo
{
class Program
{
static void Main(string[] args)
{
var watch = Stopwatch.StartNew();
watch.Start();
var a = ;
var c = ;
String[] names = new string[] { "a", "b" };
Parallel.ForEach(names, d => { Console.Write("paraeel:" + d); });
Parallel.For(, , b => { c += b; });
Parallel.Invoke(() => { Console.WriteLine(); }, () => Console.WriteLine());
Console.WriteLine(c);
watch.Stop();
Console.WriteLine(watch.ElapsedMilliseconds);
var task1 = Task.Factory.StartNew(() => { Console.WriteLine("test task factory"); });
task1.Wait();
var task2 = Task.Factory.StartNew(e => Console.WriteLine("" + e), c);
Task.WaitAll(task1, task2);
Parallel.Invoke(() => Console.WriteLine());
Task.Factory.StartNew(() => Console.WriteLine(), new CancellationTokenSource().Token);
Console.ReadKey();
}
}
}
PLinq
from a in list.AsParallel
parallel programming. this causual litery nots represents my recent progress in parallel programming in c#.It`s interesting.的更多相关文章
- PatentTips - Heterogeneous Parallel Primitives Programming Model
BACKGROUND 1. Field of the Invention The present invention relates generally to a programming model ...
- A Pattern Language for Parallel Application Programming
A Pattern Language for Parallel Application Programming Berna L. Massingill, Timothy G. Mattson, Bev ...
- Task Cancellation: Parallel Programming
http://beyondrelational.com/modules/2/blogs/79/posts/11524/task-cancellation-parallel-programming-ii ...
- Fork and Join: Java Can Excel at Painless Parallel Programming Too!---转
原文地址:http://www.oracle.com/technetwork/articles/java/fork-join-422606.html Multicore processors are ...
- Structured Streaming编程 Programming Guide
Structured Streaming编程 Programming Guide Overview Quick Example Programming Model Basic Concepts Han ...
- Questions that are independent of programming language. These questions are typically more abstract than other categories.
Questions that are independent of programming language. These questions are typically more abstract ...
- Introduction to Parallel Computing
Copied From:https://computing.llnl.gov/tutorials/parallel_comp/ Author: Blaise Barney, Lawrence Live ...
- Python socket – network programming tutorial
原文:https://www.binarytides.com/python-socket-programming-tutorial/ --------------------------------- ...
- An Introduction to Lock-Free Programming
Lock-free programming is a challenge, not just because of the complexity of the task itself, but bec ...
随机推荐
- 解决scp命令pemission denied,please try again的问题
问题描述:输入命令scp a.txt root@192.168.0.105:/tmp(将当前目录下的文件a.txt复制到服务器IP为192.168.0.105的root用户的/tmp/目录下),结果会 ...
- 数据结构学习-BST二叉查找树 : 插入、删除、中序遍历、前序遍历、后序遍历、广度遍历、绘图
二叉查找树(Binary Search Tree) 是一种树形的存储数据的结构 如图所示,它具有的特点是: 1.具有一个根节点 2.每个节点可能有0.1.2个分支 3.对于某个节点,他的左分支小于自身 ...
- BFS例题:A计划
ContribContrib/a11y/accessibility-menu.js 关于 BFS要点: 1.若为可化为的坐标系图形,可用结构体存储其x值,y值和步数.(一般开now 和 next ,n ...
- 第一章:Hello, World!
感谢作者 –> 原文链接 本文翻译自The Flask Mega-Tutorial Part I: Hello, World! 一趟愉快的学习之旅即将开始,跟随它你将学会用Python和Flas ...
- Android 内嵌 HTML5 并进行交互
Android与HTML5的交互主要是两个部分, 与HTML5的交互以及与JavaScript的交互, 与HTML5的交互可以通过注册onclick事件转化为与JavaScript的交互 Androi ...
- spark提交运算原理
前面几天元旦过high了,博客也停了一两天,哈哈,今天我们重新开始,今天我们介绍的是spark的原理 首先先说一个小贴士: spark中,对于var count = 0,如果想使count自增,我们不 ...
- toolbar menu 字体颜色和大小
Toolbar菜单中menu当中我们大多数都使用图片来按钮,可是有些时候我们也会直接使用文字,文字的颜色如何修改呢. 其实很简单,我们只要修改styles.xml文件中,添加一句 <item n ...
- USACO Section1.2 Milking Cows 解题报告
milk2解题报告 —— icedream61 博客园(转载请注明出处)---------------------------------------------------------------- ...
- 《数据结构》C++代码 散列表
散列表,又名哈希表.Hash表.这是一个神奇的数据结构,它的复杂度是常数级别,由于我非常喜欢这个数据结构,在此简单介绍一下. (没有学过Hash表的同学,我推荐一个教程:http://www.cnbl ...
- selenium启动IE浏览器报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode mu
意思是浏览器的保护模式设置不一致所导致 解决方案-->修改IE设置 将所有区域的保护模式勾选去掉即可