如何使用async和await概念在C#中创建调度程序? [英] how to create scheduler in C# using async and await concept?

查看:98
本文介绍了如何使用async和await概念在C#中创建调度程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有3种机器(A,B,C),A的数量是4,B的数量是2,C的数量是1.方案是

1.需要启动所有机器。

2.为每台机器安排工作。

3.需要关闭机器。



这里机器A可以处理1台机器中的1个作业,机器B可以处理1台机器中的4个作业,机器C可以处理1台机器中的16个作业。



这里一旦A完成它将分配给B的工作,B完成它将分配给C的工作。



我需要在调度程序中处理100个作业,如何在C#中使用async实现这一点并等待?



提前感谢。



问候,

Amalraj。

Hi,
I have 3 kind of machine (A,B,C), number of A is 4, number of B is 2 and number of C is 1. The scenario is
1. Need to start all machines.
2. Schedule an job to each machine.
3. Need to shutdown the machine.

Here machine A can handle 1 job in 1 machine, machine B can handle 4 jobs in 1 machine and machine C can handle 16 jobs in 1 machine.

Here once A done the job it will assign to B, and B done its job it will assign to C.

I need to handle 100 jobs in scheduler, how to achieve this in C# using async and await?

Thanks in advance.

Regards,
Amalraj.

推荐答案

阅读以下链接,了解有关C#中异步编程的更多信息。



https://richnewman.wordpress.com/2012/12/03/tutorial-asynchronous-programming-async-and-await-for-beginners/



如果你不熟悉编程,你应该在实现之前列出你将要使用的内容并阅读它。
Read the below link for more information on Asynchronous programming in C#.

https://richnewman.wordpress.com/2012/12/03/tutorial-asynchronous-programming-async-and-await-for-beginners/

If you are new to programming, you should always list out what all you are going to use and read about it before implementing.


..... 。
......


这篇关于如何使用async和await概念在C#中创建调度程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