discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread load balancing


From: Stefan Böhringer
Subject: Re: NSThread load balancing
Date: 18 Dec 2002 08:06:34 +0100

On Tue, 2002-12-17 at 20:03, Philippe C.D.Robert wrote:
> On Monday, December 16, 2002, at 03:46  Uhr, Stefan Böhringer wrote:
> > Hello,
> >
> > in a DO application I detach many threads for which I need to measure
> > resource consumption to balance system load.
> > NSThread unfortunately doesn't supply any information about cpu/mem
> > usage nor seems there be a possibility to exit a NSThread by force.
> 
> Use DO to tell a thread to exit...
As it appears to me that only way to exit a thread is from inside the
thread via class method NSThread+exit. In my case the thread code is
(potentially) unknown and most likely without any NSRunLoop (or
equivalent) being active since those are number crunching threads.
Therefore, ideally, I would like to exit the tread from the outside.

> 
> > I would propose to add a GNUstep specific function that leaks internal
> > data structures about the thread on which system calls could be
> > performed to get the required information.
> >
> > Any suggestions/corrections welcome.
> 
> Why not use the worker thread to collect problem specific information 
> (stats, timers, ...) and let the controller thread (app) decide upon 
> the optimal number of threads and so on?
This is probably the way to go. The work in the thread is done by
(unknown) code loaded from a bundle. But before I detach a method in the
controlling Task which then calls the bundle code. Therefore the bundle
code can be bracketed by stat collecting (and OS dependend) function
calls.
The NSThread API really seems to be a least common denominator of all
OSs of the last decade. However, extending the NSThread capabilities
would probably hamper portability given the heterogeneity of target
platforms of GNUstep/Cocoa.

Thanks,
        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]