作业系统跨多个核心管理一组工作线程。此系统通常每个逻辑 CPU 核心对应一个工作线程,这样可以避免上下文切换(但可能会为操作系统或其他专用应用程序保留一些核心)。
作业系统将作业放入作业队列中以待执行。作业系统中的工作线程从作业队列中获取并执行所需项。作业系统会管理依赖关系并确保作业以适当的顺序执行。
一个作业是完成一项特定任务的一个小工作单位。作业会接收参数并对数据进行操作,其行为方式类似于方法调用。作业可以是独立的,也可依赖其他作业完成之后才能运行。
在复杂的系统中,如游戏开发所需的系统中,不太可能每个作业都是独立的。一个作业通常会为下一个作业准备数据。作业知道并支持使系统顺利运转的依赖关系。
如果 jobA
依赖于 jobB
,作业系统将确保 jobA
不会在 jobB
完成之前开始执行。
2018–06–15 页面已发布
在 2018.1 版中公开了 C# 作业系统 NewIn20181
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.