chapter05 - Central Theme in OS Design Concurrency: Mutual...

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

View Full Document Right Arrow Icon
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5 Central Theme in OS Design OS design is concerned with Management of processes and threads: Multiprogramming Multiple processes within a uniprocessor system Multiprocessing Multiple processes within a multiprocessor Distributed processing Multiple processes on a multiple, distributed computer system, such as a cluster Fundamental to OS design: Concurrency Concurrency Design Issues Communication among processes Sharing resources Synchronization of multiple processes Allocation of processor time Concurrency Arises in 3 contexts: Multiple applications Multiprogramming Structured application Application can be a set of concurrent processes Operating-system structure Operating system is a set of processes or threads Some Key Items Related to Concurrency Interleaving and overlapping can be viewed as examples of concurrent processing both present the same problems Uniprocessor – the relative speed of execution of processes cannot be predicted depends on activities of other processes the way the OS handles interrupts scheduling policies of the OS Principles of Concurrency
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Difficulties with Concurrency Sharing global resources Two processes read/write on the same global variable Management of allocation of resources Difficult to manage optimally Programming errors difficult to locate Results are not deterministic and reproducible Occurs when multiple processes or threads read and write data items The final result depends on the order of execution the “loser” of the race is the process that updates last and will determine the final value of the variable Race Condition A Simple Example void echo() { chin = getchar(); chout = chin; putchar(chout); } A Simple Example Process P1 Process P2 .. in = getchar(); . . in = getchar(); chout = chin; chout = chin; putchar(chout); . . putchar(chout); Problem reasons: interrupts & parallel execution Solution: control access to the shared resource.
Background image of page 2
3 Operating System Concerns Design and management issues raised by the existence of concurrency. The OS must: Keep track of active processes Allocate and deallocate resources for each active process Processor time Memory Files I/O devices Protect data and physical resources of each process against unintended interference by other processes Output of process must be independent of the speed of execution of other concurrent processes Process Interaction Competition Among Processes for Resources Concurrent processes are competing for same resources In the case of competing processes, three control problems must be faces: Mutual Exclusion Critical resource : nonsharable resource requested by more processes Critical section: the portion of the program that uses it Only one program at a time is allowed in its critical section Example: only one process at a time is allowed to send
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

chapter05 - Central Theme in OS Design Concurrency: Mutual...

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

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