micke wrote:
> Hi, is this possible in Solaris?
> 
> in user-space:
> 
> process A is running, its job is to schedule threads.

In Solaris the kernel does thread scheduling.  Why are you trying to do
thread scheduling in a userland process do you really believe a userland 
program knows better about how to schedule than the kernel does (do you 
cover HT, CMT, multicore, cc-NUMA)?

What is the real problem you are trying to solve here ?

> process B is also running, making a new thread t1, process B wants A to 
> schedule this thread t1.

pthread_self(3C) does NOT return an int and you can't just cast a 
pthread_t into an int and have it mean anything.

> is this possible? that is, I need to get the thread id from thread t1, in 
> process B this will just be an int when I use pthread_self(), I get lets say 
> 1. That make no sense for process A, since 1 is just the "local" thread id in 
> process B.

This reminds me a little of a door server and client.

Consider this:

Process A is a door server.  The door server is doing its own thread 
pool management.  See door_create(3C) and door_server_create(3C).

Process B calls on the door to do some job.

The way the scheduling happens for this is that the timeslice that B is 
running in is "passed over" to Process A while it runs - this is a 
special feature of the doors IPC mechanism.

The door Server (A) can use door_ucred(3C) and ucred_get(3C) to get 
information about the caller (B) but note that the threadid in the 
client (B) is not one of the things because it is a meaningless 
identifier outside of the process (and the kernel structs that represent 
that process).

So what is it you are really trying to do here at a high level, not the 
low level functions you think you need to create/call.





-- 
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to