Click here to Skip to main content
15,563,248 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Questioncsv file sort and create a new and store the data Pin
Member 1577533021-Sep-22 21:52
Member 1577533021-Sep-22 21:52 
AnswerRe: csv file sort and create a new and store the data Pin
Richard Deeming21-Sep-22 22:31
mveRichard Deeming21-Sep-22 22:31 
QuestionPLINQ - WithDegreeOfParallelism Pin
dataminers9-Sep-22 6:27
dataminers9-Sep-22 6:27 
AnswerRe: PLINQ - WithDegreeOfParallelism Pin
Richard MacCutchan9-Sep-22 6:50
mveRichard MacCutchan9-Sep-22 6:50 
GeneralRe: PLINQ - WithDegreeOfParallelism Pin
dataminers9-Sep-22 11:18
dataminers9-Sep-22 11:18 
GeneralRe: PLINQ - WithDegreeOfParallelism Pin
Richard MacCutchan9-Sep-22 22:53
mveRichard MacCutchan9-Sep-22 22:53 
GeneralRe: PLINQ - WithDegreeOfParallelism Pin
dataminers11-Sep-22 3:01
dataminers11-Sep-22 3:01 
GeneralRe: PLINQ - WithDegreeOfParallelism Pin
Dave Kreskowiak11-Sep-22 5:36
mveDave Kreskowiak11-Sep-22 5:36 
Your definitions are not correct. You can also have multiple physical CPUs with multiple cores each.

Threads refers to "threads of execution". You can have multiple threads running on a single core, though the core will only execute code on one thread at a time, for a limited amount of time before switching to the next thread in the scheduler. You can have multiple cores running multiple threads at the same time. You can have more threads "running" than there are cores in the CPUs to run them. For example, open Task Manager and go to the Performance tab. See the "Threads" number? There's thousands of threads running in hundreds of processes, but you only have, say, 8 cores to run them all. Most threads are sitting idle, waiting for a core to execute them, or waiting for I/O to complete, or whatever else.

Windows gives the illusion of running thousands of threads using "pre-emptive multitasking". This allows a thread to execute on a core for a small amount of time before being stopped and the core switches to the next thread in the scheduler.

A Task is NOT a thread. In some respects, it looks like a thread of execution, but it's really an abstraction, or wrapper around a block of work to do. Tasks are scheduled to run on a pool of threads (a ThreadPool). You can have more tasks running than there are threads in the pool. Tasks can sit idle waiting for an available thread to a task, or part of a task.

A single task can be executed by multiple threads. Thread0 can execute a task for a limited time, then the task is idled, waiting for execution to be resumed by either another thread, or the same thread that was executing it before. Thread1 can pick up where Thread0 left off, or Thread0 can come back around and pick up where it left off.

Think of it as layers, with CPUs at the bottom of the stack, cores on top of that, then threads on top of cores, and Tasks on top of threads. Each layer you go higher in the stack can have more items in it than the layer below.
|+++++++ Tasks +++++++|
  |++++ Threads ++++|
    |+++ Cores +++|
      |+ CPUs + |


Parallel programming is a technique, or library, that makes it easier to write code to execute on multiple threads, or cores, to accomplish work. The Task Parallel Library is an IMPLEMENTATION of parallel programming. The TPL makes it easier to write code that uses multiple threads to accomplish work.

GeneralRe: PLINQ - WithDegreeOfParallelism Pin
Richard Deeming11-Sep-22 22:39
mveRichard Deeming11-Sep-22 22:39 
QuestionMultiThread on Single Core Processor (CPU) Pin
dataminers6-Sep-22 4:24
dataminers6-Sep-22 4:24 
AnswerRe: MultiThread on Single Core Processor (CPU) Pin
dan!sh 6-Sep-22 4:46
professional dan!sh 6-Sep-22 4:46 
GeneralRe: MultiThread on Single Core Processor (CPU) Pin
dataminers6-Sep-22 23:28
dataminers6-Sep-22 23:28 
AnswerRe: MultiThread on Single Core Processor (CPU) Pin
Eddy Vluggen6-Sep-22 5:20
professionalEddy Vluggen6-Sep-22 5:20 
AnswerRe: MultiThread on Single Core Processor (CPU) Pin
Dave Kreskowiak6-Sep-22 5:38
mveDave Kreskowiak6-Sep-22 5:38 
GeneralRe: MultiThread on Single Core Processor (CPU) Pin
Eddy Vluggen6-Sep-22 6:14
professionalEddy Vluggen6-Sep-22 6:14 
GeneralRe: MultiThread on Single Core Processor (CPU) Pin
Dave Kreskowiak6-Sep-22 6:18
mveDave Kreskowiak6-Sep-22 6:18 
GeneralRe: MultiThread on Single Core Processor (CPU) Pin
Eddy Vluggen6-Sep-22 6:19
professionalEddy Vluggen6-Sep-22 6:19 
AnswerRe: MultiThread on Single Core Processor (CPU) Pin
Sam Hobbs5-Oct-22 21:19
Sam Hobbs5-Oct-22 21:19 
Question_ViewImports.cshtml question Pin
pkfox23-Aug-22 23:15
professionalpkfox23-Aug-22 23:15 
AnswerRe: _ViewImports.cshtml question Pin
Richard Deeming23-Aug-22 23:47
mveRichard Deeming23-Aug-22 23:47 
GeneralRe: _ViewImports.cshtml question Pin
pkfox24-Aug-22 0:13
professionalpkfox24-Aug-22 0:13 
GeneralRe: _ViewImports.cshtml question Pin
Richard Deeming24-Aug-22 0:29
mveRichard Deeming24-Aug-22 0:29 
GeneralRe: _ViewImports.cshtml question Pin
pkfox24-Aug-22 0:44
professionalpkfox24-Aug-22 0:44 
QuestionProblem with Azure AD JWT - solved Pin
pkfox18-Aug-22 6:56
professionalpkfox18-Aug-22 6:56 
QuestionRest API always return 401 status code Pin
Mou_kol10-Aug-22 1:59
Mou_kol10-Aug-22 1:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.