* How to create kernel-level threads in Tru64 5.1?
@ 2003-02-07 18:57 Ioannis E. Venetis
2003-02-07 22:32 ` Joe Chung
2003-02-10 14:17 ` Andrew Duane USG
0 siblings, 2 replies; 6+ messages in thread
From: Ioannis E. Venetis @ 2003-02-07 18:57 UTC (permalink / raw)
Hello,
I am a relative new user of an Alpha machine with Tru64 Unix 5.1. I am
developing
a user-level thread library and I need to create kernel-level threads that
will be used
as execution vehicles for the user-level threads. Under Linux I am using the
clone()
system call to do that. I would like to ask if there is a similar interface
in Tru64 Unix.
I have seen a piece of software that uses the thread_create(),
thread_set_state() etc.
interface from the libmach.a library and I also found the prorotypes of
kernel_thread(),
kernel_thread_w_arg() etc. in /usr/sys/include/kern/threads.h. My problem is
that I
cannot find any documentation about these functions, I don't know if they
are actually
supported or if they are just low-level hacks that might work or not in
future releases.
Apart from that I have found only the POSIX threads interface, but from what
I have
understood these are already user-level threads that run on top of kernel
threads. Is
this correct? If yes, how are these kernel threads created?
Any pointer or help that will clarify things about threads under Tru64 Unix
is greatly appreciated.
Thank you in advance,
Ioannis E. Venetis
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create kernel-level threads in Tru64 5.1?
2003-02-07 18:57 How to create kernel-level threads in Tru64 5.1? Ioannis E. Venetis
@ 2003-02-07 22:32 ` Joe Chung
2003-02-08 13:40 ` Ioannis E. Venetis
2003-02-10 14:17 ` Andrew Duane USG
1 sibling, 1 reply; 6+ messages in thread
From: Joe Chung @ 2003-02-07 22:32 UTC (permalink / raw)
"Ioannis E. Venetis" <iev@hpclab.ceid.upatras.gr> writes:
> Hello,
>
> I am a relative new user of an Alpha machine with Tru64 Unix
> 5.1. I am developing a user-level thread library and I need to
> create kernel-level threads that will be used as execution
> vehicles for the user-level threads. Under Linux I am using the
> clone() system call to do that. I would like to ask if there is
> a similar interface in Tru64 Unix.
[SNIP]
Call me curious, but why do you want to do this?
For Tru64, Posix threads are selectively "bound" to kernel
threads, in a two-level scheduling scheme.
See
http://www.tru64unix.compaq.com/docs/base_doc/DOCUMENTATION/V51A_HTML/ARH9RBTE/DOCU0030.HTM#two_level_scheduling_unix
-jc
--
(apply 'concat (reverse (list "com"
(char-to-string 46) "yahoo"
(char-to-string 64) "joechung")))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create kernel-level threads in Tru64 5.1?
2003-02-07 22:32 ` Joe Chung
@ 2003-02-08 13:40 ` Ioannis E. Venetis
2003-02-11 15:09 ` David Butenhof
0 siblings, 1 reply; 6+ messages in thread
From: Ioannis E. Venetis @ 2003-02-08 13:40 UTC (permalink / raw)
Hello Joe,
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!
Ioannis E. Venetis
----- Original Message -----
From: "Joe Chung" <joe_chung@hotmail.com>
Newsgroups: comp.unix.tru64
Sent: Saturday, February 08, 2003 12:32 AM
Subject: Re: How to create kernel-level threads in Tru64 5.1?
>
> Call me curious, but why do you want to do this?
>
> For Tru64, Posix threads are selectively "bound" to kernel
> threads, in a two-level scheduling scheme.
>
> See
>
http://www.tru64unix.compaq.com/docs/base_doc/DOCUMENTATION/V51A_HTML/ARH9RB
TE/DOCU0030.HTM#two_level_scheduling_unix
>
> -jc
> --
> (apply 'concat (reverse (list "com"
> (char-to-string 46) "yahoo"
> (char-to-string 64) "joechung")))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create kernel-level threads in Tru64 5.1?
2003-02-07 18:57 How to create kernel-level threads in Tru64 5.1? Ioannis E. Venetis
2003-02-07 22:32 ` Joe Chung
@ 2003-02-10 14:17 ` Andrew Duane USG
1 sibling, 0 replies; 6+ messages in thread
From: Andrew Duane USG @ 2003-02-10 14:17 UTC (permalink / raw)
In article <b20vpt$19u0$1@ulysses.noc.ntua.gr> "Ioannis E. Venetis" <iev@hpclab.ceid.upatras.gr> writes:
> I am a relative new user of an Alpha machine with Tru64 Unix 5.1. I am
> developing a user-level thread library and I need to create
> kernel-level threads that will be used as execution vehicles for the
> user-level threads. Under Linux I am using the clone() system call to
> do that. I would like to ask if there is a similar interface in Tru64
> Unix. I have seen a piece of software that uses the thread_create(),
> thread_set_state() etc. interface from the libmach.a library and I
> also found the prorotypes of kernel_thread(), kernel_thread_w_arg()
> etc. in /usr/sys/include/kern/threads.h. My problem is that I cannot
> find any documentation about these functions, I don't know if they are
> actually supported or if they are just low-level hacks that might work
> or not in future releases.
These prototypes are in fact kernel routines, and have no bearing on any
user level code you might be writing.
Others have already spoken to POSIX threads and different flavors.
The kernel threads are created for you automatically as needed, there
is no need for you to do anything about them.
At a "high" level, there are two kinds of threads: one-on-one, where
each user thread has a kernel thread and scheduling is done by the kernel,
and NXM (n-by-m), where several user threads share a kernel thread, and
scheduling is done by the user at user level.
--
Andrew L. Duane (JOT-7) duane@zk3.dec.com
HP/Compaq Corporation Andrew.Duane@compaq.com
110 Spit Brook Road Andrew.Duane@hp.com
M/S ZKO3-3/U14
Nashua, NH 03062-2698 (603)-884-1294
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create kernel-level threads in Tru64 5.1?
2003-02-08 13:40 ` Ioannis E. Venetis
@ 2003-02-11 15:09 ` David Butenhof
2003-02-14 15:55 ` Ioannis E. Venetis
0 siblings, 1 reply; 6+ messages in thread
From: David Butenhof @ 2003-02-11 15:09 UTC (permalink / raw)
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 ]---/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to create kernel-level threads in Tru64 5.1?
2003-02-11 15:09 ` David Butenhof
@ 2003-02-14 15:55 ` Ioannis E. Venetis
0 siblings, 0 replies; 6+ messages in thread
From: Ioannis E. Venetis @ 2003-02-14 15:55 UTC (permalink / raw)
Hello,
> 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. ;-)
Well, I managed to create some kernel-threads using the Mach interface :-)
The code I mentioned in my original post and some digging in the system
include files helped very much.
> 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.
At least some applications from the OpenMP NAS benchmark suite are running
correctly. We have a compiler that creates code that uses our thread library
and
the CG and MG applications are terminating successfully and also get
speed-up.
I haven't tried other applications yet. The ps command (using the -m switch)
also
confirms that there are more than one threads running. Our library uses
several
functions from libc (printf, malloc, mmap, open, close, ...) and there seems
to be
no problem. Or do you mean that there might be a problem if we try to create
an
environment that supports both POSIX and our threads package? Anyway, this
is not something that we are trying to do.
> 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.
According to the model that our thread library implements, it is necessary
to schedule
the user-level threads in an explicit way on the kernel-threads.
Specifically, user-level
threads do not start executing as soon as they are created, they are
scheduled to run
when they dependancies from other threads have been satisfied. This is
totally different
from POSIX threads. Moreover, this library supports multi-level parallelism
and
several policies of scheduling different levels can be implemented, for
example execute
first all inner-level threads and then all outer-level threads. So, using
POSIX
threads as execution vehicles would require a 3-level scheduling scheme.
Thank you for your comments,
Ioannis E. Venetis
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-02-14 15:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-07 18:57 How to create kernel-level threads in Tru64 5.1? Ioannis E. Venetis
2003-02-07 22:32 ` Joe Chung
2003-02-08 13:40 ` Ioannis E. Venetis
2003-02-11 15:09 ` David Butenhof
2003-02-14 15:55 ` Ioannis E. Venetis
2003-02-10 14:17 ` Andrew Duane USG
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox