Issott_Common Design Patterns for Symbian OS-The Foundations of Smartphone Software_0470516356 (779879), страница 75
Текст из файла (страница 75)
Table A.2 summarizes the determining factors.Table A.2 Factors Affecting the Run-time Impact of Increased Code SizeDevice ConfigurationNon-XIPPotential Impactsof IncreasedXIPCode SizeMoving MemoryModelMultiple MemoryModelCode is DemandPagedDisk spaceParticularlyimpairedImpairedImpairedImpairedRAM usageNo significantimpactIncreasesIncreasesindependentlyof how manyprocesses usethe codeReducesimpact of thememorymodelTime to load the No significantcodeimpactImpairedImpairedVariable(see below)2 Characteristics, such as maintainability, testability, etc., can also be influenced byhaving more code but they’re not significantly influenced by how the device is configured.RUN-TIME IMPACT OF INCREASED CODE SIZE401As you can see the most important factor is whether the code is loadedfrom XIP or non-XIP flash. If it’s on XIP flash then the Loader has to do verylittle to enable the code to be executed.
If the code is on non-XIP flashthen, by definition, the code cannot be executed in place and the Loaderhas to allocate RAM in which to hold the code that will be executed. Inaddition, it’s not a simply case of copying the code from flash to RAM;the code may need to be decompressed in addition to having all of itsimplicit linkages resolved.
Note that because code can be compressedwhilst stored on disk this means XIP code has a relatively bigger impacton disk space than non-XIP code.For code stored on non-XIP flash, the different memory models impactthe RAM used to hold the code to be executed in different ways. Themultiple memory model copies each DLL into RAM once and then eachprocess references a single copy of the code. However, this isn’t truefor the moving memory model, in which multiple copies may be loadedalthough only if absolutely necessary.3 Hence the multiple memorymodel will always use the same or less RAM than the moving memorymodel when representing executable code at run time.Another factor affecting code stored on non-XIP flash is demandpaging4 which can make a big difference by reducing the impact ofincreased code size on RAM usage and the time to load code. Thisis because, prior to Symbian OS v9.3, entire DLLs are copied intoRAM when they are needed; when demand paging is enabled only therequired ’page’ within the DLL is loaded into RAM when a reference ismade to it (this is known as ’paging on demand’).
This can significantlyreduce the code loaded at any one time and hence the correspondingRAM usage. The effect on the time to load the code is less easy toquantify. Certainly it is common for processes to load faster becauseless code is loaded all at once. However, when demand paging isn’tenabled code is loaded once and then no further time is spent loadingcode. With demand paging enabled, code can be paged in at any pointand hence impact performance at any point. Note that on Symbian OSv9.3, only code built into the device can be demand paged but onSymbian OS v9.5 code that is installed onto the device can also beaffected.3 For example, when a DLL uses writeable static data or is loaded into multiple processesin such a way that the data cannot be at the same address in all those processes, such as fora fixed process.4 www.symbian.com/symbianos/demandpagingand www.iqmagazineonline.com/article.php?issue=23&article id=706.ReferencesAlexandrescu, A.
(2001) Modern C++ Design: Generic programmingand design patterns applied. Addison-Wesley Professional.Babin, S. (2007) Developing Software for Symbian OS: A beginner’s guideto creating Symbian OS v9 smartphone applications in C++, SecondEdition. Symbian Press. See developer.symbian.com/books for moreinformation and a sample chapter.Ball, S. and Crawford, J. (1997) ‘Monostate Classes: The power of one’.C++ Report, May 1997. Reprinted in R.
C. Martin (ed.), 2000, MoreC++ Gems, Cambridge University Press.Berger, E.D., Zorn, B.G. and McKinley, K.S. (2002) ‘Reconsidering custom memory allocation’, in Proceedings of the 17th ACM SIGPLANconference on Object-oriented Programming, Systems, Languages, andApplications, 1–12. ACM Press New York, NY, USA.Blakley, R., Heath, C. and members of The Open Group Security Forum(2004) ‘Security Design Patterns’, Technical Guide. The Open Group.Available at www.opengroup.org/pubs/catalog/g031.htm.Buschmann, F., Meunier, R., Rohnert, H., Sommerlad, P. and Stal, M.(1996) Pattern-Oriented Software Architecture Volume 1: A system ofpatterns.
John Wiley & Sons.Campbell, I., Self, D., Howell, E., Bunning, I., Rahman, I., Caffery, L.,Box, M., Elliott, M., Ho, N., Cochart, P., Howes, T. and Davies, T.(2007) Symbian OS Communications Programming, Second Edition.Symbian Press. See developer.symbian.com/books for more information and a sample chapter.Cooper, J.W. (2000) Java Design Patterns: A tutorial. Addison-Wesley.Coplien, J.O. (1991) Advanced C++ Programming Styles and Idioms.Addison-Wesley.404REFERENCESCoplien, J.O. and D.C. Schmidt (eds) (1995) Pattern Languages of ProgramDesign.
Addison-Wesley.Densmore, S. (2004) ‘Why Singletons are Evil’. Available atblogs.msdn.com/scottdensmore/archive/2004/05/25/140827.aspx.DoD (1985) ‘Trusted Computer System Evaluation Criteria’. US Department of Defense.EU (2002) ‘Universal Service and Users’ Rights Relating to Electronic Communications, Networks and Services’. (Universal Service)Directive 2002/22/EC. European Parliament. Available at www.legiinternet.ro/universalservice.htm.Fagan, M.E. (1976) ‘Design and Code Inspections to Reduce Errors in Program Development’. IBM Systems Journal, 15(3):182–211. Availableat www.research.ibm.com/journal/sj/153/ibmsj1503C.pdf.FCC (2001) ‘Enhanced 911: Wireless Services’. Federal Communications Commission.
Available at www.fcc.gov/pshs/services/911services/enhanced911/Welcome.html.Gamma, E., Helm, R., Johnson, R. and Vlissides, J.M. (1994) Design Patterns: Elements of reusable object-oriented software. Addison-WesleyProfessional Computing Series.Harrison, N.B., Foote, B. and Rohnert, H. (eds) (2000) Pattern Languagesof Program Design 4. Addison-Wesley.Harrison, R. and Shackman, M. (2007) Symbian OS C++ for MobilePhones, Volume 3. Symbian Press.
See developer.symbian.com/booksfor more information and a sample chapter.Heath, C. (2006) Symbian OS Platform Security: Software developmentusing the Symbian OS Security Architecture. Symbian Press. Seedeveloper.symbian.com/books for more information and a samplechapter.ISO 9126 ‘Software engineering: Product quality’.
Available atwww.issco.unige.ch/projects/ewg96/node13.html.Kienzle, D., Elder, M., Tyree, D. and Edwards-Hewitt, J. (2002)Security Patterns Repository. Available at www.scrypt.net/∼celer/securitypatterns/repository.pdf.Kircher, M. and Jain, P. (2004) Pattern-Oriented Software Architecture,Volume 3: Patterns for resource management.Knuth, D. (1974) ‘Structured Programming with go to Statements’.ACMJournal Computing Surveys, 6(4):268.
Available at pplab.snu.ac.kr/courses/adv pl05/papers/p261-knuth.pdf.Lavender, R.G. and Schmidt, D.C. (1996) ‘Active Object: An objectbehavioral pattern for concurrent programming’, in Pattern Languagesof Program Design, J. O. Coplien, J. Vlissides, and N. Kerth (eds).Addison-Wesley.Longshaw, A. and Woods, E. (2004) ‘Patterns for Generation, Handlingand Management of Errors’.
Available at www.eoinwoods.info/doc/europlop 2004 errorhandling.pdf.REFERENCES405Martin, R.C., Riehle, D. Buschmann, F. (eds) (1998) Pattern Languages ofProgram Design 3. Addison-Wesley.Meyer, B. (1992) ‘Applying ‘‘Design By Contract’’’. Computer,25(10):40–51. IEEE. Available at se.ethz.ch/∼meyer/publications/computer/contract.pdf.Morris, B. (2007) The Symbian OS Architecture Sourcebook: Designand evolution of a mobile phone OS.
Symbian Press. Seedeveloper.symbian.com/books for more information and a samplechapter.Morris, B. (ed.) (2008) ‘A Guide to Symbian Signed’. Available at developer.symbian.com/main/support/signed.Myers, S. and Alexandrescu, A. (2004) ‘C++ and the Perilsof Double-Checked Locking’. Dr Dobbs Journal. Available atwww.aristeia.com/Papers/DDJ Jul Aug 2004 revised.pdf.OMA (2002) ‘SyncML Data Synchronization Specifications’ Version 1.1.Available at www.openmobilealliance.org/tech/affiliates/syncml/syncmlindex.html.Rainsberger, J.B. (2001) ‘Use your singletons wisely’. Available atwww.128.ibm.com/developerworks/webservices/library/cosingle.html.Rosenberg, R.
and Arshad, J. (2007) ‘Symbian OS System Model’.Available at developer.symbian.com/main/oslibrary/sys models/downloads.jsp.Sales, J. (2005) Symbian OS Internals: Real-time Kernel Programming.Symbian Press. See developer.symbian.com/books for more information and a sample chapter.Saltzer, J. and Schroeder, M. (1975) ‘The Protection of Information inComputer Systems’. IEEE.Saumont, P-Y. (2007) ‘Do we really need singletons?’. Available atwww.javalobby.org/java/forums/t91076.html.Schmidt, D.C. (1999) ‘Asynchronous Completion Token: An objectbehavioral pattern for efficient asynchronous event handling’.
Available at www.cs.wustl.edu/∼schmidt/PDF/ACT.pdf.Schmidt, D. and Harrison, T. (1996) ‘Reality Check’. C++ Report, March1996. Available at www.cs.wustl.edu/∼schmidt/editorial-3.html.Shackman, M. (2006) ‘Platform Security: A Technical Overview’. Available at developer.symbian.com/main/downloads/papers/plat sectech overview/platform security a technical overview.pdf.Silvennoinen, J. (2007) ‘Y-Browser’. Available at www.drjukka.com/YBrowser.html.Stichbury, J. (2004) Symbian OS Explained: Effective C++ Programmingfor Smartphones. Symbian Press. See developer.symbian.com/booksfor more information and a sample chapter.406REFERENCESStichbury, J.