Page 73 - DCAP403_Operating System
P. 73

Operating System




                    Notes                             Figure 4.13: Diagram of Process with Multi-thread


                                                               OPERATING SYSTEM






                                           PROCESS#1              PROCESS#2             PROCESS#3


                                        REGISTERS  THREAD 1A   REGISTERS  THREAD 2A  REGISTERS  THREAD 3A

                                                  THREAD 1B              THREAD 2B             THREAD 3B



                                                  THREAD 1C              THREAD 2C             THREAD 3C













                                                 PROCESS #1  PROCESS #2  PROCESS #3
                                                MAIN MEMORY


                                   4.13 Benefits of Threads

                                   Following are some reasons why threads are used in designing operating systems:
                                   1.   A process with multiple threads make a great server for example printer server.
                                   2.   Because threads can share common data, they do not need to use inter-process
                                       communication.

                                   3.   Because of the very nature, threads can take advantage of multi-processors.
                                   4.   Threads need a stack and storage for registers therefore, threads are cheap to create.
                                   5.   Threads do not need new address space, global data, program code or operating system
                                       resources.

                                   4.14 Summary

                                       Process management is an operating system’s way of dealing with running multiple
                                       processes at once.

                                       A multi-tasking operating system may just switch between processes to give the
                                       appearance of many processes executing concurrently or simultaneously, though in fact
                                       only one process can be executing at any one time on a single-core CPU (unless using
                                       multi-threading or other similar technology).





          66                               LOVELY PROFESSIONAL UNIVERSITY
   68   69   70   71   72   73   74   75   76   77   78