Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
In Linux, there is no such thing as a task, at least by any formal definition that I know of.
A process is the basic model used to separate running programs and their resources from all other such programs and the kernel. A process has memory resources allocated by the kernel, and these are private to the process, and protected from all other processes. A process is given time for execution of code in it's code memory space by the kernel.
Within a process, there is at least one thread of execution. Using threads, there can be multiple threads of execution that all share the same code memory space that is private to the process. The threads execute independently, but execute a common code segment. Also shared between threads within a process is the data memory, meaning that process variables are common to all threads within the process.
A process and a thread are treated in the same fashion in linux, except for some small variations. Hence some times the generic term task is used to refer to process as well as thread.
You can read chapter on process management in http://www.amazon.com/Linux-Kernel-D.../dp/0672329468 for more information.
A process and a thread are treated in the same fashion in linux, except for some small variations.
Respectfully disagree. What are those 'small variations'? The OP asked for the 'exact difference'. I'd say there are far more differences than there are similarities. If they are substantially the same, why would we have both, and not simply one or the other?
@rod What I meant was they are treated in a similar fashion in linux . To Linux, a thread is just a special kind of process.
As far as I have read the data structures that handle a process as well as thread are the same in linux.
In linux the same system call clone() creates a thread as well as a process, but the difference lies the flags passed to this system call.
So the term task is some times used in place of the term process.
The previous answer that says there is no such thing as a TASK in GNU/Linux is FACTUALLY wrong.
Actually, EVERYTHING in GNU/Linux is a task. Everything swapped to a CPU is an task_entity. A task is scheduled onto the scheduler through the kernel command schedule() and pick_up_next_task()
Threads are tasks
Processes are tasks with a single thread... more or less.
A more detailed answer requires a lot more study then this little box can provide.
I also recommend the Book anotated earlier by Robert Love.