views:

375

answers:

4

Hi there,

I'm studying for my final exams in my CS major on the subject distributed systems and operating systems.

I'm in the need for a good definition for the terms task, process and threads. So far I'm confident that a process is the representation of running (or suspended, but initiated) program with its own memory, program counter, registers, stack, etc (process control block). Processes can run threads which share memory, so that communication via shared memory is possible in contrast to processes which have to communicate via IPC.

But what's the difference between tasks and process. I often read that they're interchangable and that the term task isn't used anymore. Is that really true?

A: 

It depends on your context.

In Ada, a task is a construct in the programming language to enable concurrency.

It isn't specified what operating system construct should be used to implement it, but it allows shared-memory between tasks, so a thread would be a more natural implementation.

Oddthinking
A: 

I think it's dependant of the underlying operating system which term is used.

You could also think of task as a running piece of code. Then a part of a thread or a part of a process could be a task.

schaechtele
+2  A: 

Processes and threads are the mechanics, task is more conceptual. You can queue a chuck of work to run asynchronously, on windows with .NET for example, this gets run on a thread from the thread pool. With OpenMP, a task would be part of your for loop running on one core.

Minor related notes: on windows, there are also jobs, thread pools, and fibers for mechanics. Also, a process is nothing without at least one thread running.

Chris O
+1  A: 
andras