Basic of Parallel Programming Library Subroutine : library functions that support parallelism New Constructs : language is extended to support parallelism.

Slides:



Advertisements
Similar presentations
Chapter 4 Threads Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Advertisements

Chapter 5 Processes and Threads Copyright © 2008.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
Introduction in algorithms and applications Introduction in algorithms and applications Parallel machines and architectures Parallel machines and architectures.
Process Description and Control
Computer Science Lecture 6, page 1 CS677: Distributed OS Processes and Threads Processes and their scheduling Multiprocessor scheduling Threads Distributed.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Threads CSCI 444/544 Operating Systems Fall 2008.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Inter-Process Communication  most OSs provide several abstractions for inter- process communication: message passing, shared memory, etc.  communication.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Threads Chapter 4. Modern Process & Thread –Process is an infrastructure in which execution takes place  (address space + resources) –Thread is a program.
Introduction to Parallel Processing 3.1 Basic concepts 3.2 Types and levels of parallelism 3.3 Classification of parallel architecture 3.4 Basic parallel.
Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.
Computer Architecture Parallel Processing
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
Software Architecture Classification for Estimating the Costs of COTS Integration Yakimovich, Bieman, Basili; icse 99.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
Threads, Thread management & Resource Management.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 3 Parallel Programming Models. Abstraction Machine Level – Looks at hardware, OS, buffers Architectural models – Looks at interconnection network,
B. RAMAMURTHY 10/24/ Realizing Concurrency using the thread model.
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Threads G.Anuradha (Reference : William Stallings)
CE Operating Systems Lecture 10 Processes and process management in Linux.
CSC 360- Instructor: K. Wu Processes. CSC 360- Instructor: K. Wu Agenda 1.What is a process? 2.Process states 3. PCB 4.Context switching 5.Process scheduling.
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
Processes Introduction to Operating Systems: Module 3.
CS333 Intro to Operating Systems Jonathan Walpole.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
CS 838: Pervasive Parallelism Introduction to pthreads Copyright 2005 Mark D. Hill University of Wisconsin-Madison Slides are derived from online references.
Operating Systems: Internals and Design Principles
1 BİL 542 Parallel Computing. 2 Message Passing Chapter 2.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
CMSC 330: Organization of Programming Languages Threads.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
C H A P T E R E L E V E N Concurrent Programming Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
What is a Process ? A program in execution.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Chapter 4 – Thread Concepts
Chapter 4: Threads.
Processes and threads.
Process Management Process Concept Why only the global variables?
Processes and Threads Processes and their scheduling
Chapter 4 – Thread Concepts
CS399 New Beginnings Jonathan Walpole.
Computer Engg, IIT(BHU)
System Structure and Process Model
Threads Chapter 4.
Threads Chapter 4.
Process Description and Control
CHAPTER 4:THreads Bashair Al-harthi OPERATING SYSTEM
Process Description and Control
Process Description and Control
CS510 Operating System Foundations
Foundations and Definitions
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Basic of Parallel Programming Library Subroutine : library functions that support parallelism New Constructs : language is extended to support parallelism Compiler Directives : formatted comment identified parallel code

Process and Thread Process is an entity with 3 components: –Program –Status –State Control state Data state Thread is a light weight process

Process Status ReadyRunning NonexistentSuspended schedule Preempt, Timeout Wake up Create Terminate Suspend

Address Space A new address space is created with a new process Threads share the same address space Code Segment Data Segment Stack Process Descriptor User spaceKernel space

Process Scheduling Mode Dedicated Mode : Not share Batch : Run to completion Time-Sharing : Interleaving Preemptive : Taking over

Component Processes MPMD –Multiple-program-multiple-data SPMD –Single-Program-multiple-data Run A on node 1 Run B on node 2 Run C on node 3 pid = MyProcessID() if (pid ==1) Run A if (pid == 2) Run B if (pid == 3) Run C

Dynamic vs. Static Dynamic parallelism –More flexible –Processes are created during run-time –Ex While(c>0) { fork(foo(c)); c = boo(c); } Static parallelism –Number of process is pre-determined. –Less run-time overhead –More efficient binary code

fork and join Process A begin fork(B) x = foo(z) join(B) Output(x+y) end Process B begin y = boo(z) end

Interaction between Processes Communication –Shared variable –Parameter passing –Message passing Synchronization –Atomicity –Control Synchronization –Data Synchronization Aggregation

Interaction Mode Interaction Code P1P2Pn Asynchronous Vs. Synchronous Blocking Vs. Non-Blocking

Problems in Concurrency Lost Update Problem Process 1Process 2 Read(A) A = A+mRead(B) Write(A)A=A+B Write(A)

Problems in Concurrency Temporary Update Problem –When a process update data and then fail, another process should not see the updated value

Problems in Concurrency Incorrect Summary Problem Process1Process2 Data A, B, C in x Count = the number of items in x Write(new item D in x) Read(x) Sum(x) // (A+B+C+D) Ave = sum/count ‘Ave’ value will be incorrect from this example.

Concurrency Control Locking Timestamp Optimistic concurrency control (OCC)