From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,63e84d65d4999f24 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-02-11 07:09:57 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!news.compaq.com!news.cpqcorp.net!53ab2750!not-for-mail From: David Butenhof Subject: Re: How to create kernel-level threads in Tru64 5.1? Newsgroups: comp.unix.tru64 Reply-To: David.Butenhof@hp.com References: User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: Date: Tue, 11 Feb 2003 10:09:56 -0500 NNTP-Posting-Host: 16.31.48.112 X-Complaints-To: abuse@Compaq.com X-Trace: news.cpqcorp.net 1044976356 16.31.48.112 (Tue, 11 Feb 2003 07:12:36 PST) NNTP-Posting-Date: Tue, 11 Feb 2003 07:12:36 PST Organization: Hewlett-Packard Company Xref: archiver1.google.com comp.unix.tru64:9524 Ioannis E. Venetis wrote: > Thank you for the pointer, but I had already seen this document. > I made the comment about the two levels of threads in the > POSIX library based on it. > > My goal is to keep the kernel-level threads (or kernel execution > contexts, as mentioned in the document) and implement a > different user-level threads library. This is, because this library > will implement a very different programming model than the one > of POSIX threads. It is a dependant driven model, where each > thread gets ready to run when its dependencies from other > threads have been satisfied. > > But this difference will be visible only with the user-level threads. > The underlying kernel-level threads are still needed, to schedule > the user-level threads on them. The problem is that I can't find > out how to create them. How does the POSIX threads library > that is provided with Tru64 Unix create these kernel execution > contexts? This is the question. > > To make things even more complicated, I could use POSIX > threads as my execution vehicles for the user-level threads of > my library, but this would create a three-level implementation! > Kernel-threads, POSIX (user-level) threads and finally my user- > level threads! I doubt that this would be efficient and therefore > I try to avoid it. > > I hope that this made things a little bit more clear and not > more complicated! Tru64 UNIX is, at heart, a Mach 2.5 based kernel. Essentially, (and I use that term loosely), POSIX threads are based on Mach kernel threads. However, we use a number of Tru64 enhancements and additions, and in fact no longer directly use any of the Mach interfaces. The Mach interfaces have all, officially, always been completely unsupported on Tru64 UNIX, (in user mode), and are undocumented. You can find books on Mach, and many papers on the web, and you CAN figure out how to use and manipulate Mach threads. Much of which you might discover will actually work on Tru64 UNIX... but don't bother asking anyone for help or trying to report any problems. ;-) Furthermore, if you're planning to use (or to support applications that use) libc, librt, or other libraries (bundled or otherwise) that support threads, beware that these are all based on carefully designed integration between libc and libpthread, and it won't work with any other thread library unless you can figure out (entirely on your own) how to duplicate that support. Even if you do manage, you'll have a much harder time trying to build an environment that could support both POSIX threads and your package within the same process, which means you're excluding most existing threaded code. This all was of course also a problem faced by other groups that have done "non-POSIX" thread support -- including Ada, Java, Perl, etc. Generally, the solution has been to build their thread support on top of POSIX threads. (This was really the original inspiration of POSIX threads, which is based directly on Digital's "CMA" package, which began as a generalization of the task and synchronization part of the VAX Ada runtime library intended primarily to allow various threaded runtime libraries to coexist within a process.) Like Ada and Java, you should be doing your "layer" in terms of standard and supported POSIX synchronization. That's not really "3-level scheduling"; there ought to be no need for you to try to do your own "scheduling" at all. -- /--------------------[ David.Butenhof@hp.com ]--------------------\ | Hewlett-Packard Company Tru64 UNIX & VMS Thread Architect | | My book: http://www.awl.com/cseng/titles/0-201-63392-2/ | \----[ http://homepage.mac.com/dbutenhof/Threads/Threads.html ]---/