{"id":3264,"date":"2025-06-05T13:43:07","date_gmt":"2025-06-05T13:43:07","guid":{"rendered":"https:\/\/diznr.com\/?p=3264"},"modified":"2025-06-05T13:43:07","modified_gmt":"2025-06-05T13:43:07","slug":"day-02part-02-operating-system-for-computer-science-when-we-required-cpu-scheduling","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/pdf\/day-02part-02-operating-system-for-computer-science-when-we-required-cpu-scheduling\/","title":{"rendered":"Day 02Part 02- Operating System for Computer Science &#8211; When we required CPU scheduling"},"content":{"rendered":"<p>Day 02Part 02- Operating System for Computer Science &#8211; When we required CPU scheduling<\/p>\n<p>[fvplayer id=&#8221;324&#8243;]<\/p>\n<p>Here\u2019s a clear explanation for <strong>\u201cDay 02 Part 02 \u2013 Operating System (OS) for Computer Science: When We Require CPU Scheduling\u201d<\/strong> \u2014 great for <strong>GATE, UGC NET, university exams<\/strong>, or general understanding.<\/p>\n<hr \/>\n<h2>\ud83d\udcd8 <strong>Topic:<\/strong> When Do We Require <strong>CPU Scheduling<\/strong> in an Operating System?<\/h2>\n<hr \/>\n<h3>\ud83e\udde0 <strong>What Is CPU Scheduling?<\/strong><\/h3>\n<p>CPU scheduling is the process of selecting one process from the <strong>ready queue<\/strong> and assigning the CPU to it.<\/p>\n<p>The <strong>Operating System&#8217;s scheduler<\/strong> decides <em>which<\/em> process gets the CPU and <em>when<\/em>, based on scheduling algorithms (like FCFS, SJF, Round Robin, etc.).<\/p>\n<hr \/>\n<h2>\ud83d\udd52 <strong>When Is CPU Scheduling Required?<\/strong><\/h2>\n<p>CPU scheduling is required <strong>only when the CPU becomes idle and needs to choose the next process to execute<\/strong>.<\/p>\n<p>More specifically, CPU scheduling is needed in the following cases:<\/p>\n<hr \/>\n<h3>1. <strong>When a Process Switches from Running to Waiting<\/strong><\/h3>\n<p>Example:<\/p>\n<ul>\n<li>A process requests I\/O \u2192 It leaves CPU<\/li>\n<li>CPU is free \u2192 Scheduler picks another process from the ready queue.<\/li>\n<\/ul>\n<p>\u2714\ufe0f <strong>Scheduling needed<\/strong><\/p>\n<hr \/>\n<h3>2. <strong>When a Process Switches from Running to Ready<\/strong><\/h3>\n<p>This happens in <strong>preemptive scheduling<\/strong> (like Round Robin or Priority Scheduling).<br \/>\nExample:<\/p>\n<ul>\n<li>A process is running.<\/li>\n<li>A higher-priority process arrives.<\/li>\n<li>OS preempts current process and schedules the new one.<\/li>\n<\/ul>\n<p>\u2714\ufe0f <strong>Scheduling needed<\/strong><\/p>\n<hr \/>\n<h3>3. <strong>When a Process Switches from Waiting to Ready<\/strong><\/h3>\n<p>Example:<\/p>\n<ul>\n<li>A process finishes I\/O.<\/li>\n<li>Now it\u2019s ready to execute again.<\/li>\n<\/ul>\n<p>\u2714\ufe0f <strong>Scheduling may be needed<\/strong> if the CPU is idle or preemption is allowed.<\/p>\n<hr \/>\n<h3>4. <strong>When a Process Terminates<\/strong><\/h3>\n<ul>\n<li>The running process completes.<\/li>\n<li>CPU becomes idle.<\/li>\n<\/ul>\n<p>\u2714\ufe0f <strong>Scheduling needed<\/strong> to assign CPU to the next process.<\/p>\n<hr \/>\n<h3>\ud83d\udeab <strong>When It\u2019s Not Required:<\/strong><\/h3>\n<p>If only one process is running and no others are ready or waiting, <strong>no scheduling is needed<\/strong>.<\/p>\n<hr \/>\n<h2>\ud83e\uddea <strong>Summary Table:<\/strong><\/h2>\n<table>\n<thead>\n<tr>\n<th>Event<\/th>\n<th>CPU Scheduling Required?<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Running \u2192 Waiting<\/td>\n<td>\u2714\ufe0f Yes<\/td>\n<\/tr>\n<tr>\n<td>Running \u2192 Ready (Preemption)<\/td>\n<td>\u2714\ufe0f Yes<\/td>\n<\/tr>\n<tr>\n<td>Waiting \u2192 Ready<\/td>\n<td>\u2714\ufe0f Yes (if CPU idle)<\/td>\n<\/tr>\n<tr>\n<td>Process Termination<\/td>\n<td>\u2714\ufe0f Yes<\/td>\n<\/tr>\n<tr>\n<td>Only one process exists (no competition)<\/td>\n<td>\u274c No<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\ud83c\udfaf <strong>Why It&#8217;s Important (in OS Exams or GATE):<\/strong><\/h2>\n<ul>\n<li>Forms the basis for <strong>scheduling algorithm design<\/strong>.<\/li>\n<li>Helps in understanding <strong>context switching<\/strong>, <strong>CPU utilization<\/strong>, and <strong>response time optimization<\/strong>.<\/li>\n<\/ul>\n<hr \/>\n<p>If you&#8217;d like, I can give you:<\/p>\n<ul>\n<li>\ud83d\udcc4 A printable revision note (PDF)<\/li>\n<li>\ud83d\udcca Chart comparing different scheduling algorithms<\/li>\n<li>\ud83c\udfa5 Script for explaining this in a short video format<\/li>\n<\/ul>\n<p>Let me know how you&#8217;d like to study this!<\/p>\n<h3><a href=\"https:\/\/aissmspoly.org.in\/wp-content\/uploads\/2020\/01\/CPU-Scheduling-and-Algorithm-.pdf\" target=\"_blank\" rel=\"noopener\">Day 02Part 02- Operating System for Computer Science &#8211; When we required CPU scheduling<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/sriindu.ac.in\/wp-content\/uploads\/2023\/10\/R20CSE2202-OPERATING-SYSTEMS.pdf\" target=\"_blank\" rel=\"noopener\">OPERATING SYSTEM Lecture Notes On<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.os-book.com\/OS8\/os8e\/slide-dir\/PDF-dir\/ch5.pdf\" target=\"_blank\" rel=\"noopener\">CPU Scheduling<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Day 02Part 02- Operating System for Computer Science &#8211; When we required CPU scheduling [fvplayer id=&#8221;324&#8243;] Here\u2019s a clear explanation for \u201cDay 02 Part 02 \u2013 Operating System (OS) for Computer Science: When We Require CPU Scheduling\u201d \u2014 great for GATE, UGC NET, university exams, or general understanding. \ud83d\udcd8 Topic: When Do We Require CPU [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[78],"tags":[],"class_list":["post-3264","post","type-post","status-publish","format-standard","hentry","category-operating-system"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/3264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/comments?post=3264"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/3264\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media?parent=3264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/categories?post=3264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/tags?post=3264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}