Chapter 6 - Concurrent Processes Ivy Tech State College Northwest Region 01 CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty.

Slides:



Advertisements
Similar presentations
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Advertisements

Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Multiprocessor OS The functional capabilities often required in an OS for a multiprogrammed computer include the resource allocation and management schemes,
Introduction CSCI 444/544 Operating Systems Fall 2008.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Informationsteknologi Wednesday, September 26, 2007 Computer Systems/Operating Systems - Class 91 Today’s class Mutual exclusion and synchronization 
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
CS444/CS544 Operating Systems Synchronization 2/16/2006 Prof. Searleman
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
1: Operating Systems Overview
Chapter 2.3 : Interprocess Communication
Chapter 11: Distributed Processing Parallel programming Principles of parallel programming languages Concurrent execution –Programming constructs –Guarded.
Understanding Operating Systems Sixth Edition
1 Concurrency: Deadlock and Starvation Chapter 6.
Understanding Operating Systems Sixth Edition
MULTIPROCESSOR SYSTEMS OUTLINE  Coordinated job Scheduling  Separate Systems  Homogeneous Processor Scheduling  Master/Slave Scheduling.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
1 Concurrency: Deadlock and Starvation Chapter 6.
Computer System Architectures Computer System Software
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
 Introduction to Operating System Introduction to Operating System  Types Of An Operating System Types Of An Operating System  Single User Single User.
Understanding Operating Systems Fifth Edition Chapter 6 Concurrent Processes.
Chapter 6 Concurrent Processes Understanding Operating Systems, Fourth Edition.
Concurrency, Mutual Exclusion and Synchronization.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Understanding Operating Systems 1 Chapter 6 : Concurrent Processes What is Parallel Processing? Typical Multiprocessing Configurations Process Synchronization.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
Chapter 7 Operating Systems. Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
CIS250 OPERATING SYSTEMS Chapter One Introduction.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Operating System Concepts and Techniques Lecture 13 Interprocess communication-2 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Chapter 11 System Performance Enhancement. Basic Operation of a Computer l Program is loaded into memory l Instruction is fetched from memory l Operands.
Introduction to operating systems What is an operating system? An operating system is a program that, from a programmer’s perspective, adds a variety of.
Interprocess Communication Race Conditions
Chapter 5 - Process Management
Process Synchronization: Semaphores
Background on the need for Synchronization
G.Anuradha Reference: William Stallings
Chapter 6 Concurrent Processes
Concurrency: Mutual Exclusion and Synchronization
Lecture 2 Part 2 Process Synchronization
Concurrency: Mutual Exclusion and Process Synchronization
CSE 153 Design of Operating Systems Winter 19
Operating System Overview
CSE 542: Operating Systems
CSE 542: Operating Systems
Chapter 3: Process Management
Presentation transcript:

Chapter 6 - Concurrent Processes Ivy Tech State College Northwest Region 01 CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty

See Illustration p.1252 Introduction - Concurrent Processes Multiprocessing systems have more than one CPUMultiprocessing systems have more than one CPU –problems that occur in single processor systems apply to multi-processes in general single processor with 2 or more processessingle processor with 2 or more processes more than one processor with multiprocessesmore than one processor with multiprocesses

3 What Is Parallel Processing? –Parallel Processing, also called multiprocessing, where two or more processors operate in unison –Two or more CPUs are executing instructions simultaneously –Each CPU can have a process in the RUNNING state at the same time –Process Manager has to coordinate the activity of each processor, as well as synchronize the interaction among the CPUs

4 What Is Parallel Processing? –Synchronization is the key to the system’s success because many things can go wrong in a multiprocessing system –The system won’t work unless every processor communicates & cooperates with every other processor –Since mid-1980s, costs of CPU hardware declined, has increased multiprocessors used in business environment today

5 What Is Parallel Processing? –Two major forces behind multiprocessing development enhance throughputenhance throughput increase computing powerincrease computing power –Two primary benefits increased reliabilityincreased reliability faster processingfaster processing

6 Typical Multiprocessing Configurations Much depends on how multiple processors are configured. Three typical configurations are: –master/slave –loosely coupled –symmetric

