Ernest Cachia University of Malta “Designing Concurrency” Slide No. 1 - Title Slide Ernest Cachia CSA404 Designing Concurrency Software Engineering issues.

Slides:



Advertisements
Similar presentations
Operating Systems Part III: Process Management (Process Synchronization)
Advertisements

Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Ernest Cachia University of Malta “Designing Concurrency” Slide No. 1 of part 2 Problem with single flag method  A small but definite time interval exists.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
Background Concurrent access to shared data can lead to inconsistencies Maintaining data consistency among cooperating processes is critical What is wrong.
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.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
CH7 discussion-review Mahmoud Alhabbash. Q1 What is a Race Condition? How could we prevent that? – Race condition is the situation where several processes.
Concurrency.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
5.6 Semaphores Semaphores –Software construct that can be used to enforce mutual exclusion –Contains a protected variable Can be accessed only via wait.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Chapter 11: Distributed Processing Parallel programming Principles of parallel programming languages Concurrent execution –Programming constructs –Guarded.
Chapter 11 Operating Systems
02/17/2010CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 6: Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Module 6: Synchronization 6.1 Background 6.2 The Critical-Section.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
Real Time Operating System
Real-Time Software Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Interrupts Signal that causes the CPU to alter its normal flow on instruction execution ◦ frees CPU from waiting for events ◦ provides control for external.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Concurrency, Mutual Exclusion and Synchronization.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Real Time Systems Part 1. 2 Fadi’s HW 11 Solution line level source 1 #pragma CODE 2 #include // SFR declarations 3 extern unsigned char rd_buttons(void);
Ernest Cachia University of Malta “Real-Time System Development” Slide No. 1 of part 2 Schematic Task Execution Example time EABCDF (Deadline) Execution.
Ernest Cachia University of Malta “Real-Time System Development” Slide No. 1 of part 3 n What about jitter? To calculate jitter one should have data regarding.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Ernest Cachia University of Malta “Designing Concurrency” Slide No. 1 of part 3 Task Co-operation via Data Transfer Only  Definition (adapted to concurrency):
Real-time Software Design King Saud University College of Computer and Information Sciences Department of Computer Science Dr. S. HAMMAMI.
ECE291 Computer Engineering II Lecture 15 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
1 5-High-Performance Embedded Systems using Concurrent Process (cont.)
CE Operating Systems Lecture 8 Process Scheduling continued and an introduction to process synchronisation.
Big Picture Lab 4 Operating Systems C Andras Moritz
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion Mutexes, Semaphores.
Adding Concurrency to a Programming Language Peter A. Buhr and Glen Ditchfield USENIX C++ Technical Conference, Portland, Oregon, U. S. A., August 1992.
Process Synchronization
Background on the need for Synchronization
Process Synchronization
Lecture Topics: 11/1 Processes Process Management
Chapter 5: Process Synchronization
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
Multithreading Chapter 23.
Computer System Overview
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall /27/2018.
Topic 6 (Textbook - Chapter 5) Process Synchronization
Midterm review: closed book multiple choice chapters 1 to 9
Last Week Introduced operating systems Discussed the Kernel
Lecture 2 Part 2 Process Synchronization
Critical section problem
Grades.
Chapter 6: Process Synchronization
Computer Science & Engineering Electrical Engineering
- When you approach operating system concepts there might be several confusing terms that may look similar but in fact refer to different concepts:  multiprogramming, multiprocessing, multitasking,
Chapter 6: Synchronization Tools
Foundations and Definitions
Presentation transcript:

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 1 - Title Slide Ernest Cachia CSA404 Designing Concurrency Software Engineering issues with regards to the development of concurrent systems

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 2 of part 1 Placing concurrency  Very much associated with R-T systems  In high regard within control systems  Regarded with intimidation by many s/w developers  Should be reflected in all phases of s/w development - especially in the initial ones  A lot of scheduling theory (already covered) assumed concurrent tasks

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 3 of part 1 Some aspects of concurrent systems  Multitasking support  Scheduling concerns  Time responsiveness  Task priorities  Resource sharing  Task synchronisation

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 4 of part 1  Sequential (fixed) execution Ways of running concurrent tasks (1) Task 1Task 2Task 3 t2t2 t3t3 Task 1Task 2Task 3 t1t1 t2t2 t3t3 t1t1 … Pros: - Tasks are periodic with periods T 1 = T 2 = T 3 = t 1 + t 2 + t 3 - Easy to implement - No context switching (1 processor : 1 sequential “chunk”) - Easily visible control structure Cons: - Low time response control - Could lead to task execution failure

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 5 of part 1 Ways of running concurrent tasks (2)  Time sliced (shared) execution ? Task 1Task 2Task 3Task 1Task 2Task 3 …  3 11 AB C

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 6 of part 1 Ways of running concurrent tasks (3)  Software supported multitasking Run-time software support Task 1 Terminator 1 Terminator i  Terminator i+1 Terminator n  Task 2 Terminator 1 Terminator i  Terminator i+1 Terminator n 

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 7 of part 1 The functions of run-time support software  Basic functions: u Create new tasks (define a task within system framework) u Task activation (make a task “runnable”) u Task management (manage task states)  Task states: u Running (currently executing) u Waiting (waiting for its turn to run) u Suspended (waiting to be ready) u Terminated (ended normally or abnormally)

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 8 of part 1 Ways of running concurrent tasks (4)  Using co-routines (see Modula2 / 3 programming language) u Better mimic the concept of time sliced execution u No master-slave assumptions (as in normal sub- routines) u Once started it need not necessarily terminate before relinquishing control to it’s original caller Co-routine 1 (main) Co-routine 2 transfer to co2 transfer to co1start co1transfer to co2transfer to co1 suspendedsusp. suspended susp. … …

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 9 of part 1 Ways of running concurrent tasks (5)  Task scheduler (control over when tasks are made active) Task scheduler Task 1     Task 2     enable/disable signal System timer System timer

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 10 of part 1 Ways of running concurrent tasks (6)  Task prioritisation This topic was covered in the Real-Time part of this course. No further discussion will be undertaken at this point.

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 11 of part 1 Ways of running concurrent tasks (7)  Using interrupts to control tasks (earliest form of scheduling)  In limited memory capacity systems  In very fast (response) systems Task 1 Task 2 Ext. interrupt 1 Ext. interrupt 2 Task 3 Ext. signal Int. timer Task 4 Ext. signal 1 Ext. signal 2 Some cons of such systems: Only interrupt driven tasks Awareness of interrupt organisation Awareness of the hard- ware system which is to host it.

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 12 of part 1 Co-operation between concurrent tasks  The main problems arising from task co-operation: u Mutual exclusion problem This implies task requirement for exclusive usage of a resource shared by other tasks (common resource) u Task synchronisation problem This arises from the fact that independent tasks are not necessarily non-co-operating tasks. If tasks co-operate in any way, then they require some form of synchronisation u The producer/consumer problem This problem relates to the passage (communication) of data between tasks. Data sent is “produced” while data received is “consumed”.

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 13 of part 1 The mutual exclusion problem  Imagine 2 processes having to write the word “hello” (indefinitely) to a screen. Assume that the one writes the string “he” and the other writes the string “llo”. PN markings: p1: String “he” available; p2: String “llo” available; p3: String “he” displayed; p4: String “llo” displayed. Transition functions: t1: Display “he”; t2: Display “llo”; t3: Compute “he”; t4: Compute “llo”. Process 1Process 2

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 14 of part 1 Solutions to the mutual exclusion problem  Single flag method u Method by which critical areas (i.e. parts of code accessing shared resources) is signalled by a simple indicator (flag). Flag up means in use, flag down - free.  Use of the priority ceiling protocol u This is the same as was explained in the R-T part of this course. Please refer to that material.  Use of semaphores (both of binary and counting semaphores)  Basically, a protected variable with 2 associated operations - wait and signal (usually called P and V)

Ernest Cachia University of Malta “Designing Concurrency” Slide No. 15 of part 1 The single flag method  Very easily implemented and understood (straightforward) Task 1 Task 2 flag down = 0 … … … Resource 1 flag up = 1