Re: Self-scheduling threading
Re: Self-scheduling threading
- Subject: Re: Self-scheduling threading
- From: Michael Koehmstedt <email@hidden>
- Date: Thu, 17 Mar 2005 02:06:11 -0800
Dustin,
I think I have been misphrasing what I need.
I need to be able to break up each thread's timeslice into explicitly
schedule mini-threads. Basically exactly like fibers on a win32
system.
My framework will run the optimal (in my opinion, at least) number of
threads: # of processors. Why? No context switching. As long as an
application is event driven, which the objective-C messaging mechanism
provides in plenty, it's not necessary to multithread the application
on a single processor system. In fact, as a result of context
switching, it would actually be less efficient. The only real need of
multithreading is for multiprocessor systems. It's up to the developer
to design the application with the event-driven mindset in order to
take advantage of this threading model though.
Therefore, I need to be able to break up the thread's execution into
user-scheduleable mini-threads, or co-routines, or fibers, or whatever
you want to call it. For IPCs/RPCs, the currently executing fiber will
block while it waits for the return value. When it blocks, a
previously blocked, but now prepared fiber will resume until it too
reaches another blocking IPC/RPC call. I only need the lightest-weight
threading system for this capability. So that rules out any method
with expensive context switching or memcpys.
If there is sufficient interest by other community members, I'd like
to create an open-source Objective-C framework for this kind of
threading model. Whether it means porting an existing C/C++
implementation or a new one, I'm up for whatever. I just want a
solution that's efficient and features an extremely simple
explicitly-scheduled threading model.
Michael Koehmstedt
On Wed, 16 Mar 2005 20:32:32 -0800, Dustin Voss <email@hidden> wrote:
> On 16 Mar, 2005, at 4:04 PM, Michael Koehmstedt wrote:
>
> > I'm writing a IPC/RPC framework. So while a thread is waiting for the
> > return value of a RPC/IPC call, I need to pause its execution and
> > schedule another thread that is ready to go.
>
> If your IPC thread blocks on a semaphore or something, the OS scheduler
> will automatically run other threads, of both your app and other apps,
> while your IPC thread is waiting. Right?
>
> If your IPC thread doesn't block, you can still have it give up the
> processor by calling NSThread's sleepUntilDate: method.
>
> But it seems to me that you would know this stuff already, so I am not
> seeing the problem.
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden