# scheD - a schedtool daemon (I ask for comments.)

## ravageNG

Hello Gentoo-Users,

I hope to get some comments on scheD from you  :Smile: 

------------------------------------------------------------------------------------

What's scheD?

It's a very simple daemon to renice/nice and change priorities of processes while

running them. It's done via schedtool.

My intention writting scheD was to get audio played propably (via xmms, rhymthbox 

or realplayer) on my iBook. The problem was audio stutters when I started MOL 

(Mac-On-Linux), because of MOL takes the highest priority on my system. Setting 

xmms and others to SCHED_ISO works very well. scheD does it for you, always when

starting these programms. No interaction required.

Another example is, to let emerge/qpkg/apt-get/... to be batched (SCHED_BATCH) - so

your "normal" work isn't disturbed.

Also it seems usefull to batch kio-slaves (for instance mp3 conversation) to get a

more responsible KDE (was reported by Jos).

------------------------------------------------------------------------------------

How it works?

It scans /proc for new PIDs, after looking into /proc/pid/status and getting the

process' name it looks into config (loaded into RAM) and runs schedtool if neccassary.

Currently it looks into /proc every 2 seconds. Is there a better way to get notified

when a process is started?? Let me know!

------------------------------------------------------------------------------------

How to configure and use scheD?

Place an sched.cfg in /etc with following format:

  #(name)   (schedtools parameter)

  xmms   -I

  dpkg   -B

  #wildcard (the '*' is only valid at the end of programm name!)

  kio_*  -B

Note: The first match from top to bottom is relevant for scheD.

So with

  a* -B

  a2 -I

in your sched.cfg a2 will also be "batched" (-B is used).

That's the whole configuration.

Run "scheD -h" to get a quick overview about command line options.

It requires schedtool (emerge schedtool). Also with -ck kernels you get SCHED_ISO and SCHED_BATCH beside SCHED_RR and SCHED_OTHER.

 :Question:   Again the question for our kernel gurus:

Is there a better way to get notified when a process is started then periodically scanning /proc for changes

 :Arrow:  scheD can be found here: http://www.darav.de/sched.html

Thanks in advance

Rav

----------

## gimpel

ok, first had to create little patchset with sched_iso stuff, ck is not very usable for reiser4 users...

seems to be a very usefull tool, i defined beep-media-player and jackd for ISO mode, and scheD seems to work very well so far. no latencies copying two kernel trees from a to b, emerging kde-base, listening to music and all that while playing s.o.f. ..nice! very usefull for lazy people like i am that like using ISO class..thx!

but as i'm no coder i have no idea on getting info on new processes other than scanning /proc...

----------

## fallow

RaveNG : thnx  :Smile:  sound very nice for me , must test it  :Smile:  It can be helpfull also of course with for ex. O(1) and ISO policy implementation.

Gimpel : your list looks nice again  :Razz:   maybe You will do something for vivid for ex.  :Razz:   :Smile: 

cheers.

----------

## gimpel

 *fallow wrote:*   

> RaveNG : thnx  sound very nice for me , must test it  It can be helpfull also of course with for ex. O(1) and ISO policy implementation.
> 
> Gimpel : your list looks nice again   maybe You will do something for vivid for ex.  
> 
> cheers.

 

hehe, if you want to have that one for testing or vivid base something, i can of course upload it or something  :Razz:   i could also try to add some other stuff too, but as soon as fixing the rejects _really_ needs understanding the code, i'll fail, horribly! hehe... here: http://free.pages.at/gimpel/sets/2611rc4sirius1.bz2  --> sirius0 without randomisation, sirius1 with it enabled by default...

must admit that it runs very smooth here... scheD running all the time  :Smile:  i think i like that very much...

 14:39:38 up 1 day,  1:49,  4 users etc..

----------

## ravageNG

Thanks for your comments!  :Very Happy: 

 :Question:  One question still remains. Doesn't anybody know?

