{"id":9883,"date":"2011-08-17T07:00:00","date_gmt":"2011-08-17T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/08\/17\/starting-up-inside-the-box\/"},"modified":"2011-08-17T07:00:00","modified_gmt":"2011-08-17T07:00:00","slug":"starting-up-inside-the-box","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20110817-00\/?p=9883","title":{"rendered":"Starting up inside the box"},"content":{"rendered":"<p>the shell team received two customer questions about a month apart which seemed unrelated but had the same root cause.<\/p>\n<blockquote class=\"q\"><p> I found that in Windows Vista, the <code>xcopy<\/code> command is ten times slower than it was in Windows&nbsp;XP. What is the source of this slowdown, and how can I fix it? <\/p><\/blockquote>\n<blockquote class=\"q\"><p> We have an application which takes a very long time to start up on Windows&nbsp;Vista than it did in Windows&nbsp;XP. We noticed that the slowdown occurs only if we set the application to autostart. <\/p><\/blockquote>\n<p> Let&#8217;s look at the second one first, since that customer provided a useful piece of information: The slowdown occurs only if they set the program to run automatically at logon. In Windows&nbsp;Vista, programs which are set to run automatically at logon <a href=\"http:\/\/blogs.technet.com\/askperf\/archive\/2008\/03\/28\/startup-programs-on-windows-vista-inside-the-box.aspx\"> run with reduced priority<\/a>. This was done in response to the fact that application developers <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/11\/01\/922449.aspx\"> went angling for a bonus<\/a> and <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/03\/11\/394249.aspx\"> decided to slow down the operating system overall in order to get their program to start up faster<\/a>. To counteract this tragedy of the commons, the performance team runs these programs inside a job object with reduced CPU, I\/O, and paging priority&mdash;which the performance team informally calls <i>boxing<\/i>&mdash; for 60 seconds, so that the user isn&#8217;t forced to sit and wait for all these startup programs to finish doing whatever &#8220;really important&#8221; stuff they want to do.\n Okay, back to the first customer, the one who reported that <code>xcopy<\/code> was taking a long time. It took a bit of back-and-forth, but eventually the customer revealed that they were performing the <code>xcopy<\/code> in a batch file which they placed in the Startup group. Once they volunteered that information, the reason for the slowdown became obvious: Their batch file was running inside the box, and consequently ran with low-priority I\/O.\n There is no way to escape the box, but it so happens that logon-triggered scheduled tasks are not placed inside a box. That&#8217;s your escape hatch. Don&#8217;t abuse it. (Of course, now that I&#8217;ve told everybody how to avoid being put in a box, everybody will now take advantage of it, because <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2008\/10\/06\/8969399.aspx\"> eventually, nothing is special any more<\/a>.)\n Oh, and if you look more closely at the <code>Delay_Sec<\/code> setting on a Windows&nbsp;7 machine, you&#8217;ll see that it&#8217;s set to zero, so the boxing behavior is effectively disabled on Windows&nbsp;7. I guess the performance team gave up. &#8220;Fine, if you want your computer to run like a dog when it starts up, then go right ahead. I won&#8217;t try to save you from yourself any more.&#8221;<\/p>\n<p> <b>Bonus chatter<\/b>: You can explicitly &#8220;put yourself inside a box&#8221; by using the <code>PROCESS_MODE_BACKGROUND_BEGIN<\/code> process priority mode. Programs which are intended to run in the background with minimal impact on the rest of the system can use this mode. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>the shell team received two customer questions about a month apart which seemed unrelated but had the same root cause. I found that in Windows Vista, the xcopy command is ten times slower than it was in Windows&nbsp;XP. What is the source of this slowdown, and how can I fix it? We have an application [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[104],"class_list":["post-9883","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>the shell team received two customer questions about a month apart which seemed unrelated but had the same root cause. I found that in Windows Vista, the xcopy command is ten times slower than it was in Windows&nbsp;XP. What is the source of this slowdown, and how can I fix it? We have an application [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/9883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=9883"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/9883\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=9883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=9883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=9883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}