{"id":17599,"date":"2017-04-03T14:05:04","date_gmt":"2017-04-03T18:05:04","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=17599"},"modified":"2017-04-03T14:05:40","modified_gmt":"2017-04-03T18:05:40","slug":"beware-default-qos","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2017\/04\/03\/beware-default-qos\/","title":{"rendered":"Beware Default QoS"},"content":{"rendered":"<p><a href=\"https:\/\/developer.apple.com\/library\/content\/documentation\/Performance\/Conceptual\/EnergyGuide-iOS\/PrioritizeWorkWithQoS.html\">Apple<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/library\/content\/documentation\/Performance\/Conceptual\/EnergyGuide-iOS\/PrioritizeWorkWithQoS.html\"><p>A <em>quality of service (QoS) class<\/em> allows you to categorize work to be performed by <code class=\"code-voice\">NSOperation<\/code>, <code class=\"code-voice\">NSOperationQueue<\/code>, <code class=\"code-voice\">NSThread<\/code> objects, dispatch queues, and pthreads (POSIX threads). By assigning a QoS to work, you indicate its importance, and the system prioritizes it and schedules it accordingly. For example, the system performs work initiated by a user sooner than background work that can be deferred until a more optimal time. In some cases, system resources may be reallocated away from the lower priority work and given to the higher priority work.<\/p>\n<p>[&#8230;]<\/p>\n<p>On iPhones, discretionary and background operations, including networking, are paused when Low Power Mode is enabled.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/drewmccormack\/status\/848791171950403584\">Drew McCormack<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/drewmccormack\/status\/848791171950403584\"><p>Defaults for QoS can lead to nasty bugs. A lot of my &lsquo;sync not working&rsquo; issues were due to ops not executing in low power mode.<\/p><\/blockquote>\n<blockquote cite=\"https:\/\/twitter.com\/drewmccormack\/status\/848813126753681408\"><p>If you have tasks using NSOperation or dispatch, and they seem to stop working in low power mode, that could be it.<\/p><\/blockquote>\n<blockquote cite=\"https:\/\/twitter.com\/drewmccormack\/status\/848791593515700224\">\n<p>Making QoS default to no-ops for low resources seems crazy to me. Apps just break. That should never be a default. Should have been opt in.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Apple: A quality of service (QoS) class allows you to categorize work to be performed by NSOperation, NSOperationQueue, NSThread objects, dispatch queues, and pthreads (POSIX threads). By assigning a QoS to work, you indicate its importance, and the system prioritizes it and schedules it accordingly. For example, the system performs work initiated by a user [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[800,630,31,1380,30,1381,71,269],"class_list":["post-17599","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-concurrency","tag-core-data-ensembles","tag-ios","tag-ios-10","tag-mac","tag-macos-10-12","tag-programming","tag-syncing"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=17599"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17599\/revisions"}],"predecessor-version":[{"id":17600,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17599\/revisions\/17600"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=17599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=17599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=17599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}