[RC5] Thread Priority in OS/2 client

Roman Trunov proxyma at tula.net
Thu Mar 27 03:56:52 EDT 2014

Christer Jacobsson wrote:

> In the Config->Performance related options->3 Priority level one can 
> select the priority level dnetc should run with. If priority 0 is 
> selected, dnetc will run at Class=idle, delta=0 but if priority 1 is 
> chosen it will run at Class=Idle, delta=9. 

Delta=9 look strange, because code for setting the priority is:

DosSetPriority( PRTYS_THREAD, PRTYC_IDLETIME, ((32 * prio)/10), 0);

This it not exactly correct mapping (it maps to 0..28 range instead of 
0..31 supported in OS/2), but priority 1 should give Delta=3, priority 2 
- Delta=6, and so on. This is confirmed on my old Warp 3 test box:

Client Priority=1:

     Owner      T-ID  TSID  Prio   State
  ------------  ----  ----  ----  -------
  DNETC.EXE        1   199  0200  Blocked
                   2   183  0103  Ready

Client Priority=2:

     Owner      T-ID  TSID  Prio   State
  ------------  ----  ----  ----  -------
  DNETC.EXE        1   183  0200  Blocked
                   2   199  0106  Ready

Regarding more accurate priority tweaking, there are some compatibility 
issues. Client supports only 10 priority levels (0..9), this range is 
hard-coded in many places of client code. OS/2 have 4 priority classes 
(we could skip this part because only Idle class is used) with 32 
priority deltas (0..31) so we have to do rough mapping of client level 
to OS/2 delta with step of 3. Simply allowing to enter range of 0..31 
could break a lot, including existing setup.

I think a command-line option "-sysprio N" could be implemented. It will 
allow to set cruncher priority in some OS-specific way (for OS/2, "N" 
could be at least in 0..31 range). It will NOT be saved to .ini file or 
configured via menus to avoid problems if .ini file is shared by 
different clients. If you want to use such fine tweaking, you should be 
fine with command line.

But don't expect that it'll happens very fast :) OS/2 client had no 
major changes since last released version, so expect an update only when 
something really important happens, like new core added.


More information about the rc5 mailing list