Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems
|
|
- Terence Benson
- 5 years ago
- Views:
Transcription
1 Concurrency 1 Concurrency Execution of multiple processes. Multi-programming: Management of multiple processes within a uni- processor system, every system has this support, whether big, small or complex. Multi-processing: Management of multiple processes within a multi-processor system, servers and works stations. (Shared Memory) Distributed Processing: Management of multiple processes executing on number of distributed computer systems, for example clusters. (Do not Share Memory) 2 1
2 Concurrency Principle Interleaving: 1. In a single processor case multiple processes are interleaved in time to provide the illusion of simultaneous execution of these processes. 2. Although, it is not really parallel processing but there are benefits using such technique, apart from having overheads involved in switching of these processes. 3 Concurrency Principles Issues: 1. Basically, it is not possible to predict the speed of execution of processes. 2. Optimal allocation of resources is not possible by the o/s. 3. Sharing of global variables. 4 2
3 Concurrency Principles Pseudo Code for Demonstration: Suppose we have two or more applications reading input from the keyboard and putting the result on the screen. It would make sense to have the same procedure for all these applications and obviously it will be loaded into the global address space. Pseudo Code: function_test ( string charact) { readin (input_variable, keyboard); charact = input_variable; readout (charact, display); exit; } 5 Where is the problem P1 Process P1 has called function_test and have just read (X) the input and being interrupted, so charact = X; function_test ( string charact) { readin (input_variable, keyboard); charact = input_variable; i readout (charact, display); exit; } P1 When P1 resume it will display what? P2 Process P2 has called function_test and allowed to run till end with input Y, e.g., charact = Y. 6 3
4 How to Achieve Mutual Exclusion 7 Basics of Mutual Exclusion 1. Only one process is allowed into its critical section. 2. A process which may stop execution in non critical section must not affect/interfere with others. 3. A process should not be delayed indefinitely requiring access to critical section. 4. Any process must be allowed to enter into critical section without delay, if no process is in critical section. 5. No assumptions about speed or numbers of CPUs to be considered. 6. A process should remain in the critical section for a finite time only. 8 4
5 Operating System Concerns What are the issues o/s has to consider for concurrency: 1. O/S must keep track of all the processes (normally it is done through h PCB s). 2. O/S must allocate and de-allocate the resources for the processes. Which includes processor time, memory, files and i/o devices. 3. Protection of resources against unintended interference from other processes. 4. Result of a process must be independent of the speed at which the execution is taking place relative to the speed of other concurrent processes. 9 Operating System Concerns Degree of Awareness Relationship Influence on others Problems Unaware of others Competition 1. Result is independent of others 2. Timing may be affected Indirectly aware of others Cooperation by sharing 1. Result is not independent of others 2. Timing may be affected Directly aware of others Cooperation by communication 1. Result is not independent of others 2. Timing may be affected 1. Mutual Exclusion 2. Deadlock 3. Starvation 1. Mutual Exclusion 2. Deadlock 3. Starvation 4. Data Coherence 1. Deadlock 2. Starvation 10 5
6 Mutual Exclusion has cost? Mutual Exclusion Deadlock Starvation 11 Deadlock Suppose two processes P1 and P2 are to accomplish a task by using two resources R1 and R2 As shown here, What happened next? P1 P2 R1 Waiting (for ever) R2 12 6
7 Starvation P2 is Starved P1 P2 P3 R P1 P3 P1 P3 P1 P3. 13 Data Coherency In addition to deadlock and starvation another requirement may also be necessary, for example, suppose an application needs that a must condition should always be in placed say: a = b. In other words any process updating a must update b or vice versa, say for example a = b = 20; P1: a = a - 10; b = b - 10; P2: b = b * 2; a = a * 2; Which is fine if the consistency is achieved, but consider the following situation and both processes impose mutual exclusion; P1: a = a - 10; P2: b = b * 2; P1: b = b - 10; P2: a = a * 2; Which clearly demonstrate that a = b does not hold any more. 14 7
8 Dekkers Algorithm for ME Process 0 Process 1 Critical Section Turn 0/1 15 Dekkers algorithm Iglo (eskimoisk snehytte) 16 8
9 Dekkers algorithm There is a strict alternation rule. ME is guaranteed Consequences: 1. Execution is dictated by the slowest of the two. 2. If one is lost the other is blocked for ever. 17 Modification
10 Modification 1 Dictated by the slowest of the two. No guarantee of Mutual Exclusion: Because both can set there flags at the same time to true after one process reached at the end and setting others flag to false, so at that point both flags becomes false so now there is a chance to set both flags totrue(meaning both can enter in their critical section). 19 Modification 2 Own Flag is set outside the while loop & then checking others Flag Dictated by the slowest of the two. Guarantee Mutual Exclusion. Deadlock, if both has set the Flag to True at the same instant 20 10
11 Modification 3 Own Flag is set outside the while loop, then checking others Flag & resetting its own flag & introducing Delay Dictated by the slowest of the two Guarantee Mutual Exclusion Deadlock? Almost there 21 Correct Solution As we have observed that knowing the state of other processes is not enough to make our problem workable, basically one needs an order the way processes proceeds
12 Correct Solution 23 Correct Solution Dictated by the slowest of the two. Guarantee Mutual Exclusion. No Deadlock
13 Peterson s Solution Peterson s solution is similar but more elegant as the text says: 25 Hardware Mutual Exclusion Mutual exclusion can also be implemented in Hardware by using either interrupt handling or through special machine instructions: Interrupt Disabling: Just before entering the critical region, forcing interrupt disabling will ensure ME: Potentially system performance is degraded. No support for multi-processor system architecture
14 Machine Instruction 1. Basically two actions are performed in one cycle for these type of instruction atomically, for example, reading and writing. 2. Therefore, one can use them as they cannot be interrupted during these actions. 27 Machine Instruction Test and Set Instruction Boolean testset (int a) { if (a == 0) a = 1; return true; else return false; } 28 14
15 Machine Instruction Exchange Instruction Exchanges the contents of a register with a memory location, obviously during this, access to the memory location is blocked. void exchange (int register, memory) { int temp; temp = memory; memory = register; register = temp; } 29 Testset for ME n number of processes bolt Shared variable (int) Function_ME (process) { while true { while { (!testset (bolt)) be happy and do nothing } Enter Critical Section set bolt to 0; do remaining part } } Initially bolt is set to 0, any process finding it zero will enter into the critical section, obviously all others will go into be happy loop. Once that process leaves its critical section any other process finding bolt zero will immediately go into its critical section and so on
16 Exchange for ME n number of processes bolt Shared variable (int) Function_ME (process) { key local variable (int) while true { key = 1; while { (key!= 0) exchange (key, bolt); be happy until you get bolt zero } Enter Critical Section exchange (key, bolt); do remaining gpart } } Initially bolt is set to 0, any process finding it zero will enter into the critical section, but this time it will be through the local variable key and the bolt exchange mechanism of the exchange instruction. After completing its job, bolt is again set to 0 through the exchange instruction. 31 Plus/Minus of Machine Instruction 1. Easy to implement 2. Support for any number of processors 3. Multiple Critical section support (By using different variables) 1. Busy waiting (performance degradation) 2. Starvation is possible 3. Deadlock is possible 32 16
17 Semaphores Design of an o/s as sequential processes with a reliable mechanism of support for cooperation. Dijkstra proposed a solution based on the fundamental principle of cooperation based on signals, so that a process can be forced to stop at a required place and later starts when instructed through a signal. These signals are called semaphores, to transmit a signal the process executes signal (s) and to receive a signal it executes wait (s). Therefore, if the corresponding signals are not transmitted the process is suspended till the transmission takes place. 33 Properties of Semaphores It is initialized to a non negative value. Wait operation decrements semaphore value, if it goes negative the corresponding process is blocked. Signal operation increments semaphore value, if the value is not positive, process can be unblocked from the suspended list. Signal and Wait are atomic
18 Semaphore Primitives Semaphore could be declared as a simple structure having a variable declaration, may be an integer for count and another variable/structure for a process queue. wait (s) i l( ) count = count - 1; if count < 0 put the process in queue block the process Critical Section (if count is zero) signal (s) count = count + 1; if count 0 get a process from the queue unblock the process and put it in ready queue The order of removal from the queue is not defined, FIFO etc., the only requirement is that no process should wait indefinitely in the queue. 35 Binary Semaphores waitb (s) if count == 1 count = 0; else put the process in queue block the process signalb (s) if queue is empty count = 1; else get a process from the queue put it in ready queue 36 18
19 Semaphore Mechanism (Strong s) Suspended List Process A s = 1 Semaphore Ready List C D B Suspended List Process C s = 0 Semaphore Ready List D B A Suspended List Process B s = 0 Semaphore Ready List A C D Suspended List B A C Process D s = -3 Semaphore Ready List Suspended List B Process D s = -1 Semaphore Ready List A C Suspended List B A Process D s = -2 Semaphore Ready List C Suspended List Process D s = 0 Semaphore Ready List B A C 37 ME Using Semaphores The following pseudo ops can be used for the mutual exclusion problem: There could be n processes Each process executes wait before entering to its critical section Positive value means it can enter into critical section If the value becomes negative, process is suspended Semaphore s = 1; n = number of processes ; Process () loop wait (s) critical section signal (s) remaining execution 38 19
20 ME Using Semaphores Lock A B C 1 0 Wait (lock) Normal Execution 0 B Wait (lock) 0 0 B C C signal (lock) Wait (lock) Blocked 0 1 signal (lock) Critical Section signal (lock) 39 Producer Consumer (Binary) Produce waitb(s) Inset n = n+1 If n == 1 signalb (delay) signalb (s) Critical Section First Time only waitb(delay) waitb(s) Take n = n - 1 signalb (s) consume If n == 0 waitb (delay) Correct Solution? 40 20
21 Possible Scenario Producer Consumer s n Delay waitb (s) n=n If n==1 then signalb (delay) signalb (s) waitb (delay) waitb (s) n=n signalb (s) waitb (s) n=n If n==1 then signalb (delay) signalb (s) If n==0 then waitb (delay) waitb (s) n=n signalb (s) If n==0 then waitb (delay) waitb (s) n=n signalb (s) Producer Consumer (Binary) Produce waitb(s) Inset n = n+1 If n = 1 SignalB (delay) signalb (s) Critical Section First Time only n = n - 1 waitb(delay) waitb(s) Take signalb (s) consume If m = 0 WaitB (delay) m = n Correct Solution 42 21
22 Producer Consumer (Bounded Buffer) Previously for this problem an infinite buffer was consider, now for realistic situations one has bounded buffer (BB) some thing like a circular buffer, therefore, it can be implemented in the following way: Producer: Consumer: Loop produce if ((in + 1)%n) == out {do nothing, remain here} put[in] in = (in + 1)%n Loop if (in == out) {do nothing, remain here} take[out] out = (out + 1)%n consume out in [1] [2] [3] [4] [5] [6] [n] Filled slots 43 22
Concurrency Principles
Concurrency Concurrency Principles Where is the problem Interleaving: Multi-programming: Management of multiple processes within a uniprocessor system, every system has this support, whether big, small
More informationConcurrency, Mutual Exclusion and Synchronization C H A P T E R 5
Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5 Multiple Processes OS design is concerned with the management of processes and threads: Multiprogramming Multiprocessing Distributed processing
More informationChapter 5 Concurrency: Mutual Exclusion and Synchronization
Operating Systems: Internals and Design Principles Chapter 5 Concurrency: Mutual Exclusion and Synchronization Seventh Edition By William Stallings Designing correct routines for controlling concurrent
More informationConcurrency: Mutual Exclusion and Synchronization. Concurrency
Concurrency: Mutual Exclusion and Synchronization Chapter 5 1 Concurrency Multiple applications Structured applications Operating system structure 2 1 Concurrency 3 Difficulties of Concurrency Sharing
More informationInterprocess Communication By: Kaushik Vaghani
Interprocess Communication By: Kaushik Vaghani Background Race Condition: A situation where several processes access and manipulate the same data concurrently and the outcome of execution depends on the
More informationChapter 6: Process Synchronization. Operating System Concepts 8 th Edition,
Chapter 6: Process Synchronization, Silberschatz, Galvin and Gagne 2009 Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores
More informationProcess Management And Synchronization
Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the
More informationIT 540 Operating Systems ECE519 Advanced Operating Systems
IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (5 th Week) (Advanced) Operating Systems 5. Concurrency: Mutual Exclusion and Synchronization 5. Outline Principles
More informationChapter 6: Synchronization. Operating System Concepts 8 th Edition,
Chapter 6: Synchronization, Silberschatz, Galvin and Gagne 2009 Outline Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization
More informationConcurrency. Chapter 5
Concurrency 1 Chapter 5 2 Concurrency Is a fundamental concept in operating system design Processes execute interleaved in time on a single processor Creates the illusion of simultaneous execution Benefits
More informationChapter 5 Concurrency: Mutual Exclusion. and. Synchronization. Operating Systems: Internals. and. Design Principles
Operating Systems: Internals and Design Principles Chapter 5 Concurrency: Mutual Exclusion and Synchronization Seventh Edition By William Stallings Designing correct routines for controlling concurrent
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS
More informationPROCESS SYNCHRONIZATION
PROCESS SYNCHRONIZATION Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization Monitors Synchronization
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 11 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel Feedback Queue: Q0, Q1,
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Chapter 6: Synchronization 6.1 Background 6.2 The Critical-Section Problem 6.3 Peterson s Solution 6.4 Synchronization Hardware 6.5 Mutex Locks 6.6 Semaphores 6.7 Classic
More informationWhat is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?
What is the Race Condition? And what is its solution? Race Condition: Where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular
More informationThe concept of concurrency is fundamental to all these areas.
Chapter 5 Concurrency(I) The central themes of OS are all concerned with the management of processes and threads: such as multiprogramming, multiprocessing, and distributed processing. The concept of concurrency
More informationConcurrency(I) Chapter 5
Chapter 5 Concurrency(I) The central themes of OS are all concerned with the management of processes and threads: such as multiprogramming, multiprocessing, and distributed processing. The concept of concurrency
More informationChapter 6: Synchronization. Chapter 6: Synchronization. 6.1 Background. Part Three - Process Coordination. Consumer. Producer. 6.
Part Three - Process Coordination Chapter 6: Synchronization 6.1 Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure
More informationProcess Synchronization
CSC 4103 - Operating Systems Spring 2007 Lecture - VI Process Synchronization Tevfik Koşar Louisiana State University February 6 th, 2007 1 Roadmap Process Synchronization The Critical-Section Problem
More informationChapter 5: Process Synchronization. Operating System Concepts 9 th Edition
Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks
More informationOperating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy
Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference
More informationDept. of CSE, York Univ. 1
EECS 3221.3 Operating System Fundamentals No.5 Process Synchronization(1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Background: cooperating processes with shared
More informationChapter 7: Process Synchronization!
Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Monitors 7.1 Background Concurrent access to shared
More informationModels of concurrency & synchronization algorithms
Models of concurrency & synchronization algorithms Lecture 3 of TDA383/DIT390 (Concurrent Programming) Carlo A. Furia Chalmers University of Technology University of Gothenburg SP3 2016/2017 Today s menu
More informationProcess Synchronization
Process Synchronization Chapter 6 2015 Prof. Amr El-Kadi Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure the orderly
More informationProcess/Thread Synchronization
CSE325 Principles of Operating Systems Process/Thread Synchronization David Duggan dduggan@sandia.gov February 14, 2013 Reading Assignment 7 Chapter 7 Deadlocks, due 2/21 2/14/13 CSE325: Synchronization
More informationProcess Synchronization
Process Synchronization Concurrent access to shared data may result in data inconsistency Multiple threads in a single process Maintaining data consistency requires mechanisms to ensure the orderly execution
More informationConcurrent Processes Rab Nawaz Jadoon
Concurrent Processes Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS Lahore Pakistan Operating System Concepts Concurrent Processes If more than one threads
More informationSYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018
SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T 2. 3. 8 A N D 2. 3. 1 0 S P R I N G 2018 INTER-PROCESS COMMUNICATION 1. How a process pass information to another process
More informationSynchronization Principles
Synchronization Principles Gordon College Stephen Brinton The Problem with Concurrency Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms
More informationMutual Exclusion and Synchronization
Mutual Exclusion and Synchronization Concurrency Defined Single processor multiprogramming system Interleaving of processes Multiprocessor systems Processes run in parallel on different processors Interleaving
More informationLast Class: Synchronization
Last Class: Synchronization Synchronization primitives are required to ensure that only one thread executes in a critical section at a time. Concurrent programs Low-level atomic operations (hardware) load/store
More informationUNIX Input/Output Buffering
UNIX Input/Output Buffering When a C/C++ program begins execution, the operating system environment is responsible for opening three files and providing file pointers to them: stdout standard output stderr
More informationCONCURRENCY:MUTUAL EXCLUSION AND SYNCHRONIZATION
M05_STAL6329_06_SE_C05.QXD 2/21/08 9:25 PM Page 205 CHAPTER CONCURRENCY:MUTUAL EXCLUSION AND SYNCHRONIZATION 5.1 Principles of Concurrency A Simple Example Race Condition Operating System Concerns Process
More informationDealing with Issues for Interprocess Communication
Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed
More informationChapters 5 and 6 Concurrency
Operating Systems: Internals and Design Principles, 6/E William Stallings Chapters 5 and 6 Concurrency Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Concurrency When several processes/threads
More informationProcess Coordination
Process Coordination Why is it needed? Processes may need to share data More than one process reading/writing the same data (a shared file, a database record, ) Output of one process being used by another
More informationChapter 5: Process Synchronization. Operating System Concepts Essentials 2 nd Edition
Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks
More informationProcess Synchronization: Semaphores. CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Process Synchronization: Semaphores CSSE 332 Operating Systems Rose-Hulman Institute of Technology Critical-section problem solution 1. Mutual Exclusion - If process Pi is executing in its critical section,
More informationCHAPTER 6: PROCESS SYNCHRONIZATION
CHAPTER 6: PROCESS SYNCHRONIZATION The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. TOPICS Background
More informationMidterm on next week Tuesday May 4. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 9
CS 361 Concurrent programming Drexel University Fall 2004 Lecture 9 Bruce Char and Vera Zaychik. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce
More informationGeneral Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:
F2007/Unit5/1 UNIT 5 OBJECTIVES General Objectives: To understand the process management in operating system Specific Objectives: At the end of the unit you should be able to: define program, process and
More informationBackground. The Critical-Section Problem Synchronisation Hardware Inefficient Spinning Semaphores Semaphore Examples Scheduling.
Background The Critical-Section Problem Background Race Conditions Solution Criteria to Critical-Section Problem Peterson s (Software) Solution Concurrent access to shared data may result in data inconsistency
More information! Why is synchronization needed? ! Synchronization Language/Definitions: ! How are locks implemented? Maria Hybinette, UGA
Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics! Why is synchronization needed?! Synchronization Language/Definitions:» What are race
More informationOperating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017
Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing
More informationChapter 6: Process [& Thread] Synchronization. CSCI [4 6] 730 Operating Systems. Why does cooperation require synchronization?
Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions:» What are race conditions?»
More informationMaximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait
Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation CPU
More informationProcess/Thread Synchronization
CSE325 Principles of Operating Systems Process/Thread Synchronization David Duggan dduggan@sandia.gov March 1, 2011 The image cannot be displayed. Your computer may not have enough memory to open the image,
More informationConcurrency. On multiprocessors, several threads can execute simultaneously, one on each processor.
Synchronization 1 Concurrency On multiprocessors, several threads can execute simultaneously, one on each processor. On uniprocessors, only one thread executes at a time. However, because of preemption
More information2.c Concurrency Mutual exclusion & synchronization mutexes. Unbounded buffer, 1 producer, N consumers
Mutual exclusion & synchronization mutexes Unbounded buffer, 1 producer, N consumers out shared by all consumers mutex among consumers producer not concerned: can still add items to buffer at any time
More informationLecture Topics. Announcements. Today: Concurrency (Stallings, chapter , 5.7) Next: Exam #1. Self-Study Exercise #5. Project #3 (due 9/28)
Lecture Topics Today: Concurrency (Stallings, chapter 5.1-5.4, 5.7) Next: Exam #1 1 Announcements Self-Study Exercise #5 Project #3 (due 9/28) Project #4 (due 10/12) 2 Exam #1 Tuesday, 10/3 during lecture
More informationIV. Process Synchronisation
IV. Process Synchronisation Operating Systems Stefan Klinger Database & Information Systems Group University of Konstanz Summer Term 2009 Background Multiprogramming Multiple processes are executed asynchronously.
More informationSection I Section Real Time Systems. Processes. 1.4 Inter-Processes Communication (part 1)
EE206: Software Engineering IV 1.4 Inter-Processes Communication 1 page 1 of 16 Section I Section Real Time Systems. Processes 1.4 Inter-Processes Communication (part 1) Process interaction Processes often
More informationCS3502 OPERATING SYSTEMS
CS3502 OPERATING SYSTEMS Spring 2018 Synchronization Chapter 6 Synchronization The coordination of the activities of the processes Processes interfere with each other Processes compete for resources Processes
More informationConcurrency: a crash course
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Concurrency: a crash course Concurrent computing Applications designed as a collection of computational units that may execute
More informationProcess Synchronization
CS307 Process Synchronization Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 Background Concurrent access to shared data may result in data inconsistency
More informationTasks. Task Implementation and management
Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration
More information10/17/2011. Cooperating Processes. Synchronization 1. Example: Producer Consumer (3) Example
Cooperating Processes Synchronization 1 Chapter 6.1 4 processes share something (devices such as terminal, keyboard, mouse, etc., or data structures) and can affect each other non deterministic Not exactly
More informationSynchronization. Before We Begin. Synchronization. Credit/Debit Problem: Race Condition. CSE 120: Principles of Operating Systems.
CSE 120: Principles of Operating Systems Lecture 4 Synchronization January 23, 2006 Prof. Joe Pasquale Department of Computer Science and Engineering University of California, San Diego Before We Begin
More informationCSE Traditional Operating Systems deal with typical system software designed to be:
CSE 6431 Traditional Operating Systems deal with typical system software designed to be: general purpose running on single processor machines Advanced Operating Systems are designed for either a special
More informationIntroduction to Operating Systems
Introduction to Operating Systems Lecture 4: Process Synchronization MING GAO SE@ecnu (for course related communications) mgao@sei.ecnu.edu.cn Mar. 18, 2015 Outline 1 The synchronization problem 2 A roadmap
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L11 Synchronization Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel feedback queue:
More informationSynchronization. Before We Begin. Synchronization. Example of a Race Condition. CSE 120: Principles of Operating Systems. Lecture 4.
CSE 120: Principles of Operating Systems Lecture 4 Synchronization October 7, 2003 Before We Begin Read Chapter 7 (Process Synchronization) Programming Assignment #1 Due Sunday, October 19, midnight Prof.
More informationConcurrency: mutual exclusion and synchronization
Concurrency: mutual exclusion and synchronization Slides are mainly taken from «Operating Systems: Internals and Design Principles, 8/E William Stallings (Chapter 5). Sistemi di Calcolo (II semestre) Roberto
More informationChapter 5 Asynchronous Concurrent Execution
Chapter 5 Asynchronous Concurrent Execution Outline 5.1 Introduction 5.2 Mutual Exclusion 5.2.1 Java Multithreading Case Study 5.2.2 Critical Sections 5.2.3 Mutual Exclusion Primitives 5.3 Implementing
More informationLecture 3: Synchronization & Deadlocks
Lecture 3: Synchronization & Deadlocks Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating
More informationConcurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and Synchronization 1 Needs of Processes Allocation of processor time Allocation and sharing resources Communication among processes Synchronization of multiple processes
More informationProcess Synchronization. CISC3595, Spring 2015 Dr. Zhang
Process Synchronization CISC3595, Spring 2015 Dr. Zhang 1 Concurrency OS supports multi-programming In single-processor system, processes are interleaved in time In multiple-process system, processes execution
More informationCS420: Operating Systems. Process Synchronization
Process Synchronization James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background
More informationCSE 120: Principles of Operating Systems. Lecture 4. Synchronization. October 7, Prof. Joe Pasquale
CSE 120: Principles of Operating Systems Lecture 4 Synchronization October 7, 2003 Prof. Joe Pasquale Department of Computer Science and Engineering University of California, San Diego 2003 by Joseph Pasquale
More informationChapter 7: Process Synchronization. Background. Illustration
Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris
More informationSynchronization I. Jo, Heeseung
Synchronization I Jo, Heeseung Today's Topics Synchronization problem Locks 2 Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Also, to coordinate
More informationProcess Synchronisation (contd.) Deadlock. Operating Systems. Spring CS5212
Operating Systems Spring 2009-2010 Outline Process Synchronisation (contd.) 1 Process Synchronisation (contd.) 2 Announcements Presentations: will be held on last teaching week during lectures make a 20-minute
More informationIntroduction to OS Synchronization MOS 2.3
Introduction to OS Synchronization MOS 2.3 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Challenge How can we help processes synchronize with each other? E.g., how
More informationChapter 6: Process Synchronization. Module 6: Process Synchronization
Chapter 6: Process Synchronization Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization
More informationSynchronization. Race Condition. The Critical-Section Problem Solution. The Synchronization Problem. Typical Process P i. Peterson s Solution
Race Condition Synchronization CSCI 315 Operating Systems Design Department of Computer Science A race occurs when the correctness of a program depends on one thread reaching point x in its control flow
More informationConcurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules
Brief Preview of Scheduling Concurrency Control Nan Niu (nn@cs.toronto.edu) CSC309 -- Summer 2008 Multiple threads ready to run Some mechanism for switching between them Context switches Some policy for
More informationSemaphores. May 10, Mutual exclusion with shared variables is difficult (e.g. Dekker s solution).
Semaphores May 10, 2000 1 Introduction Mutual exclusion with shared variables is difficult (e.g. Dekker s solution). Generalising to an arbitrary number of processes is also nontrivial (e.g. Lamport s
More informationLast Class: Deadlocks. Today
Last Class: Deadlocks Necessary conditions for deadlock: Mutual exclusion Hold and wait No preemption Circular wait Ways of handling deadlock Deadlock detection and recovery Deadlock prevention Deadlock
More informationRunning. Time out. Event wait. Schedule. Ready. Blocked. Event occurs
Processes ffl Process: an abstraction of a running program. ffl All runnable software is organized into a number of sequential processes. ffl Each process has its own flow of control(i.e. program counter,
More informationCSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.
CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon
More informationConcurrency. On multiprocessors, several threads can execute simultaneously, one on each processor.
Synchronization 1 Concurrency On multiprocessors, several threads can execute simultaneously, one on each processor. On uniprocessors, only one thread executes at a time. However, because of preemption
More informationProcess Synchronization
Chapter 7 Process Synchronization 1 Chapter s Content Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors 2 Background
More informationG52CON: Concepts of Concurrency
G52CON: Concepts of Concurrency Lecture 11: Semaphores I" Brian Logan School of Computer Science bsl@cs.nott.ac.uk Outline of this lecture" problems with Peterson s algorithm semaphores implementing semaphores
More informationDeadlock and Monitors. CS439: Principles of Computer Systems February 7, 2018
Deadlock and Monitors CS439: Principles of Computer Systems February 7, 2018 Last Time Terminology Safety and liveness Atomic Instructions, Synchronization, Mutual Exclusion, Critical Sections Synchronization
More informationOperating Systems Comprehensive Exam. Spring Student ID # 3/16/2006
Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select
More informationResource management. Real-Time Systems. Resource management. Resource management
Real-Time Systems Specification Implementation Verification Mutual exclusion is a general problem that exists at several levels in a real-time system. Shared resources internal to the the run-time system:
More informationMS Windows Concurrency Mechanisms Prepared By SUFIAN MUSSQAA AL-MAJMAIE
MS Windows Concurrency Mechanisms Prepared By SUFIAN MUSSQAA AL-MAJMAIE 163103058 April 2017 Basic of Concurrency In multiple processor system, it is possible not only to interleave processes/threads but
More informationLesson 6: Process Synchronization
Lesson 6: Process Synchronization Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks Semaphores Classic Problems of Synchronization
More informationCOMP 3430 Robert Guderian
Operating Systems COMP 3430 Robert Guderian file:///users/robg/dropbox/teaching/3430-2018/slides/06_concurrency/index.html?print-pdf#/ 1/76 1 Concurrency file:///users/robg/dropbox/teaching/3430-2018/slides/06_concurrency/index.html?print-pdf#/
More informationSynchronization. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han
Synchronization CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han Announcements HW #3 is coming, due Friday Feb. 25, a week+ from now PA #2 is coming, assigned about next Tuesday Midterm is tentatively
More informationCSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable)
CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable) Past & Present Have looked at two constraints: Mutual exclusion constraint between two events is a requirement that
More informationCS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019
CS 31: Introduction to Computer Systems 22-23: Threads & Synchronization April 16-18, 2019 Making Programs Run Faster We all like how fast computers are In the old days (1980 s - 2005): Algorithm too slow?
More informationLecture 6. Process Synchronization
Lecture 6 Process Synchronization 1 Lecture Contents 1. Principles of Concurrency 2. Hardware Support 3. Semaphores 4. Monitors 5. Readers/Writers Problem 2 1. Principles of Concurrency OS design issue
More informationModule 6: Process Synchronization
Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization Monitors Synchronization Examples Atomic
More informationProcess Synchronization(2)
CSE 3221.3 Operating System Fundamentals No.6 Process Synchronization(2) Prof. Hui Jiang Dept of Computer Science and Engineering York University Semaphores Problems with the software solutions. Not easy
More informationProcess Synchronization
TDDI04 Concurrent Programming, Operating Systems, and Real-time Operating Systems Process Synchronization [SGG7] Chapter 6 Copyright Notice: The lecture notes are mainly based on Silberschatz s, Galvin
More informationLast Class: Synchronization. Review. Semaphores. Today: Semaphores. MLFQ CPU scheduler. What is test & set?
Last Class: Synchronization Review Synchronization Mutual exclusion Critical sections Example: Too Much Milk Locks Synchronization primitives are required to ensure that only one thread executes in a critical
More informationRemaining Contemplation Questions
Process Synchronisation Remaining Contemplation Questions 1. The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, P0 and
More information