This page was last modified 21:32, 13 December 2007.
Thread Priorities
From Forum Nokia Wiki
On Symbian OS, threads are pre-emptively scheduled and the currently
running thread is the highest priority thread ready to run. If there are two or more threads with equal priority, they are time-sliced on a round-robin
basis. The priority of a thread is a number: the higher the value, the higher
the priority.
When writing multithreaded code, you should consider the relative priorities of your threads carefully. You should not arbitrarily assign a thread a high priority, otherwise it may pre-empt other threads in the system and affect their response times. Even those threads which may legitimately be assigned high priorities must endeavor to make their event-handling service complete rapidly, so they can yield the system and allow other threads to execute.
A thread has an absolute priority which is calculated from the priority assigned to the thread by a call to RThread::SetPriority() and optionally combined with the priority assigned to the process in which it runs. The TThreadPriority and TProcessPriority enumerations, taken from e32std.h, are shown below.
enum TThreadPriority { EPriorityNull=(-30), EPriorityMuchLess=(-20), EPriorityLess=(-10), EPriorityNormal=0, EPriorityMore=10, EPriorityMuchMore=20, EPriorityRealTime=30, EPriorityAbsoluteVeryLow=100, EPriorityAbsoluteLow=200, EPriorityAbsoluteBackground=300, EPriorityAbsoluteForeground=400, EPriorityAbsoluteHigh=500 }; enum TProcessPriority { EPriorityLow=150, EPriorityBackground=250, EPriorityForeground=350, EPriorityHigh=450, EPriorityWindowServer=650, EPriorityFileServer=750, EPriorityRealTimeServer=850, EPrioritySupervisor=950 };
All threads are created with priority EPriorityNormal by default.
When a thread is created it is initially put into a suspended state and does
not begin to run until Resume() is called on its handle. This allows the
priority of the thread to be changed by a call to SetPriority() before
it starts to run, although the priority of a thread can also be changed at
any time.
Links
Process and threads, how to find them
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Thread will not start | donalRok | Mobile Java General | 0 | 2004-08-19 16:29 |
| RProcess creation | erneykm | General Symbian C++ | 7 | 2005-08-21 18:38 |
| Trick to prevent Python from closing on red key press. | y.a.k | Python | 14 | 2008-06-29 12:00 |
| having direct screen acess in a different thread | massaranduba | General Symbian C++ | 3 | 2005-01-29 09:43 |
| Keeping a Program running at all times | -chris- | General Symbian C++ | 2 | 2008-04-07 03:45 |
