Re: Thread and process

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

 



On Tuesday 15 January 2002 3:00 am, Michael Zhu wrote:
> Hi, does Linux have the concept of thread?

Yes; that's how it does scheduling.

> 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?

There's a syscall, clone(), which creates a new thread. The argument 
determines what (if anything) is shared with the parent thread - file 
descriptors, memory map, etc. Share nothing, and you have fork(); share 
everything, you have a thread. Somewhere in between could be useful for some 
things, too.

> I know in kernel mode kernel_thread() can be
> used to create a thread in kernel mode. What is that
> in user mode?

clone(). Or the relevant pthread library calls, if that's the API you want.


James.
--
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