Messages in this thread | | | Date | Mon, 19 Jul 1999 00:19:13 +0300 (IDT) | From | Alon Ziv <> | Subject | Re: kernel thread support - LWP's |
| |
On Sun, 18 Jul 1999, Andi Kleen wrote:
[...] > > With sigqueueinfo: > > new_tid = clone(...) > sigwaitinfo( ..., &info ) > if (info.si_errno) { > ... > } > return; > > thread: > info.si_errno = sched_setscheduler(getpid(), ...) > sigqueueinfo(parent, &info); > > Which is two context switches, where one is "hidden" (the thread has not to > wait for the parent to run, so it can happily complete its time share). With > CLONE_SUSPEND the same hidden context switch is there too (you have to > switch back to the parent sooner or later to process the return of pthread_create) > OK, I'm convinced--- for this case. (BTW, we'll probably have to have the child unlock any data structures locked by the parent, and the parent shouldn't touch them anymore after the clone() _unless_ there was an error in the child... Tricky.)
There are still other valid uses for CLONE_SUSPEND, though. For example, I may want to create myself a pool of tasks to be used for future AIOs (or even for future threads, if I know I'm gonna have some and want to save the cloning time).
And it's cheap.
> Also with the lazy tlb flushing 2.3 has now a context switch between > threads that share VM is not much more than a function call now. And > system calls itself are rather cheap in Linux, forget the old Solaris > think where they are very expensive :) >
I never claimed they're `very' expensive, but they're not free...
-az
------------------------+---------------------------------------------------- . __ | Phone: +972 3 5340753 (home), +972 3 9685882 (work) _| / | email: alonz@usa.net / | /_ Alon Ziv | smail: 33 Ha-Rama St., Ganey Tiqwah 55900, Israel ------------------------+---------------------------------------------------- <<<(((this place reserved for that ultra-wise oneliner I haven't found.)))>>>
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |