tasks, processes, programs...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Fukuda

tasks, processes, programs...

Post by Fukuda »

What is the difference between
-task, thread, program, process,..(the other related words you remember)?
-multitasking, multithreading

The google search leads into confusing results. And I think, most of us dont know the nuance between them. (explanations with small examples is better..)thanks.
Tim

Re:tasks, processes, programs...

Post by Tim »

A task is something that can be multitasked :). In a system which supports native multithreading, it's a thread. In a system which doesn't, it's a process.

A thread is what gets run in a multithreaded system. Each thread has its own stack and registers, so they can run independently of one another.

A process is a container for threads, memory and other kernel resources. In a system that doesn't support multithreading, a thread and a process are the same thing, and are commonly called a task.

A program is a box you buy in a computer shop or download from the Internet. The meaning of the word program doesn't change for OS development.

Multitasking and multithreading are pretty much the same thing. You might say multithreading when you want to distinguish between a system which supports threads and one that doesn't. Multitasking/multithreading refer to the ability of an OS to run more than one task/thread at once. Of course, on a single-CPU system, there's only one thread running at a time: the OS switches between them when necessary to create the effect that they're running at the same time.
proxy

Re:tasks, processes, programs...

Post by proxy »

the way i always thought of these things is simply like this:

process = address space and all ascociated data, threads can share an address space or not. a process can have one or more threads accociated with it.

thread = independant stream of execution, usually accociated with a process

of course some models are a little different (in linux a thread is built up a process)

it is really a mental distinction, but this one works for me.

proxy
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:tasks, processes, programs...

Post by Pype.Clicker »

another often-used definition of a process is "a running program" or "the environment for running a program". It is usually combined with accounting informations and available resources (like file handles and stuff). Note that in some strange systems, many process may run in the same address space (though it's common to give each process its own address space).

As a result of this, threads do not only share the same code and data memory, but also the same set of access rights and resources.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:tasks, processes, programs...

Post by Neo »

In MINIX Tanenbaum uses both PROCS and TASKS and creates an array of processes using

Code: Select all

proc[ NR_TASKS+NR_PROCS ]

So then arent processes and tasks totally different things. I think Tanenbaum uses TASKS to represent hardware processes (if there is such a thing) and PROCS for other user processes(i.e. software tasks). Is this right?
Only Human
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:tasks, processes, programs...

Post by Pype.Clicker »

the concept of "task" is fuzzy. Every designer/author seems to use it for a different purpose ... 'process' and 'threads' are the only things that seems to be widely-accepted.

Whether PID are bound to process or threads mostly depends on the process/thread programming API (sending/receiving signals under unix, for instance is expecting a PID and will hardly work with SomethingElse ...)
nullify

Re:tasks, processes, programs...

Post by nullify »

Neo wrote:I think Tanenbaum uses TASKS to represent hardware processes (if there is such a thing) and PROCS for other user processes(i.e. software tasks). Is this right?
Yes. In MINIX, tasks are device drivers, while processes are everything else. However, you shouldn't treat this as the one true definition of a "task," as its meaning can differ depending on who you're talking to.
Post Reply