All of lore.kernel.org
 help / color / mirror / Atom feed
* suspend a thread with an another thread
@ 2009-09-18  6:53 maxime louvel
  2009-09-18  7:29 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: maxime louvel @ 2009-09-18  6:53 UTC (permalink / raw)
  To: linux-kernel

HI all,

I'm doing a phd related to QoS and resources management within
distributed systems.
I would like to affect a CPU budget to my applications, one
application being a thread.

As I would like to experiment quickly my ideas in order to test them,
I wanted to use a little trick :
instead of modifying the linux scheduler (which I guess will take me a
lot of time because I'm not familiar with it) I tried to use a "super
thread".

My try was that this "super thread" with higher priority is suspending
the other threads if they overcome their cpu budget.
I thought of something like activate an application thread, make the
super thread sleep for X time (cpu budget) and then wake up and
suspend the application thread until next time.

However I haven't been able to do that because I've read (and test
myself :) ) that :
- it is not possible to suspend a thread by an another thread (I don't
think I can use the pthread_cond facilities)
- as threads within a process share the signals and signal handlers I
can't send a signal (like SIGUSR1 or SIGSTOP) to a specific thread.
Correct me if I'm wrong

Is there a way I can do what I want ?

Or should I start by looking at how to modify the linux scheduler ?

thanks a lot,

Maxim

--
Maxime Louvel
+33 6 85 91 05 30
3 rue charreton
38000 Grenoble
France

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: suspend a thread with an another thread
  2009-09-18  6:53 suspend a thread with an another thread maxime louvel
@ 2009-09-18  7:29 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2009-09-18  7:29 UTC (permalink / raw)
  To: maxime louvel; +Cc: linux-kernel

On Fri, 2009-09-18 at 08:53 +0200, maxime louvel wrote:
> HI all,
> 
> I'm doing a phd related to QoS and resources management within
> distributed systems.
> I would like to affect a CPU budget to my applications, one
> application being a thread.
> 
> As I would like to experiment quickly my ideas in order to test them,
> I wanted to use a little trick :
> instead of modifying the linux scheduler (which I guess will take me a
> lot of time because I'm not familiar with it) I tried to use a "super
> thread".

Kernel thread or userspace? I read the below as if you're meaning
user-space, since you talk about pthread stuff (at which point this
mailing list is off-topic).

> My try was that this "super thread" with higher priority is suspending
> the other threads if they overcome their cpu budget.
> I thought of something like activate an application thread, make the
> super thread sleep for X time (cpu budget) and then wake up and
> suspend the application thread until next time.
> 
> However I haven't been able to do that because I've read (and test
> myself :) ) that :
> - it is not possible to suspend a thread by an another thread (I don't
> think I can use the pthread_cond facilities)

No, pthread_cond() is for waiting for an event to occur.

> - as threads within a process share the signals and signal handlers I
> can't send a signal (like SIGUSR1 or SIGSTOP) to a specific thread.
> Correct me if I'm wrong

try: man pthread_kill

> Or should I start by looking at how to modify the linux scheduler ?

Depends on what you want to do... how hard can it be right ;-)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-18  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-18  6:53 suspend a thread with an another thread maxime louvel
2009-09-18  7:29 ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.