{"id":507,"date":"2008-06-27T16:00:36","date_gmt":"2008-06-27T23:00:36","guid":{"rendered":"https:\/\/www.reenigne.org\/blog\/?p=507"},"modified":"2008-05-23T16:40:52","modified_gmt":"2008-05-23T23:40:52","slug":"plug-ins-should-not-be-in-the-same-address-space-as-the-main-process","status":"publish","type":"post","link":"https:\/\/www.reenigne.org\/blog\/plug-ins-should-not-be-in-the-same-address-space-as-the-main-process\/","title":{"rendered":"Plug-ins should not be in the same address space as the main process"},"content":{"rendered":"<p>After some thought I have come to the conclusion that a software architecture which allows third-party code to run in the same process as the main program is a bad idea.<\/p>\n<p>The first problem with such an architecture is reliability &#8211; how do you protect yourself against bugs in the third-party code? The short answer is that you can&#8217;t &#8211; the plugin has the ability to stomp all over your process&#8217;s invariants. The best you can do is terminate the process when such a situation is detected.<\/p>\n<p>The second problem is that a compiler can&#8217;t reason about the third-party code (it might not even exist at compile time). This means that there are all kinds of checks and optimizations that cannot be performed (like some of the <a href=\"https:\/\/www.reenigne.org\/blog\/stack-measuring\">stack tricks<\/a> I mentioned a while ago).<\/p>\n<p>The third problem is that one cannot tell what code the plug-in will rely on &#8211; if it sticks to documented interfaces that&#8217;s okay, but (either deliberately or accidentally) a plug-in might rely on undocumented behavior which causes the plug-in to break if the program is updated. This forces the program to have ugly kludges to keep old plug-ins working.<\/p>\n<p>If plug-ins are run as separate processes communicating with the main program via well-defined IPC protocols, all these problems are solved. The down-side is that these protocols are likely to be a little more difficult to code against and (depending on the efficiency of the operating system&#8217;s IPC implementation) may also be significantly slower. The speed problem seems unlikely to be insurmountable though &#8211; current OSes can play back HD video which involves the uncompressed video stream crossing the user\/kernel boundary &#8211; few applications are likely to need IPC bandwidth greater than that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After some thought I have come to the conclusion that a software architecture which allows third-party code to run in the same process as the main program is a bad idea. The first problem with such an architecture is reliability &#8211; how do you protect yourself against bugs in the third-party code? The short answer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,26],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-language","category-security"],"_links":{"self":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":0,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}