Page 116 - DCAP103_Principle of operating system
P. 116

Unit 4: Process Management-III



                                                                                                  Notes
                 4.6.17  Several Instances of a Resource Type
                 4.6.18  Detection-Algorithm Usage
                 4.6.19  Recovery from Deadlock
                 4.6.20  Process Termination
                 4.6.21  Abort All Deadlocked Processes
                 4.6.22  Abort One Process at a Time Until the Deadlock Cycle is Eliminated
                 4.6.23  Resource Preemption

             4.7  Summary
             4.8  Keywords
             4.9  Review Questions

             4.10  Further Readings
            Objectives


            After studying this unit, you will be able to:
               •  Explain meaning of process management-III

               •  Understand concept of critical section
               •  Discuss the critical-section problem
               •  Explain way to handle critical-section problem

               •  Understand safety-critical operating systems
               •  Discuss semaphores
               •  Explain deadlock concept and handling

            Introduction


            A process is a program in execution. A process must have system resources, such as memory
            and the underlying CPU. The kernel supports the illusion of concurrent execution of multiple
            processes by scheduling system resources among the set of processes that are ready to execute.
            On a multiprocessor, multiple processes may really execute concurrently. This unit describes the
            composition of a process, the method that the system uses to switch between processes, and the
            scheduling policy that it uses to promote sharing of the CPU. It also introduces process creation
            and termination, and details the signal facilities and process-debugging facilities.

            4.1 Concept of Critical Section

            4.1.1 Basic Concept

            If a data item is shared by a number threads, race conditions could occur if the shared item is
            not protected properly. The easiest protection mechanism is a lock. In general, if a set of data
            items must be protected so that at any time there is no more than one thread can have access
            to it, we can associate the set of data items with a lock. The use of locks is actually very easy.
            For every thread, before it accesses the set of data items, it acquires the lock. Once the lock is
            successfully acquired, the thread becomes the owner of that lock and the lock is locked. Then,
            the owner can access the protected items. After this, the owner must release the lock and the




                                             LOVELY PROFESSIONAL UNIVERSITY                                   109
   111   112   113   114   115   116   117   118   119   120   121