See Fig. 6.1 p.1287 Master/Slave Configuration Single-processor (master) with additional (slave) processorsSingle-processor (master) with additional (slave) processors –master processor manages entire system –well suited for front-end users (interactive) & back-end users (batch) –advantage is simplicity –disadvantages reliability is no higher than single processorreliability is no higher than single processor can lead to poor use of resourcescan lead to poor use of resources increase # of interrupts, slave/masterincrease # of interrupts, slave/master

See Fig. 6.2 p.1288 Loosely Coupled Configuration Several complete computer systems, each with its own memory, I/O devices, CPU, & OSSeveral complete computer systems, each with its own memory, I/O devices, CPU, & OS –each processor controls its own resources –each processor can communicate & cooperate with the others –job scheduling for new jobs may be assigned to processor with lightest load or best combination of output devices –if one processor fails, others can continue to work independently, difficult to detect failed processor

See Fig. 6.3 p.1299 Symmetric Configuration Processor scheduling is decentralizedProcessor scheduling is decentralized Best implemented if the processors are all of the same typeBest implemented if the processors are all of the same type –four advantages over loosely coupled: more reliablemore reliable uses resources effectivelyuses resources effectively balances load wellbalances load well degraded gracefully in the event of system failuredegraded gracefully in the event of system failure

10 Process Synchronization Software Success hinges on the capability of the OS to make resources unavailable to other processes while it’s being used by one of themSuccess hinges on the capability of the OS to make resources unavailable to other processes while it’s being used by one of them Used resources must be locked away from other processes until it is released - critical region allow a process to finishUsed resources must be locked away from other processes until it is released - critical region allow a process to finish A mistake could leave a job waiting indefinitelyA mistake could leave a job waiting indefinitely

11 Test-And-Set single indivisible machine instruction known as “TS”single indivisible machine instruction known as “TS” introduced by IBM for System 360/370 computersintroduced by IBM for System 360/370 computers In a machine cycle it tests if the key is available/unavailableIn a machine cycle it tests if the key is available/unavailable single bit in a storage location that can contain a zero (free) or one (busy)single bit in a storage location that can contain a zero (free) or one (busy)

12 Test-And-Set Simple to implement & works well for a small # of processesSimple to implement & works well for a small # of processes two drawbacks:two drawbacks: starvation can occur when many processes are waiting to enter critical regionstarvation can occur when many processes are waiting to enter critical region busy waiting-the waiting processes remain in unproductive, resource- consuming wait loopsbusy waiting-the waiting processes remain in unproductive, resource- consuming wait loops

13 WAIT and SIGNAL Modification of “TS” designed to remove busy waitingModification of “TS” designed to remove busy waiting Two operations are mutually exclusive:Two operations are mutually exclusive: WAIT activated when the process encounters a busy condition codeWAIT activated when the process encounters a busy condition code SIGNAL activated when the process exits the critical region, condition code is set to “free”SIGNAL activated when the process exits the critical region, condition code is set to “free”

See Table 6.1 p Semaphores A nonnegative integer variable that’s used as a flagA nonnegative integer variable that’s used as a flag signals if and when a resource is free & can be used to processsignals if and when a resource is free & can be used to process Dijkstra (1965) introduced two operations to overcome process synchronization problemsDijkstra (1965) introduced two operations to overcome process synchronization problems P - proberen (to test)P - proberen (to test) V - verhogen (to increment)V - verhogen (to increment)

15 Semaphores P & V are executed by the OS in response called issued by any one process naming a semaphore as parameterP & V are executed by the OS in response called issued by any one process naming a semaphore as parameter Traditional name for semaphore is mutex - Mutual ExclusionTraditional name for semaphore is mutex - Mutual Exclusion necessary to avoid two operations attempt to execute at the same timenecessary to avoid two operations attempt to execute at the same time

16 Semaphores Sequential computations, mutex is achieved automatically because each operation is handled in order, one at a timeSequential computations, mutex is achieved automatically because each operation is handled in order, one at a time Parallel computations, order of execution can change, so mutex must be explicitly stated & maintainedParallel computations, order of execution can change, so mutex must be explicitly stated & maintained

17 Process Cooperation Several processes work together to complete a common task, two examples: producers and consumersproducers and consumers readers and writersreaders and writers Each requires both mutual exclusion and synchronization, they are implemented by using semaphores

See Fig. 6.5 p Producers and Consumers Classic problem: One process produces data that another process consumes laterOne process produces data that another process consumes later It can also be expanded to several pairs of producers and consumersIt can also be expanded to several pairs of producers and consumers Can be extended to buffers that hold records or data where process-to-process communication is requiredCan be extended to buffers that hold records or data where process-to-process communication is required

19 Readers and Writers Classic problem: Two processes need to access a shared resource such as a file or databaseTwo processes need to access a shared resource such as a file or database Combination priority policy used to prevent starvationCombination priority policy used to prevent starvation Readers must call two procedures:Readers must call two procedures: –checks whether the resources can be immediately granted for reading –checks to see if there are any writers waiting

20 Concurrent Programming Multiprocessing can also refer to one job using several processors to execute sets of instructions in parallel –requires a programming language –requires a system to this type

See Table 6.2 p Applications of Concurrent Programming Monoprogramming languages instructions are executed one at a timeinstructions are executed one at a time sufficient for most computational purposessufficient for most computational purposes –easy to implement –fast enough for most users

22 Applications of Concurrent Programming By using a language that allows concurrent processing, arithmetic expressions can be processed differently COBEGINCOBEGIN COENDCOEND –indicate to a compiler which instructions can be processed concurrently

See Table 6.3 p Applications of Concurrent Programming When operations are performed at the same time, we increase computation speed, but also create complexity of the program language & hardware explicit parallelismexplicit parallelism –detects which instructions can be executed in parallel implicit parallelismimplicit parallelism –automatic detection by the compiler of instructions that can be performed in parallel

24 ADA - Agusta Ada Byron U.S. Department of Defense early 1970sU.S. Department of Defense early 1970s Designed original language for embedded computer systemsDesigned original language for embedded computer systems Ada - high-level programming language made available to public in 1980Ada - high-level programming language made available to public in 1980 –modules support “information hiding” –implement concurrent programming –design made it easy to verify correctness of a program

25 Ada - Modular Programming An Ada program would contain one or more program units that could be compiled separately and were composed of: –a specification part, which has all the information that must be visible to other units (the argument list) –a body part, made up of implementation details that don’t need to be visible to other units

26 Ada - Modular Programming Program units can fall into any one of three types: –subprograms which are executable algorithms –packages which are collections of entities, (procedures or functions) –tasks which are concurrent computations is the heart of the language’s parallel processing abilityis the heart of the language’s parallel processing ability key is synchronization of the taskskey is synchronization of the tasks

27 Ada - The wave of the future? Landmark language: –researchers find it helpful because of parallel processing power –modular design is appealing to application programmers and systems analysts –tasking capabilities appeal to designers of database systems & other applications that require parallel processing –some universities offer Ada courses majoring in computer systems

28 Summary Multiprocessing systems have two or more CPUs that must be synchronized by the Process ManagerMultiprocessing systems have two or more CPUs that must be synchronized by the Process Manager Each processor must communicate with the otherEach processor must communicate with the other Multiprocessor configurationsMultiprocessor configurations –master/slave –loosely coupled –symmetric

29 Summary Multiprocessing also occurs in single processor systems between interacting processes that obtain control of the CPU at different timesMultiprocessing also occurs in single processor systems between interacting processes that obtain control of the CPU at different times Success depends on the ability of the system to synchronize the processors or processes & the system’s other resourcesSuccess depends on the ability of the system to synchronize the processors or processes & the system’s other resources

30 Summary Mutual exclusion helps keep the processes having allocated resources from becoming deadlockedMutual exclusion helps keep the processes having allocated resources from becoming deadlocked –test-and-set –WAIT and SIGNAL –semaphores (P - proberen,V – verhogen, and mutex)

31 Summary Hardware & Software are used to synchronize processesHardware & Software are used to synchronize processes Synchronization problemsSynchronization problems –missed waiting customers –synchronization of producers & consumers –mutual exclusion of readers & writers