Page 430 - Computer_Science_F5
P. 430

how advanced users can leverage     program responsiveness and overall
                   the command line to manage          system performance.                         Chapter Seven: Operating Systems
                   processes on Linux. Explain the
                   benefits and potential challenges   There are several  CPU scheduling
                   of this approach.                   algorithms, including the following three:
          FOR ONLINE READING ONLY
                                                        (a) First Come First Served (FCFS):
              CPU/Processor scheduling                     Like a waiting line, processes are

              CPU scheduling is about ensuring             served in the order they arrive. It’s
              keeping the computer operations running      fair but can be slow if short processes
              smoothly. Imagine a busy teacher’s office.   get stuck behind long ones.
              Students (processes) need to be served by   (b) Shortest Job First (SJF): Prioritises
              the teacher (use the CPU) efficiently. CPU   the shortest processes, leading to
              scheduling is like the teacher, ensuring     faster completion times on average.
              everyone gets their fair share of CPU        However, it requires knowing the
              time without chaos. But what happens if      process lengths beforehand, which
              students get stuck waiting for each other’s   isn’t always possible.
              teacher? Specifically, suppose one student   (c) Round Robin (RR): Acts like a fair
              is being served by the first teacher while   organiser, ensuring that each process
              waiting for the services from the second     gets a turn for the CPU usage for
              teacher, and another student is being        a short period before switching to
              served by Teacher Two while waiting for      others. The RR algorithm has several
              the services of the first osne. This creates   benefits, including the following
              a deadlock. In the context of an operating   three. The first benefit is fairness,
              system,  a deadlock happens when multiple    because each process gets a chance
              processes are waiting for resources held     to run for a short time, even if it is
              by each other. For example, a deadlock       a long process overall. The second
              might happen when one process happens
              to be holding one computer resource          benefit of RR is responsiveness, in a
              (such as, CPU time) while waiting for a      sense that short processes can finish
              resource (like, memory) held by another      quickly, and users experience better
              process to continue execution. If two or     responsiveness. The third benefit
              more processes find themselves in such       of RR is that it prevents starvation.
              a situation, then the computer will likely   Unlike FCFS, in RR shorter
              stop working smoothly. Thus, because         processes do not get stuck behind
              programs need CPU resources to execute,      long ones. Every process eventually
              CPU scheduling helps to decide which         gets the CPU time, even if it is for
              process gets the CPU next, impacting         short bursts.

                                                    421
               Student’s Book  Form Five



     Computer Science Form 5.indd   421                                                     23/07/2024   12:34
   425   426   427   428   429   430   431   432   433   434   435