ENع
الدرس 18 · Advanced .NET

Tasks and threads

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

A thread is a path through your code that the operating system runs on a CPU core. Threads are costly, so .NET keeps a thread pool: a few worker threads that take jobs from a queue. Follow a program that splits 1 to 100 into two halves: Task.Run queues each half and returns a Task<int> at once, two workers add them up in parallel on two cores, and await Task.WhenAll collects 1275 and 3775 so the program prints 5050.

14 دقيقة10 خطوات5 أسئلةBeginner
شكل 18 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.