Page 119 - Computer_Science_F5
P. 119

Computer Science              Questions:



              1. Imagine you are the party planner in charge. How would you assign different
                 tasks as separate threads to get things done faster?
          FOR ONLINE READING ONLY
              2. What potential challenges could arise when using multithreading in party
                 planning? How could you mitigate these challenges?


           Pipelining,  ILP, superscalars, loop  unrolling,  and  register  renaming  are  used  to
           improve  processor performance.  However, the  problem  is that  within  a  single
           instruction  stream  we  do  not  find  enough  independent  instructions  to  execute
           simultaneously due to many factors such as data dependencies. To overcome this,
           we can leverage multiple instruction streams by introducing the concept of threads
           and processes.

           Process: An instance of a program in execution, as shown in Figure 2.12. It includes
           the program code, data structures, and its current execution state (think of it as a
           recipe being followed while cooking).
           Thread: A unit of execution within a process. A process can have multiple threads,
           each  handling  a  specific  task  concurrently  (imagine  multiple  cooks  working  on
           different parts of the same recipe).

           Program:  A program is a collection  of commands written  in a programming
           language, which a computer executes. These commands outline the actions and
           tasks the computer needs to carry out.




























                                          Figure 2.12: Processes

                                                 110
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   110                                                     23/07/2024   12:33
   114   115   116   117   118   119   120   121   122   123   124