03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

� Request the window server to draw the bitmap<br />

� Delete the bitmap.<br />

By the time the client's buffer is flushed and executed by the window server (the third step<br />

above), the bitmap could have been deleted. To avoid this, the FBS client-side<br />

implementation calls the window server client's Flush() function (through an interface<br />

function) before sending the FBS message to delete the bitmap.<br />

Note<br />

As well as handling ROM- and RAM-resident bitmaps, the FBS also handles<br />

ROM- and RAM-resident fonts. The precise details are different from those<br />

for bitmaps, but the motivations for using a server to share font data are<br />

essentially the same.<br />

The shared memory technique is not without cost:<br />

� The shared heap is mapped to different addresses in different processes. This means<br />

that conventional pointers cannot be used within the heap: a handle system has to be<br />

used instead.<br />

� The shared heap is not the default heap for either client or server process. This means<br />

that the default operator new() and operator delete() don't work.<br />

� For both the above reasons, objects designed for use in the default user heap cannot<br />

be placed onto a shared heap. New classes must be written specially for this purpose.<br />

� You have to use mutex synchronization to control access to objects on the shared<br />

heap.<br />

� You have to make sure that things stay in sync when you delete objects that are<br />

shared with other servers.<br />

For the font and bitmap server, these costs are low because the shared heap contains largescale<br />

objects (fonts and bitmaps) and because the usage patterns of these objects minimize<br />

the difficulties of mutex-based sharing. In addition, the benefits of sharing are very high<br />

because of:<br />

� the intensity of operations involving bit-blitting,<br />

� the enormous difference the efficient implementation makes to users' perceptions of<br />

system efficiency<br />

� the size of the objects that would have to be exchanged using client-server<br />

transactions if the shared heap was not available.<br />

Other shared-heap server designs have been implemented on Symbian OS, but in each<br />

case the design issues and the cost/benefit analysis have had to be thought through very<br />

carefully.<br />

18.3 Servers and Threads<br />

The session between a client and a server is owned by the kernel. The kernel specifies that<br />

the session is between the client thread or process and the server thread. This has simple,<br />

but profound implications for any program that uses servers:<br />

� Unless sharable sessions are used, client-side resources representing server-side<br />

objects may only be used and destroyed by the client thread that created them.<br />

� Server responsiveness to clients is governed by the duration of the longest possible<br />

RunL() of any active object running on the server thread.<br />

Most of the time, these implications are not onerous. Most Symbian OS clients and servers<br />

are single-threaded, and the active object paradigm for event-handling threads is perfectly<br />

adequate. In a few cases, though, these implications raise issues for Symbian OS<br />

programmers and, as usual, some techniques have been developed to tackle them.

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

Saved successfully!

Ooh no, something went wrong!