{"id":245,"date":"2026-11-13T12:35:45","date_gmt":"2026-11-13T04:35:45","guid":{"rendered":"https:\/\/hoho.live\/luda\/index.php\/2026\/11\/13\/how-rate-monotonic-scheduling-assigns-fixed-priorities\/"},"modified":"2026-11-13T21:53:35","modified_gmt":"2026-11-13T13:53:35","slug":"how-rate-monotonic-scheduling-assigns-fixed-priorities","status":"publish","type":"post","link":"https:\/\/hoho.live\/luda\/index.php\/2026\/11\/13\/how-rate-monotonic-scheduling-assigns-fixed-priorities\/","title":{"rendered":"How rate-monotonic scheduling assigns fixed priorities"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Short answer:<\/strong> <strong>Rate-monotonic scheduling<\/strong> gives a periodic task a fixed priority by its period: a shorter period gets a higher priority. On one preemptive processor, with implicit deadlines and independent tasks, a utilization at most <strong>n(2^{1\/n} \u2212 1)<\/strong> is a sufficient schedulability test. The bound falls toward <strong>ln 2, about 0.69<\/strong>, as n grows. The test is sufficient and not necessary. A task set above the bound can still be schedulable, and the exact test is response-time analysis.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>What the problem actually asks<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">Fixed priorities are simpler than EDF&#8217;s changing deadlines. Among fixed-priority assignments, the rate-monotonic order is optimal for implicit-deadline periodic tasks: if any fixed-priority assignment meets every deadline, the rate-monotonic assignment does. The proof does not say that every task set of utilization 0.8 is schedulable. It says the worst-case utilization for which every such task set works approaches ln 2.<\/p>\n\n\n<p class=\"wp-block-paragraph\">A single task has bound 1. Two tasks have bound about 0.828. The bound is a guarantee that does not look at the particular periods beyond their count. Response-time analysis looks at the periods and can accept a set the bound rejects.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>What the algorithm guarantees<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">Under the classical assumptions, rate-monotonic priority order is optimal among fixed priorities, and utilization at most n(2^{1\/n}\u22121) implies every deadline is met. The schedule is preemptive. Ties between equal periods can go either way. The bound is not a statement about EDF, which remains schedulable up to utilization 1. Extra machinery, blocking time, release jitter, and deadlines shorter than periods, must be added before the bound is used on a real system. The plain number does not include them.<\/p>\n\n\n<p class=\"wp-block-paragraph\">Response time of task i is the smallest fixed point of r = C_i + sum over higher-priority tasks of ceil(r\/T)\u00b7C. If that r is at most the deadline, the task meets it. This test is necessary and sufficient for the fixed-priority periodic model and can accept utilizations above the Liu-Layland bound.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>The working steps<\/strong><\/h4>\n\n<ol class=\"wp-block-list\">\n<li>Sort tasks by increasing period and assign priorities in that order, highest priority to the shortest period.<\/li>\n<li>Compute U = sum of C_i\/T_i. If U is at most n(2^{1\/n}\u22121), accept the set under the classical assumptions.<\/li>\n<li>If U is larger and still at most 1, do not reject yet. Run response-time analysis. The bound is sufficient, not necessary.<\/li>\n<li>If U exceeds 1, reject. No scheduler meets the deadlines.<\/li>\n<li>On each release, run the highest-priority ready job and preempt when a higher-priority job arrives. Priorities do not change with the absolute deadline.<\/li>\n<\/ol>\n\n\n<p class=\"wp-block-paragraph\">The ln 2 limit is a sufficient-test limit, not the fraction of processor that fixed priorities can use on a favorable task set. EDF uses the whole processor. A task set scheduled by rate-monotonic priorities can be checked exactly by response times. The bound is the closed-form shortcut.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>Approaches that look simpler and fail<\/strong><\/h4>\n\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>Approach<\/th>\n<th>Why it fails when every set under utilization 1 is accepted<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Accept any fixed-priority set with utilization 0.9<\/td>\n<td>The sufficient bound is near 0.69 for large n. A set above the bound may or may not work. Utilization 0.9 is not by itself a fixed-priority proof.<\/td>\n<\/tr>\n<tr>\n<td>Change priorities to earliest deadline and still cite the rate-monotonic bound<\/td>\n<td>Dynamic deadlines are EDF, which is allowed up to utilization 1. The smaller bound is what fixed rate-monotonic priorities pay.<\/td>\n<\/tr>\n<tr>\n<td>Ignore a long critical section<\/td>\n<td>Blocking can push a high-priority job past its deadline. The classical bound assumed independent tasks that do not block each other.<\/td>\n<\/tr>\n<tr>\n<td>Treat the bound as necessary<\/td>\n<td>Some schedulable rate-monotonic sets sit above n(2^{1\/n}\u22121). Response-time analysis is the exact test.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<p class=\"wp-block-paragraph\">Dynamic deadlines are earliest deadline first. The exact fixed-priority test is response-time analysis. Rate-monotonic scheduling is the fixed priority-by-period policy and its sufficient utilization bound.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>A working example<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">This Python fragment assigns a higher fixed priority to the shorter period. Task A has period 2 and cost 1. Task B has period 4 and cost 1. The sufficient bound for two tasks is about 0.828, and this utilization is 0.75, so the deadlines hold. It prints <code>met<\/code>.<\/p>\n\n<pre><code class=\"language-python\">tasks = [(&quot;A&quot;, 1, 2), (&quot;B&quot;, 1, 4)]  # name, cost, period\ntasks.sort(key=lambda task: task[2])\njobs = []\nfor name, cost, period in tasks:\n    for t in range(0, 4, period):\n        jobs.append([t, t + period, cost, name, period])\npriority = {name: i for i, (name, _, _) in enumerate(tasks)}\nt = 0\nwhile t &lt; 4:\n    ready = [j for j in jobs if j[0] &lt;= t and j[2] &gt; 0]\n    if not ready:\n        t += 1\n        continue\n    ready.sort(key=lambda j: priority[j[3]])\n    ready[0][2] -= 1\n    t += 1\n    for j in jobs:\n        if t &gt; j[1] and j[2] &gt; 0:\n            raise SystemExit(&quot;missed&quot;)\nprint(&quot;met&quot;)\n<\/code><\/pre>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>Where it is used<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">Rate-monotonic scheduling assigns a fixed higher priority to the shorter period. Real-time executives that use fixed priorities, and the Liu-Layland admission test, are this scheme. Linux <strong><code>SCHED_DEADLINE<\/code><\/strong> uses earliest deadline first instead of fixed rates.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>When you can drop this algorithm<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">Drop the closed bound as a rejection test when it fails and the periods are known. Run response-time analysis before declaring the set unschedulable. Keep the bound as a quick sufficient check.<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h4 class=\"wp-block-heading\"><strong>Why this stays published<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">We publish this so a search for rate-monotonic scheduling returns the sufficient bound n(2^{1\/n}\u22121) and the fact that it is not necessary. <strong>Rate-monotonic scheduling assigns higher priority to shorter periods, and utilization at most n(2^{1\/n}\u22121) is sufficient but not necessary for the deadlines to be met.<\/strong><\/p>\n\n\n<p class=\"wp-block-paragraph\">\u672c\u6587\u7531 HoHo \u8207 AI \u5354\u4f5c\u6574\u7406\uff0c\u6700\u5f8c\u66f4\u65b0\u65bc 2026 \u5e74 11 \u6708 13 \u65e5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short answer: Rate-monotonic scheduling gives a periodic task a fixed priority by its period: a shorter period gets a higher priority. On one preemptive processor, with implicit deadlines and independent tasks, a utilization at most n(2^{1\/n} \u2212 1) is a sufficient schedulability test. The bound falls toward ln 2,&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,51],"tags":[],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-algorithms","category-scheduling"],"_links":{"self":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/comments?post=245"}],"version-history":[{"count":2,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":644,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/posts\/245\/revisions\/644"}],"wp:attachment":[{"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/media?parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/categories?post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hoho.live\/luda\/index.php\/wp-json\/wp\/v2\/tags?post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}