Page 68 - DCAP403_Operating System
P. 68

Unit 4: Process Management





          To implement parallel and concurrent mechanisms you need to use specific primitives of our   Notes
          operating system. These must have context switching capabilities, which can be implemented in
          two ways, using kernel level threads or using user level threads.

                                   Figure 4.8: Diagram of Kernel Thread

                          Thread       Process







                                                              User space





                                                              Kernel space


                                Process table
                                                    Thread table

          If I use kernel level threads, the operating system will have a descriptor for each thread belonging
          to a process and it will schedule all the threads. This method is commonly called one to one. Each
          user thread corresponds to a kernel thread.
          There are two major advantages around this kind of thread. The first one concerns switching


          aspects; when a thread finishes its instruction or is blocked, another thread can be executed. The
          second one is the ability of the kernel to dispatch threads of one process on several processors.
          These characteristics are quite interesting for multi-processor architectures. However, thread
          switching is done by the kernel, which decreases performances.
                                   Figure 4.9: Diagram of User Thread
                                       Process
                          Thread







                                                             User space






                                                             Kernel space

                      Run-time       Thread table
                       system                     Process table

          User level threads are implemented inside a specialized library that provides primitives to handle
          them. All information about threads is stored and managed inside the process address space.
          This is called many to one, because one kernel thread is associated to several user threads. Its has

          some advantages: The first is that is independent of the system, thus, it runs faster than context



                                           LOVELY PROFESSIONAL UNIVERSITY                                    61
   63   64   65   66   67   68   69   70   71   72   73