03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In active objects, higher priority means simply that you get handled sooner than others, if<br />

your event completes along with several others during the handling of the previous RunL().<br />

But active object priority does not cause preemption: if the previous RunL() takes a long<br />

time, nothing you can do with active object priority will get you scheduled sooner.<br />

Important<br />

Make sure that you understand what active object priority means and<br />

be sensible in allocating active object priorities.<br />

So, if you try to use an ultra-high-priority event to do something that requires a certain<br />

response time, it won't always work. An active object used to keep a sound channel going,<br />

say, could get held up behind a step in a long-running task doing printing or database<br />

compaction. In other words, you can't use high-priority active objects to achieve responses<br />

that must occur within a certain time of an event. For that, you need to use the Symbian OS<br />

preemptive thread system, appropriate buffering, and appropriate thread priorities.<br />

17.4 Summary<br />

Symbian OS has a highly responsive preemptive multithreaded architecture. However, most<br />

application and server tasks are by nature event handlers and active objects are a very<br />

suitable paradigm with which to handle events.<br />

Because they are non-preemptive, it's very easy to program with active objects, because<br />

you don't need to code mutual exclusion with other threads trying to access the same<br />

resources.<br />

Active objects also use fewer system resources than full-blown threads: thread overheads<br />

start around 4 k kernel-side and 12 k for the user- side stack, whereas active objects need<br />

be only a few bytes in size. Additionally, switching between active objects is much cheaper<br />

than switching between threads, even in the same process. The time difference can be up to<br />

a factor 10.<br />

This combination of ease of use and low resource requirement is a major factor in the overall<br />

efficiency of Symbian OS. However, performance can be impaired if there are many active<br />

objects since the active scheduler needs to iterate through the list of active objects to find<br />

which object's RunL() to call.<br />

For some purposes, threads are necessary. In the next chapter, we'll include them as we<br />

discuss the Symbian OS client-server architecture.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!