Is there a better way to get notified when a process is started then periodically scanning /proc for changes

----------

## mrfree

I'm trying it but...

```
schedtoold: Error! Running "schedtool -I " on rhythmbox (pid: 28162) failed.

schedtoold: Error! Running "schedtool  -B" on emerge (pid: 28232) failed.
```

I'm using morph-sources-2.6.11-r9

Manually...

```
# schedtool -I 11626

ERROR: could not set PID 11626 to I: SCHED_ISO - value out of range / policy not implemented
```

----------

## ravageNG

AFAIK you need to emerge morph-sources with USE=staircase 

and apply additional patches -> SCHED_BATCH, SCHED_ISO from -ck-tree.

Hope it helps.

----------

## mrfree

 *ravageNG wrote:*   

> AFAIK you need to emerge morph-sources with USE=staircase 
> 
> and apply additional patches -> SCHED_BATCH, SCHED_ISO from -ck-tree.
> 
> Hope it helps.

 

I've already use staircase useflag, I've supposed that imply the other ck useful/related patch  :Wink: 

Ok, I'll try it thz

----------

## mrfree

Now I'm using ck-sources-2.6.11_p8-r1 with latest fbsplash and acpi patches... schedtoold doesn't report any error  :Smile: 

How can I view if I really use staircase scheduler?

```
# dmesg | grep sched
```

 doesn't report anything

----------

## brazzmonkey

i just thought i'd give this thread a bump, because this tool seems promising and probably deserves more attention (i haven't tried it yet, but definitel will tonight...)

and i suppose if this is used in combination with verynice, it can be a good start to mess everything up with priorities ! or is it ??

----------

## bollucks

Following you around brazzmonkey...

There are tools made by the -ck patch creator designed to transparently use schedtool without any overhead unlike scheD

http://www.kernel.org/pub/linux/kernel/people/ck/apps/toolsched/

----------

## brazzmonkey

hey bollucks, nice to read you again !

so scheD (now renamed schedtoold) generates overhead ? i'll try it anyhow.

have you tried it yourself ? what about toolsched ?

this scheduler stuff and tools are not very discussed here in the forums... maybe it's because they're not worth...

i'll try them and make my own opinion...

*edit*

funny, toolsched happened to be in portage last year... it's not anymore - there may be a good reason for that...

----------

## bollucks

 *brazzmonkey wrote:*   

> hey bollucks, nice to read you again !
> 
> so scheD (now renamed schedtoold) generates overhead ? i'll try it anyhow.
> 
> have you tried it yourself ? what about toolsched ?
> ...

 

 :Smile: 

Yes and yes

The overhead is just the presence of yet another daemon, but it continually polls looking to see what's running which seems a little unnecessary since you start the app only once. toolsched is something you set up once and forget about but enjoy it doing its task and I rely on it all day.

----------

## brazzmonkey

great great great !

once again thanks for this info ! i guess i owe you one, because you spend quite some time to answer my noob questions today...

----------

## brazzmonkey

not sure i understand how to install toolsched.

i need to copy the files in /usr/bin and create a symlink to the script i want to use... am i right ??

----------

## bollucks

 *brazzmonkey wrote:*   

> not sure i understand how to install toolsched.
> 
> i need to copy the files in /usr/bin and create a symlink to the script i want to use... am i right ??

 

yes, but the tricky part is finding an earlier place in your path to make the symlink. Check the output of 

echo $PATH

and find something earlier in that list than /usr/bin

in my case I have ~/bin in my path earlier as in the toolsched docs

cp toolsched.* /usr/bin

then for example to use make as sched idle and mplayer and sched iso:

ln -s /usr/bin/toolsched.d ~/bin/make

ln -s /usr/bin/toolsched.i ~/bin/mplayer

from then on every time I use 'make' it starts at idle prio and every time I use mplayer it starts at iso prio

----------

