Re: Thread and process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 14, 2002 at 10:00:10PM -0500, Michael Zhu wrote:
> Hi, does Linux have the concept of thread? How can I
> create a thread in my application? I can use the
> fork() to create a process. Is there any API to create
> a thread? I know in kernel mode kernel_thread() can be
> used to create a thread in kernel mode. What is that
> in user mode?

There is no difference between threads and processes in Linux. The
basic scheduling item is a task, and a task is an execution entity.
Execution entities run within a protection domain. When you have a
single execution entity within a single protection domain, we
traditionally call it a process; when there are multiple execution
entities in a protection domain, we call it multi-threading. The
clone() system call allows you to create new tasks.

POSIX threads are implemented on top of the clone system call, just
link with the pthread library to use them.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty
of Information Technology and Systems, Delft University of Technology,
PO BOX 5031, 2600 GA Delft, The Netherlands  Phone: +31-15-2783635
Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux