Главная » Просмотр файлов » Issott_Common Design Patterns for Symbian OS-The Foundations of Smartphone Software_0470516356

Issott_Common Design Patterns for Symbian OS-The Foundations of Smartphone Software_0470516356 (779879), страница 40

Файл №779879 Issott_Common Design Patterns for Symbian OS-The Foundations of Smartphone Software_0470516356 (Symbian Books) 40 страницаIssott_Common Design Patterns for Symbian OS-The Foundations of Smartphone Software_0470516356 (779879) страница 402018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 40)

The client session replaces the cacheif the client requests a different time zone. It also observes the serverfor changes other clients make to the selected zone and flushes thecache when that happens.CLIENT–SERVER209• Co-location of Related ServicesContext switching between threads is expensive; context switchingbetween threads in different processes is even more expensive becauseof MMU21 changes and the various caches to be flushed.

There is alsoan extra cost to data transfer between threads in different processesbecause of the mapping that needs to be done. Where it is appropriatethat servers should be co-located in the same process to minimizethis cost, it should be done. A group of servers that depend heavilyon each other’s resources and that can be trusted to collaborate in thesame process space is one example. The Communications frameworkin Symbian OS is modeled after this strategy.

Another example is aserver that only serves one specific application. The latter server isbest located inside its application’s process.• Deferred Server TerminationIn situations where clients of a transient server come and go frequently,it is important, for performance reasons, that the server deferred itstermination until some definite time after the last session closes. Thisis especially desirable where the cost of creating and initializing theserver’s resources are very high.

Lazy De-allocation (see page 73) canbe used to address this by using a timer running alongside the serverthat destroys the server, and itself, after a set timeout following theclosure of the last session.• Delegate Child Active ObjectsTo provide performance guarantees to all its clients, it is necessaryfor a server to delegate long-running requested activities to childactive objects so it is free to handle the next request. Often thesechildren are Asynchronous Controllers (see page 148) running in theserver’s thread.

Sometimes it is best that they have their own threadof execution.References• Some related, but contrasting, architectural patterns are Peer-toPeer [Buschmann et al., 1996] and Master–Slave [Buschmann et al.,1996].• An implementation of the client–server architecture may use standardindustry patterns such as:• Proxy [Gamma et al., 1994] as an object adaptor of the server• Memento [Gamma et al., 1994] to persist calls on the server• Pipes [Buschmann et al., 1996] for communication.21 en.wikipedia.org/wiki/Memorymanagement unit .210PROVIDING SERVICES• A number of Symbian OS patterns are also used:• Active Objects (see page 133) is used to efficiently handle servicerequests from multiple clients.• Request Completion (see page 104) is used by the server to informclients of when their requests have been completed.• Escalate Errors (see page 32) is extended so that errors which occurin the server when handling a client’s request are passed back tothe client.• The client–server framework chapter in [Harrison and Shackman,2007] gives comprehensive coverage of how the pattern is codified inSymbian OS.• [Stichbury, 2004] also covers the client–server framework.• [Heath, 2006] contains a chapter describing how to design a secureserver.• Template code for a transient server is available fromdeveloper.symbian.com/main/oslibrary/cpp papers/advanced.jsp.• The Symbian Developer Library contains an overview of the SymbianOS client–server architecture as well as example code:• Symbian Developer Library Symbian OS guide Base UsingUser Library (E32) Inter Process Communication Client/ServerOverview• Symbian Developer Library Examplescode Client/Server example code.User library exampleCOORDINATOR211CoordinatorIntentCo-ordinate state changes across multiple interdependent components byusing a staged notification procedure that maximizes flexibility.AKAState-Aware Components, Staged System TransitionProblemContextYou need to synchronize a collective change across many related components in different processes whilst respecting their layering.22Summary• You need to ensure that the dependencies between components arerespected by having a structured system of notifications.• You’d like the state change to be completed as quickly as possible.• To make the testing and maintenance of your software easier youwant the components being notified of the state changes to be looselycoupled both with respect to each other and to the service informingthem of the change.

In particular, it should be easy to change whichcomponents are taking part in the notifications.• A transparent means of inter-process communication (IPC) is needed.DescriptionWhen synchronizing a collective change across multiple components,you’re going to need to perform a series of operations. They might be aswide-ranging as needing to notify components in the system that the freesystem memory is low or relatively focused, such as informing a collectionof UI components in an application that a list has been updated.

The morecomponents that need to react to such a change increases the likelihoodthat there are pre-existing dependencies between some of them.Some dependencies between components can be straightforward, suchas starting a new process with no further interactions between the creatorand the created processes. More often, you will find that they require moredirect cooperation between them. For components in different processes,they will need to use one of the many IPC mechanisms available inSymbian OS. Examples of commonly used mechanisms are Client–Server22 Asin the Layers pattern [Buschmann et al., 1996].212PROVIDING SERVICES(see page 182) and Publish and Subscribe (see page 114).

However,regardless of the method used, each sets up a dependency between thetwo components as a result of the communication. Sometimes thesedependencies might be obvious, such as with RASCliSession where itis clear that it represents a client session with a server, in this case, thealarm server.

In other cases, the dependency on an external componentmight be less obvious, such as with CMsvEntry, a message server entity,where the internal use of a client–server session by the class is hiddenfrom the client.The chain of dependencies between the components can quicklycomplicate how your collective change can be performed. Imaginea situation where a client and a service both de-allocate memory inresponse to a low memory notification. If the client needs to get theservice to perform some actions, such as saving data on its behalf, thenthere is little point in getting the service to de-allocate memory first.When the client uses the service to save data, the service could well endup re-allocating the memory.

In the UI layer, for example, there is littlepoint in notifying a list to redraw itself if a different and overlapping UIcomponent, responding to the same change, forces the list to be redrawnagain.If handled incorrectly, these dependencies can at best reduce performance and, at worst, lead to deadlock, where each component is stuckwaiting for other components, or live-lock, where a series of componentscontinuously trigger changes in other components.One way we could handle these dependencies could be to introduceexplicit dependencies between the components. In this situation, youwould need to maintain a list of root nodes such that when a changewere needed each of these root nodes would be notified.

Each root nodewould then be responsible for notifying its dependent children followedby the children in turn notifying the change to all of their dependents andso on.Putting such a scheme into place is straightforward to start withand does makes it easy to understand the relationships between allthe components involved in the change. However this approach has asignificant disadvantage of causing the components to be tightly coupledsuch that it would be very difficult to move or remove a root node fromthe notifications without adversely affecting its children. On an openoperating system such as Symbian OS, with components on a devicecoming from a wide range of companies and individuals ranging fromSymbian and the device manufacturers to network operators and thirdparty application developers, such a tightly coupled scheme would notbe acceptable.Another alternative would be to have each component regularly pollthe value of the state they’re interested in.

Характеристики

Тип файла
PDF-файл
Размер
2,96 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6295
Авторов
на СтудИзбе
313
Средний доход
с одного платного файла
Обучение Подробнее