COMP 314 - U2C6

Operating System Concepts, Seventh Edition

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 314 – Unit 2, Section 2, Chapter 6 A cooperating process is one that can affect or be affected by other processes executing in the system. (191) o It can either directly share a logical address space (both code and data) or be allowed to share data only through files or messages. Sharing through a logical address space is achieved by a LWP or thread. Background o A situation where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called a race condition (193) To guard against this, we need to ensure that only one process may manipulate a counter at one time. The Critical-Section Problem o Considering a system of n processes: Each process has a segment of code, called a critical section , in which the process may be changing common variables, updating a table, writing a file, and so on. The important feature of the system is that, when one process is executing in its critical section, no other process is to be allowed to execute in its critical section. o The critical-section problem is to design a protocol that the processes can use to cooperate. Each process must request permission to enter its critical section. The section of code implementing this request is the entry section . This is followed by the exit section, and the remaining code is the remainder section. o A solution to the critical-section problem must satisfy the following three requirements: (194) Mutual exclusion – only a single process may execute its critical section at one time. Progress – If no process is executing its critical section and some process wishes to enter their critical section, only those processes that are not executing in their remainder sections may participate in the decision of who enters next. The selection cannot be postponed indefinitely. Bounded Waiting – There exists a bound, or limit, on the number of times that other processes are allowed to enter their critical section after a process has made a request to enter its critical section and before that request is granted. o Two general approaches are used to handle critical sections in OSs: (195) Preemptive Kernels Allows a process to be pre-empted while it is running in kernel mode This is more suitable for real-time programming, as it will allow a real-time process to pre-empt a process currently running in the kernel. It may be more responsive, since there is less risk that a kernel-mode process will run for an arbitrarily long time. Non-preemptive Kernels A kernel-mode process will run until it exist kernel mode, blocks or voluntarily yields control of the CPU. This is free of the race condition, as only one process is active in the kernel at one time.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

COMP 314 - U2C6 - COMP 314 Unit 2 Section 2 Chapter 6 A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online