<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2733668522121607461</id><updated>2012-02-16T03:09:59.960-08:00</updated><category term='&quot;In Service Software Upgrade&quot;'/><category term='Architecture'/><category term='SW Architecture'/><category term='ISSU'/><title type='text'>My SW Architecture Blog</title><subtitle type='html'>This BLOG discusses challenging SW Architecture issue from my experience. Add yourself as a follower to keep posted.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ranlevy-swarchitecture.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ran</name><uri>http://www.blogger.com/profile/06130807149433593735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_TcEHg1jQRfk/SusA2tr2HqI/AAAAAAAAAAo/CGq2HUr9YZw/S220/Copy+of+big7039475.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2733668522121607461.post-7649909484455502151</id><published>2009-11-15T10:27:00.000-08:00</published><updated>2009-11-15T11:21:50.519-08:00</updated><title type='text'>Simulator Usage in Embedded Environments</title><content type='html'>&lt;strong&gt;Context:&lt;/strong&gt;&lt;br /&gt;Embedded system where the HW is not always available, difficult to debug and to test.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;br /&gt;Imagine that you develop in a complex embedded environment when the SW development is done in parallel to the HW development. Basically there is no option for you to test the SW till the HW is ready. Even when the HW is ready it is usually very slow to debug on the actual HW and in some cases only few HW devices are available for testing.&lt;br /&gt;To make things even more problematic imagine that the code you develop requires several devices to perform a test, for instance in case you develop some network protocol that needs to interface with one or more devices to perform its operation.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br /&gt;The proposed solution is based on development of HW simulator that can run on PC environment. Compilers of embedded OS (e.g. VxWorks) has an option to compile the code for X86 processors and have a version of the code running on PC environment.&lt;br /&gt;&lt;br /&gt;Ha ha ha, well you think it's that easy? Imagine that part of your code (as often occurs in embedded systems) is writing data to FPGA, ASIC or other HW devices. Of course such code will fail on the PC environment since the actual HW does not exist.&lt;br /&gt;&lt;br /&gt;So what can you do in order to test your code on PC environment? The answer resides in my 1st post: &lt;a href="http://ranlevy-swarchitecture.blogspot.com/2009/10/decoupling-sw-from-platform.html"&gt;http://ranlevy-swarchitecture.blogspot.com/2009/10/decoupling-sw-from-platform.html&lt;/a&gt;. All you need to is to code plugins for PC environment that can simulate for you access for the HW and can simulate for you various events that are generated by the HW. A major issue to notice is that basically the application code remains unchanged.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implications:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;u&gt;Development Efforts:&lt;/u&gt; well indeed there is some development overhead in creating a project for PC environment, writing plugins for PC env. and so forth. However, the efforts really worth the extra development since the total development cost is dramatically reduced since debugging and testing are becoming much easier.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Testing:&lt;/u&gt; SW that works well on the simulator environment will be easier to work well on the target, but of course it MUST be tested on the actual system. A common mistake in implementing "dummy" PC plugins that always return success. Such behavior might mislead application to developer from coding and testing the "bad" path of each flow. &lt;strong&gt;Beware!!!&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;u&gt;Debugging&lt;/u&gt;: debugging in simulator mode is much easier than the actual embedded system which is usually much more complex. &lt;/li&gt;&lt;li&gt;&lt;u&gt;Performance:&lt;/u&gt; the relatively good performance that might be achieved in PC environment are usually much slower in the actual embedded system since it uses slower CPU, memory, disk, etc. Therefore performance must be tested as soon as the HW is available and an extrapolation of the performance from the PC env. to the HW environment must be available for early performance prediction.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Compilation:&lt;/u&gt; compilation of the code for several architectures usually improves the code stability since sometimes the compiler detects potential errors that are not detected for other architecture.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2733668522121607461-7649909484455502151?l=ranlevy-swarchitecture.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ranlevy-swarchitecture.blogspot.com/feeds/7649909484455502151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/2009/11/simulator-usage-in-embedded.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default/7649909484455502151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default/7649909484455502151'/><link rel='alternate' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/2009/11/simulator-usage-in-embedded.html' title='Simulator Usage in Embedded Environments'/><author><name>Ran</name><uri>http://www.blogger.com/profile/06130807149433593735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_TcEHg1jQRfk/SusA2tr2HqI/AAAAAAAAAAo/CGq2HUr9YZw/S220/Copy+of+big7039475.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2733668522121607461.post-4340029682801610502</id><published>2009-10-31T05:21:00.000-07:00</published><updated>2009-10-31T13:29:51.358-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SW Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;In Service Software Upgrade&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='ISSU'/><title type='text'>In Service SW Upgrade (ISSU)</title><content type='html'>&lt;strong&gt;Context:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SW that should support high availabity (up time including planned maintenance 99.999% or better).&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Imagine that you write SW that must not be down for more than few minutes per year, where this time includes the time of SW upgrades that might occur from time to time. Imagine also that any down time period causes "a headache" for the user of the SW and such scenario should really be avoided. An example for such system can be a network switch that in case the switch is down (let's say over 50 milliseconds) it could lead to network topolgy changes and preventing user from getting the service the operator is committed to. While usually in such switches firmware upgrade (FPGA, network processer, ...) is relatively fast (up to few hundreds milliseconds and sometimes even less than 50 milliseconds) this is far from being the case about SW upgrade, that can take up to several minutes in some cases.&lt;/p&gt;&lt;p&gt;As always, let's try to make things complicated and I will limit the discussion to a system without a redundant CPU or another machine that can "take over" in case our system is down during the upgrade. In addition let's assume that new SW has a very different data scheme. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The proposed solution is based on the ability of the OS to run several processes at the same time (for most of view this sounds obvious but for instance VxWorks 5.X and below are not capable to do so). The solution is composed of the following steps:&lt;/p&gt;&lt;p&gt;1. Running SW downloads the new SW and launches it (upon download completion or at some time later on).&lt;/p&gt;&lt;p&gt;2. New SW has a protocol to communicate with the old SW and to recieve its persistent and transient data. &lt;strong&gt;Note:&lt;/strong&gt; the new SW should be aware of the data scheme of the current scheme in order to convert is to the new scheme.&lt;/p&gt;&lt;p&gt;3. New SW performs a data conversion from the old and new data schemes. Relatively simple conversions (such as adding a new column in a table or types expansions (e.g. int to long)) can usually be done "automatically" or by centralized mechanism. However, when a change is complex (e.g. split of a single table to several tables) then a custom upgrade code should be written. &lt;/p&gt;&lt;p&gt;4. When the new SW completes this stage, it signals the old SW that it is ready to "take over", the old is terminated (gracefully) and the new SW is becoming active and takes control. This step can be performed very fast (usually few tens milliseconds) which satisfies even systems with demanding requirements for high availability.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Implications:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;u&gt;Performance:&lt;/u&gt; during the entire procedure the "old" SW is still processing data and modifies its persistent and transient data. It should be assumed that during the upgrade procedure, the old SW is not fully busy and allows enough available CPU to synchronize the new SW and enough CPU to allow the new SW performing its data convertion procedure. In addition we need to assume that the rate of data sychronization and conversion is faster than data modifications in the "old" SW so the new SW can "catch up" with the data of the old SW.&lt;/p&gt;&lt;p&gt;&lt;u&gt;Resources Usgae:&lt;/u&gt; in order to perform the proposed scheme the new SW should have enough available memory, persistent storage (flash), OS resources (such as file descriptors and more),... In cases there is not enough memory to allocate the needed memory for both old and new SW, the procedure described below is becoming much more complex and requires simulatanous synchronization to the new SW and deletion from the old SW (assuming at least some of the data is rarely changed and is not needed at least for the time of the upgrade procedure). Another option for case that some data remained unchanged is to copy this data to a shared memory, thus preventing the need to have a "duplication" of it.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Variations:&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Systems with redundant contoller/CPU can launch the new SW on the redundant Controller reducing CPU load on the active CPU.&lt;/li&gt;&lt;li&gt;SW that is composed of several processes might upgrade independent modules one at a time (or even some of the processes only), but that will be discussed in another post, stay tuned :).&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2733668522121607461-4340029682801610502?l=ranlevy-swarchitecture.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ranlevy-swarchitecture.blogspot.com/feeds/4340029682801610502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/2009/10/in-service-sw-upgrade-issu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default/4340029682801610502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default/4340029682801610502'/><link rel='alternate' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/2009/10/in-service-sw-upgrade-issu.html' title='In Service SW Upgrade (ISSU)'/><author><name>Ran</name><uri>http://www.blogger.com/profile/06130807149433593735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_TcEHg1jQRfk/SusA2tr2HqI/AAAAAAAAAAo/CGq2HUr9YZw/S220/Copy+of+big7039475.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2733668522121607461.post-793107579214466709</id><published>2009-10-25T22:46:00.000-07:00</published><updated>2009-10-26T02:02:58.595-07:00</updated><title type='text'>Decoupling SW from Platform</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_TcEHg1jQRfk/SuVTFTfQTUI/AAAAAAAAAAc/LSQCWXZAAzo/s1600-h/Plugins.JPG"&gt;&lt;/a&gt;&lt;div&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;Context: &lt;/strong&gt;&lt;/div&gt;&lt;div&gt;SW that is aimed to run on different platforms.&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Imagine that you need to write a SW that needs to run on completely different types of HW. An example for such SW can be a SW that runs in Telco products. Some of these products contain FPGAs , some of them contains Network Processors (NPU) or dedicated chip. These HW entities arrive with API that is usually wrapped by some platform code. &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;In addition different products might not support the same functionality - e.g. some products supports bridging functionality only, while other supports MPLS or even both. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;To make things even more complicated, imagine that this SW is off the shelf product and cannot apriori tell what are the capabilities of the platform in terms of functionality. &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Other considerations:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Since the SW and the platform code might be developed by completely different companies, we would like to decouple as much as possible between the two.&lt;/li&gt;&lt;li&gt;Since in some systems the acceptance tests of customers are quite long we would like to enable the replacement of SW appplication or platform code independently and allowing the customer to test only the affected code (e.g. platform code).&lt;/li&gt;&lt;li&gt;Since some embedded systems have major requirements for high availability, the solution should consider an option to replace smaller modules fast enough without affecting the entire system. &lt;/li&gt;&lt;li&gt;Such decoupling allows the SW to focus on the logic it should provide rather the exact details of the HW platform.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;The proposed solution is based on Plug-ins Architecture (see overview in Wikipedia &lt;a href="http://en.wikipedia.org/wiki/Plug-in_(computing"&gt;http://en.wikipedia.org/wiki/Plug-in_(computing&lt;/a&gt;)). The binding between the host application and the Plug-ins is done on runtime allowing maximal decoupling between the host and the platform. The Plug-in (platform code) needs to know only the interface of the host (e.g. the SW application) implement it (or part of it) and the host is in-charge of dynamically locating the plug-ins and detecting what functionality it supports.&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;Structure:&lt;/strong&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 113px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5396811079069224258" border="0" alt="" src="http://1.bp.blogspot.com/_TcEHg1jQRfk/SuVTFTfQTUI/AAAAAAAAAAc/LSQCWXZAAzo/s400/Plugins.JPG" /&gt;&lt;br /&gt;&lt;strong&gt;Run-time behavior:&lt;/strong&gt;&lt;br /&gt;&lt;u&gt;Initialization phase:&lt;/u&gt; during initialization the host maps the supported plug-ins (and potentially queries the supported functionality of each plug-in - depending on technologies).&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Runtime phase&lt;/u&gt;: when the host needs to invoke an operation, it seeks in its internal map and invokes the Plug-in for those operations if a suitable entry is found.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;br /&gt;&lt;u&gt;Plugin:&lt;/u&gt; impelements as a dll(s) (windows) or as shared-objects (Linux) its required functionality. Let's assume one of the files is called ManageCreation.dll and it exports a function called CreateObjA(...).&lt;br /&gt;&lt;p&gt;&lt;u&gt;Host:&lt;/u&gt;During initialization the host scans a well known directory (or a directory that is provided to him by configuration file for instance), and queries each DLL for its exported functions (e.g. using GetProcAddress). The host finds during the scan the ManageCreation.dll implements the interface "CreateObjA".&lt;/p&gt;&lt;p&gt;The host creates a map between its interfaces to the actual function that implements the interface in the plug-in. &lt;/p&gt;&lt;p&gt;When the host needs to invoke the creation of ObjA, it searches its internal map and invokes the corresponding function that it found in the plugin.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Implications:&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Performance: the solution is obviously slower than static binding, however the overhead of the dynamic binding is negligible.&lt;/li&gt;&lt;li&gt;High Availability: a system can replace dynamic libraries easily without affecting the entire system. It requires the host and plugins to agree on a scheme that changes the mapping to from an old implementation of the dll to the new one.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;"Patterns of Enterprise Application Architecture", Martin Fowler, 2002. Addision Wesley publication. p. 499.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2733668522121607461-793107579214466709?l=ranlevy-swarchitecture.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ranlevy-swarchitecture.blogspot.com/feeds/793107579214466709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/2009/10/decoupling-sw-from-platform.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default/793107579214466709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2733668522121607461/posts/default/793107579214466709'/><link rel='alternate' type='text/html' href='http://ranlevy-swarchitecture.blogspot.com/2009/10/decoupling-sw-from-platform.html' title='Decoupling SW from Platform'/><author><name>Ran</name><uri>http://www.blogger.com/profile/06130807149433593735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_TcEHg1jQRfk/SusA2tr2HqI/AAAAAAAAAAo/CGq2HUr9YZw/S220/Copy+of+big7039475.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_TcEHg1jQRfk/SuVTFTfQTUI/AAAAAAAAAAc/LSQCWXZAAzo/s72-c/Plugins.JPG' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
