Concurrent Programming

Size: px
Start display at page:

Download "Concurrent Programming"

Transcription

1 University of Applied Sciences Fulda Department of Applied Computer Sciences Prof. Dr. Siegmar Groß Fachhochschule Fulda Fachbereich Angewandte Informatik Concurrent Programming Process Virtual Address Space Resources open files locks sockets. main () count () Text Identity pid uid gid. prt_result () Data Heap main Thread Specific Data thread id priority Thread Specific Data thread id priority Registers PC SP Thread 1 Registers PC SP Thread 2 Registers PC SP Stack Stack Stack S. R. Groß, Fulda, 2000

2 Concurrent Programming Slide 1 how can we achieve high-performance computing? new processors and memories with higher and even higher clock rates multiprocessor machines supercomputers with vector units supercomputers with massively parallel processors (MPP; machines with some 100 up to some 1000 processors) (heterogeneous) workstation networks for distributed computing (so-called virtual machines or workstation clusters) very cheap compared to supercomputers, if you can use existing workstation networks (e.g., most workstations are idle at night) you can increase the computing power in a simple way you can add vector processors and parallel machines to your virtual machine if you need them the programming task is sometimes supported by special compilers which automatically vectorize or parallelize sequential programs how can parallel processes communicate with each other? using shared memory using message-passing

3 Concurrent Programming Slide 2 some characteristics of a virtual machine usually it consists of machines of different manufacturers usually heterogeneous machines are based on different proccessor architectures (from PC's via various workstations up to supercomputers different binary formats) usually heterogeneous machines use different data formats (big endian, little endian, floating point representation, ) usually the machines have different load usually the machines are connected to different networks (Ethernet, Fast-Ethernet, ATM, ) usually the performance of a virtual machine depends on the load of the networks each program must be compiled on each different machine all data transfers must be done using a standard interface (e.g., each message must be coded on the sender site from the internal format of the machine to a network format and decoded on the receiver site vice versa) the programmer must take care of the performance and load of the machines (high-speed computers shouldn't wait for results of slow ones) depending on the load of the machines and the network, the performance of a virtual machine may vary very strongly

4 Concurrent Programming Slide 3 influences on the performance of a multiprocessor system the scheduling scheduler attempts to keep each process/thread on the same processor (known as processor affinity, processor binding) scheduler doesn't attempt to keep each process/thread on the same processor cache must be reloaded (at least the L1 cache) the processor cache sharing a single L2 cache can result in contention for the cache possibly decreased performance when executing multiple independent sequential programs (after each context switch the cache possibly contains the "wrong" data) possibly increased performance when executing parallel programs (if many processes want to access the same "line" in shared memory, only one had to fill the cache line and the others can immediately access the data) scheduling without processor affinity isn't that harmful

5 Concurrent Programming Slide 4 independent L2 caches main memory cache line cache cache cache line tag processor 1 cache line tag processor 2 each processor uses its own 2nd level cache possibly increased performance when executing multiple independent sequential programs possibly decreased performance when executing parallel programs (if one process modifies a cache line it must be invalidated or reloaded in any other cache which stores the same line known as false sharing) lack of processor affinity leads to reloading of caches increasing bus contention

6 Concurrent Programming Slide 5 organizing parallel processes / threads Master / Slave what should the master do? initializes the system generates all necessary processes/threads (static or dynamically depending on the task) provides the slaves with work collects the results and prints / stores them (depending on the task) perhaps synchronizes the work of the slaves what should all slaves do? perform the real work receive their work from the master (static or dynamically depending on their progress) provide themselves with work (e.g., from a work-pool) sometimes the number of active threads isn't predictable thus leading to decreasing performance if all slaves fight for the same resources (e.g., if an internet server creates a slave for each request) examples internet servers parallel multiplication of matrices

7 Concurrent Programming Slide 6 Workpile (work queue, producer / consumer) some processes/threads place orders into a queue other processes/threads take orders from the queue and carry them out there is a fixed number of processes/threads peak loads are handled through the queue if there is high load over a long time orders must be refused to prevent that the queue grows too big example: computation of a Mandelbrot set tree computation processes/threads are created dynamically in a tree-like structure depending on the progress of the computation especially appropriated if the workload isn't well-known in the beginning (e.g., Branch-and-Bound or Divide-and-Conquer-algorithms) example: Quicksort

8 Concurrent Programming Slide 7 workload allocation data decomposition, data parallelism identical processes/threads work on different data areas (Single-Program-Multiple-Data, SPMD) static or dynamic distribution of the work (using a virtual machine distributing the work dynamically usually performs best, because the different workloads of the machines and networks and different performances of the machines can be compensated) examples computing a Mandelbrot set adding two n-dimensional vectors (using p processes/threads each one performing n/p additions) function decomposition, function parallelism different processes/threads are doing different operations on the same data-stream (Multiple-Program-Single-Data, MPSD) example: graphics-pipeline

9 Concurrent Programming Slide 8 a combination of the above methods different processes/threads are doing different operations where some operations are performed in parallel on different data areas (Multiple-Program-Multiple-Data, MPMD) process granularity coarse-grained large number of sequential instructions takes a substantial time to execute fine-grained very few sequential instructions only a small amount of time to execute granularity is often defined as the size of computation between communication or synchronization points coarse granularity reduces the proportional costs of process creation and interprocess communication fine granularity possibly increases the number of concurrent processes using message passing it must be guaranteed that the communication time doesn't dominate the overall execution time

10 Concurrent Programming Slide 9 which speed-up is possible? maximum speed-up with n processors is n (linear speed-up) some limiting factors some parts of a computation can't be executed in parallel some organizational tasks must be executed sequentially (initializing the system, setting up parallel processes, etc.) communication time for sending/receiving messages time to synchronize the parallel computation extra computations in the parallel version, e.g., recomputing values locally assume that all serial parts are combined at the beginning and that all other parts can be executed in parallel with no overhead (f is the fraction which can't be executed in parallel) f t s t s (1 - f) t s 1 processor serial code parallel code n processors f t s t p (1 - f) t s / n

11 Concurrent Programming Slide 10 speed-up factor S( n) = ts n = ft + ( 1 f ) t / n 1+ ( n 1 ) f s s equation is known as Amdahl's law speed-up is limited to S( n) = 1 f n (with 5% serial and 95% parallel computation the maximum speed-up is 20) Amdahl's law represents the result for a problem with fixed size solved with an increasing number of processors to reduce the computation time Gustafson had stated that a larger multiprocessor systems usually allows a larger size of the problem to be solved the size of the problem will be scaled so that the parallel execution time is fixed the serial part of the code will generally not increase in the same way as the problem size

12 Concurrent Programming Slide 11 Gustafson's scaled speed-up factor S n s( ) let s be the time to execute the serial part and p the time for executing the parallel part of the computation execution time on a parallel computer with n processors: s + p (the total execution time is fixed; for algebraic convenience: s + p = 1) execution time on a serial computer: s + n p (all parallel parts must be executed sequentially) s np Ss ( n) = + s + p s n( s) + 1 s + 1 s s+ p=1 = n + ( 1 n) s (with Amdahl's law the speed-up factor for a parallel computer with 32 processors and 5% serial code is and with Gustafson's law the scaled speed-up factor is 30.45) Gustafson's law seems more appropriate because today's intention is to solve more complex problems in a fixed time

13 Concurrent Programming Slide 12 structure of a process Process Virtual Address Space Resources open files locks sockets. main () count () count () Text Identity pid uid gid. prt_result () global_cnt s_time Data Heap Registers PC SP j i p_cnt return address from count () Stack

14 Concurrent Programming Slide 13 using parallel processes to increase a local and a global variable Parent Process Virtual Address Space Child Process Virtual Address Space Resources main () Text Resources main () Text fork () fork () Identity count () Identity count () pid=238 prt_result () pid=240 prt_result () Data Data Registers PC SP Heap Stack Registers PC SP Heap Stack for (i = 0; i < NUM_CLD; ++i) fork_pid [i] = fork (); /* create child process */ switch (fork_pid [i]) case -1: fprintf (stderr, "line %d: \"fork ()\" failed: %s\n", LINE, strerror (errno)); exit (-1); break; case 0: /* child process */ count (&(shm_addr->cnt [i])); /* local variable as parameter */ exit (0); /* nothing more to do */ /* wait for all child processes and print result */ for (i = 0; i < NUM_CLD; ++i) if (waitpid (fork_pid [i], NULL, 0) == (pid_t) -1) fprintf (stderr, "line %d: \"waitpid ()\" failed: %s\n", LINE, strerror (errno));

15 Concurrent Programming Slide 14 coarse-grained locking void count (long *p_cnt) #ifdef USE_SEM /* coarse-grained locking results in better performance, but leads * to sequential execution, because the whole work is protected. */ ret = semop (sem_id, &p, (size_t) 1); for (i = 0; i < MAX_OUT_LOOP; ++i) printf ("Process %ld is counting \n", (long) getpid ()); for (j = 0; j < MAX_IN_LOOP; ++j) (*p_cnt)++; (shm_addr->global_cnt)++; ret = semop (sem_id, &v, (size_t) 1); #else #endif fine-grained locking void count (long *p_cnt) for (i = 0; i < MAX_OUT_LOOP; ++i) printf ("Process %ld is counting \n", (long) getpid ()); for (j = 0; j < MAX_IN_LOOP; ++j) #ifdef USE_SEM /* fine-grained locking results in poor performance, because the * execution time for "semop" is much larger than that for the * increment-operations and the function doesn't do anything else. */ ret = semop (sem_id, &p, (size_t) 1); (*p_cnt)++; (shm_addr->global_cnt)++; ret = semop (sem_id, &v, (size_t) 1); #else #endif } the program isn't suited for parallel programming

16 Concurrent Programming Slide 15 using threads Process Virtual Address Space Resources open files locks sockets. main () count () Text Identity pid uid gid. prt_result () Data Heap main Thread Specific Data Registers PC SP Thread 1 Registers Stack thread id priority Thread Specific Data thread id priority PC SP Thread 2 Registers PC SP Stack Stack

17 Concurrent Programming Slide 16 there are many different thread interfaces UNIX International threads (SunOS) C threads (Mach) DCE threads (Open Software Foundation, draft 4 of pthreads) pthreads (POSIX c-1995) Windows NT threads OS/2 threads each thread is a different stream of control that can execute its instructions independently, allowing a multithreaded process to perform numerous tasks concurrently or in parallel each thread has its own set of CPU registers, especially its own program counter and its own stack pointer threads can be executed independently from each other all threads use the same virtual address space and other resources of the surrounding process if a thread changes shared data, all threads "see" the changes if a thread calls exit (), all threads and the whole process will finish if a thread opens a file another thread can read from or write to the file (they can interfere with each other when the program isn't implemented carefully)

18 Concurrent Programming Slide 17 using POSIX threads #define _REENTRANT /* must precede any "#include"! */ #define _POSIX_C_SOURCE L /* standard: June 1995 */ #include <pthread.h> int main (void) pthread_attr_t attr; /* attributes for new threads */ pthread_mutex_t LockCnt; } ret = pthread_mutex_init (&LockCnt, NULL); ret = pthread_attr_init (&attr); ret = pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_JOINABLE); #ifdef BOUNDED ret = pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); #endif /* create concurrent threads for counting */ for (i = 0; i < NUM_THR; ++i) ret = pthread_create (&thr_id [i], &attr, (void *(*) (void *)) count, &cnt [i]); /* wait for all threads and print result */ for (i = 0; i < NUM_THR; ++i) ret = pthread_join (thr_id [i], NULL); /* clean up all things */ ret = pthread_attr_destroy (&attr); #ifdef USE_MTX ret = pthread_mutex_destroy (&LockCnt); #endif return 0; void count (long *p_cnt) for (i = 0; i < MAX_OUT_LOOP; ++i) printf ("Process %ld: Thread %ld is counting \n", ); for (j = 0; j < MAX_IN_LOOP; ++j) #ifdef USE_MTX ret = pthread_mutex_lock (&LockCnt); (*p_cnt)++; global_cnt++; ret = pthread_mutex_unlock (&LockCnt); #else #endif }

19 Concurrent Programming Slide 18 summary (all times in seconds) Pentium, 200 MHz, Linux R5000, 180 MHz, IRIX Ultra-1, 143 MHz, SunOS SPARCstation 20, 50 MHz, 2 CPUs, SunOS sequential process parallel processes user-level threads kernel-level threads 7 not allowed why are threads faster than parallel processes? a process mainly consists of the following parts: code (text) data stack file I/O signal tables hardware context (CPU registers, ) if a process forks a child only the code will be shared if a context switch between processes takes place, all the tables have to be exchanged

20 Concurrent Programming Slide 19 processes can share information only through pipes, shared memory, and other such expensive things (operating system intervention is needed) threads reduce this overhead by sharing fundamental parts share data share filesystem info share open files share signals share PID with parent (not available with LinuxThreads) switching happens much more frequently and efficiently sharing information is quite easy and can take place without operating system intervention threads are implemented differently separate process and thread tables with different schedulers (the solution of most multithreaded operating systems) what happens when a thread executes fork (), execve (), or something similar? a) the process with all threads will be replaced / duplicated? b) only the calling thread will be replaced /duplicated? (POSIX requires that a call to fork creates a process with a single thread. In a multithreaded process the new process shall contain a replica of the calling thread and its entire address space. POSIX requires that a call to any exec function shall result in all threads being terminated and the new executable image being loaded and executed.) one common process / thread table with one scheduler (e.g., the solution of LinuxThreads)

21 Concurrent Programming Slide 20 user-level threads are unknown to the kernel are fully managed in user-space (thread table, scheduling) don't consume kernel resources can typically switch faster than kernel-level threads are well suited for threads which are waiting almost all the time can't take advantage of more than one processor an I/O-blocking thread may block all other threads a compute-bounded thread may monopolize the timeslice thus starving the other threads within the process kernel-level threads are managed in kernel-space consume kernel resources (each process gets a table of threads or each thread needs an entry in the process table) can use all processors of a symmetric multiprocessor I/O-blocking isn't a problem because the kernel knows about the threads are less likely to hog a timeslice because the kernel schedules the threads, thus they are suited for compute-bounded threads

22 Concurrent Programming Slide 21 concurrent processes in distributed (heterogeneous) environments 1. you don't use NFS (different HOME-directories on each machine) compile your program on every machine 2. you are working in a homogeneous environment with NFS (one HOME-directory for all machines) compile your program on one machine 3. you are working in a heterogeneous environment with an NFS domain for every machine type (one HOME-directory for each machine type) compile your program once in every NFS domain 4. you are working in a heterogeneous environment with one NFS domain for all machines (one HOME-directory for all machines) compile your program once on every machine type take care that programs for different machine types are stored in different directories, e.g. in $HOME/$SYSTEM_ENV}/$MACHINE_ENV}/bin (SYSTEM_ENV: SunOS, Linux, ; MACHINE_ENV: sparc, x86, )

23 Concurrent Programming Slide 22 message passing interface (master/slave, this is the master) int main (int argc, char *argv []) int ntasks, /* number of parallel tasks */ mytid, /* my task id */ num, /* number of entries */ i; /* loop variable */ char buf [BUF_SIZE + 1]; /* message buffer (+1 for '\0') */ MPI_Status stat; /* message details */ } MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &mytid); MPI_Comm_size (MPI_COMM_WORLD, &ntasks); if (ntasks > MAX_TASKS) printf ("Error: Too many tasks. Try again with at most %d tasks.\n", MAX_TASKS); /* terminate all slave tasks */ for (i = 1; i < ntasks; ++i) MPI_Send ((char *) NULL, 0, MPI_CHAR, i, EXITTAG, MPI_COMM_WORLD); MPI_Finalize (); exit (ENTASKS); printf ("\n\nnow %d slave tasks are sending greetings.\n\n", ntasks - 1); /* request messages from slave tasks */ for (i = 1; i < ntasks; ++i) MPI_Send ((char *) NULL, 0, MPI_CHAR, i, SENDTAG, MPI_COMM_WORLD); /* wait for messages and print greetings */ for (i = 1; i < ntasks; ++i) MPI_Recv (buf, BUF_SIZE, MPI_CHAR, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &stat); MPI_Get_count (&stat, MPI_CHAR, &num); buf [num] = '\0'; /* add missing end-of-string */ printf ("Greetings from task %d:\n" " message type:\t%d\n" " msg length:\t%d characters\n" " message:\t%s\n\n", stat.mpi_source, stat.mpi_tag, num, buf); /* terminate all slave tasks */ for (i = 1; i < ntasks; ++i) MPI_Send ((char *) NULL, 0, MPI_CHAR, i, EXITTAG, MPI_COMM_WORLD); MPI_Finalize (); return 0;

24 Concurrent Programming Slide 23 heterogeneous environments can have problems with incompatible data types operating system cc double gcc long double cc gcc IRIX, mips 8 bytes, 53 bit 8 bytes, 53 bit 16 bytes, 107 bit 8 bytes, 53 bit SunOS 7, Sparc 8 bytes, 53 bit 8 bytes, 53 bit 16 bytes, 113 bit 16 bytes, 113 bit SunOS 7, x86 8 bytes, 53 bit 8 bytes, 53 bit 12 bytes, 64 bit 12 bytes, 53 bit Linux, x86 8 bytes, 53 bit 12 bytes, 64 bit only double is suited for heterogeneous environments (computing π with MPI in a heterogeneous environment with long double delivers strange results: up to infinity)

Parallel Programming. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Parallel Programming. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Parallel Programming Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Challenges Difficult to write parallel programs Most programmers think sequentially

More information

THREADS. Jo, Heeseung

THREADS. Jo, Heeseung THREADS Jo, Heeseung TODAY'S TOPICS Why threads? Threading issues 2 PROCESSES Heavy-weight A process includes many things: - An address space (all the code and data pages) - OS resources (e.g., open files)

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 The Process Concept 2 The Process Concept Process a program in execution

More information

Introduction to the Message Passing Interface (MPI)

Introduction to the Message Passing Interface (MPI) Introduction to the Message Passing Interface (MPI) CPS343 Parallel and High Performance Computing Spring 2018 CPS343 (Parallel and HPC) Introduction to the Message Passing Interface (MPI) Spring 2018

More information

LSN 13 Linux Concurrency Mechanisms

LSN 13 Linux Concurrency Mechanisms LSN 13 Linux Concurrency Mechanisms ECT362 Operating Systems Department of Engineering Technology LSN 13 Creating Processes fork() system call Returns PID of the child process created The new process is

More information

Computer Systems Laboratory Sungkyunkwan University

Computer Systems Laboratory Sungkyunkwan University Threads Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics Why threads? Threading issues 2 Processes Heavy-weight A process includes

More information

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits CS307 What is a thread? Threads A thread is a basic unit of CPU utilization contains a thread ID, a program counter, a register set, and a stack shares with other threads belonging to the same process

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 4: Processes (2) Threads Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates and initializes a new PCB Creates

More information

POSIX threads CS 241. February 17, Copyright University of Illinois CS 241 Staff

POSIX threads CS 241. February 17, Copyright University of Illinois CS 241 Staff POSIX threads CS 241 February 17, 2012 Copyright University of Illinois CS 241 Staff 1 Recall: Why threads over processes? Creating a new process can be expensive Time A call into the operating system

More information

Processes and Threads

Processes and Threads TDDI04 Concurrent Programming, Operating Systems, and Real-time Operating Systems Processes and Threads [SGG7] Chapters 3 and 4 Copyright Notice: The lecture notes are mainly based on Silberschatz s, Galvin

More information

Lecture 4 Threads. (chapter 4)

Lecture 4 Threads. (chapter 4) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 4 Threads (chapter 4) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The slides here are adapted/modified

More information

CPSC 341 OS & Networks. Threads. Dr. Yingwu Zhu

CPSC 341 OS & Networks. Threads. Dr. Yingwu Zhu CPSC 341 OS & Networks Threads Dr. Yingwu Zhu Processes Recall that a process includes many things An address space (defining all the code and data pages) OS resources (e.g., open files) and accounting

More information

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole The Process Concept 2 The Process Concept Process a program in execution Program - description of how to perform an activity instructions and static

More information

Threads. To do. Why threads? Thread model & implementation. q q q. q Next time: Synchronization

Threads. To do. Why threads? Thread model & implementation. q q q. q Next time: Synchronization Threads To do q q q Why threads? Thread model & implementation q Next time: Synchronization What s in a process A process consists of (at least): An address space Code and data for the running program

More information

Programming with Shared Memory. Nguyễn Quang Hùng

Programming with Shared Memory. Nguyễn Quang Hùng Programming with Shared Memory Nguyễn Quang Hùng Outline Introduction Shared memory multiprocessors Constructs for specifying parallelism Creating concurrent processes Threads Sharing data Creating shared

More information

CS 3305 Intro to Threads. Lecture 6

CS 3305 Intro to Threads. Lecture 6 CS 3305 Intro to Threads Lecture 6 Introduction Multiple applications run concurrently! This means that there are multiple processes running on a computer Introduction Applications often need to perform

More information

Threads. Today. Next time. Why threads? Thread model & implementation. CPU Scheduling

Threads. Today. Next time. Why threads? Thread model & implementation. CPU Scheduling Threads Today Why threads? Thread model & implementation Next time CPU Scheduling What s in a process A process consists of (at least): An address space Code and data for the running program Thread state

More information

Introduction to PThreads and Basic Synchronization

Introduction to PThreads and Basic Synchronization Introduction to PThreads and Basic Synchronization Michael Jantz, Dr. Prasad Kulkarni Dr. Douglas Niehaus EECS 678 Pthreads Introduction Lab 1 Introduction In this lab, we will learn about some basic synchronization

More information

Threads. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Threads. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University Threads Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) Concurrency

More information

Thread Concept. Thread. No. 3. Multiple single-threaded Process. One single-threaded Process. Process vs. Thread. One multi-threaded Process

Thread Concept. Thread. No. 3. Multiple single-threaded Process. One single-threaded Process. Process vs. Thread. One multi-threaded Process EECS 3221 Operating System Fundamentals What is thread? Thread Concept No. 3 Thread Difference between a process and a thread Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

More information

CSCE 313: Intro to Computer Systems

CSCE 313: Intro to Computer Systems CSCE 313 Introduction to Computer Systems Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce313/ Programs, Processes, and Threads Programs and Processes Threads 1 Programs, Processes, and

More information

EPL372 Lab Exercise 2: Threads and pthreads. Εργαστήριο 2. Πέτρος Παναγή

EPL372 Lab Exercise 2: Threads and pthreads. Εργαστήριο 2. Πέτρος Παναγή EPL372 Lab Exercise 2: Threads and pthreads Εργαστήριο 2 Πέτρος Παναγή 1 Threads Vs Processes 2 Process A process is created by the operating system, and requires a fair amount of "overhead". Processes

More information

PRACE Autumn School Basic Programming Models

PRACE Autumn School Basic Programming Models PRACE Autumn School 2010 Basic Programming Models Basic Programming Models - Outline Introduction Key concepts Architectures Programming models Programming languages Compilers Operating system & libraries

More information

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song Programs, Processes, and Threads Programs and Processes Threads Programs, Processes, and Threads Programs and Processes Threads Processes

More information

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Processes in Unix, Linux, and Windows Unix pre-empted

More information

Programming with MPI on GridRS. Dr. Márcio Castro e Dr. Pedro Velho

Programming with MPI on GridRS. Dr. Márcio Castro e Dr. Pedro Velho Programming with MPI on GridRS Dr. Márcio Castro e Dr. Pedro Velho Science Research Challenges Some applications require tremendous computing power - Stress the limits of computing power and storage -

More information

4.8 Summary. Practice Exercises

4.8 Summary. Practice Exercises Practice Exercises 191 structures of the parent process. A new task is also created when the clone() system call is made. However, rather than copying all data structures, the new task points to the data

More information

Operating Systems, laboratory exercises. List 2.

Operating Systems, laboratory exercises. List 2. Operating Systems, laboratory exercises. List 2. Subject: Creating processes and threads with UNIX/Linux API functions. 1. Creating a process with UNIX API function. To create a new process from running

More information

Programming Scalable Systems with MPI. Clemens Grelck, University of Amsterdam

Programming Scalable Systems with MPI. Clemens Grelck, University of Amsterdam Clemens Grelck University of Amsterdam UvA / SurfSARA High Performance Computing and Big Data Course June 2014 Parallel Programming with Compiler Directives: OpenMP Message Passing Gentle Introduction

More information

Lecture 4: Memory Management & The Programming Interface

Lecture 4: Memory Management & The Programming Interface CS 422/522 Design & Implementation of Operating Systems Lecture 4: Memory Management & The Programming Interface Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken

More information

Multithreaded Programming

Multithreaded Programming Multithreaded Programming 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. September 4, 2014 Topics Overview

More information

Linux Programming

Linux Programming Linux Programming CMPT 433 Slides #6 Dr. B. Fraser 18-05-22 1 Topics 1) How can we do multitasking? 2) How can our multiple tasks communicate? 3) How can we communicate over the network? 18-05-22 2 Concurrency:

More information

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS3221.3 Operating System Fundamentals No.2 Process Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run

More information

Programming with MPI. Pedro Velho

Programming with MPI. Pedro Velho Programming with MPI Pedro Velho Science Research Challenges Some applications require tremendous computing power - Stress the limits of computing power and storage - Who might be interested in those applications?

More information

12:00 13:20, December 14 (Monday), 2009 # (even student id)

12:00 13:20, December 14 (Monday), 2009 # (even student id) Final Exam 12:00 13:20, December 14 (Monday), 2009 #330110 (odd student id) #330118 (even student id) Scope: Everything Closed-book exam Final exam scores will be posted in the lecture homepage 1 Parallel

More information

PCAP Assignment I. 1. A. Why is there a large performance gap between many-core GPUs and generalpurpose multicore CPUs. Discuss in detail.

PCAP Assignment I. 1. A. Why is there a large performance gap between many-core GPUs and generalpurpose multicore CPUs. Discuss in detail. PCAP Assignment I 1. A. Why is there a large performance gap between many-core GPUs and generalpurpose multicore CPUs. Discuss in detail. The multicore CPUs are designed to maximize the execution speed

More information

Introduction to Parallel and Distributed Systems - INZ0277Wcl 5 ECTS. Teacher: Jan Kwiatkowski, Office 201/15, D-2

Introduction to Parallel and Distributed Systems - INZ0277Wcl 5 ECTS. Teacher: Jan Kwiatkowski, Office 201/15, D-2 Introduction to Parallel and Distributed Systems - INZ0277Wcl 5 ECTS Teacher: Jan Kwiatkowski, Office 201/15, D-2 COMMUNICATION For questions, email to jan.kwiatkowski@pwr.edu.pl with 'Subject=your name.

More information

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No. EECS3221.3 Operating System Fundamentals No.2 Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run programs

More information

Quiz: Simple Sol Threading Model. Pthread: API and Examples Synchronization API of Pthread IPC. User, kernel and hardware. Pipe, mailbox,.

Quiz: Simple Sol Threading Model. Pthread: API and Examples Synchronization API of Pthread IPC. User, kernel and hardware. Pipe, mailbox,. CS341: Operating System Lect18 : 10 th Sept 2014 Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Quiz: Simple Sol Threading Model User, kernel and hardware Pthread: API

More information

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition,

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition, Chapter 3: Process-Concept, Silberschatz, Galvin and Gagne 2009 Chapter 3: Process-Concept Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Silberschatz, Galvin

More information

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication

More information

Computer Systems Laboratory Sungkyunkwan University

Computer Systems Laboratory Sungkyunkwan University Concurrent Programming Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Echo Server Revisited int main (int argc, char *argv[]) {... listenfd = socket(af_inet, SOCK_STREAM, 0); bzero((char

More information

CS333 Intro to Operating Systems. Jonathan Walpole

CS333 Intro to Operating Systems. Jonathan Walpole CS333 Intro to Operating Systems Jonathan Walpole Threads & Concurrency 2 Threads Processes have the following components: - an address space - a collection of operating system state - a CPU context or

More information

CS 326: Operating Systems. Process Execution. Lecture 5

CS 326: Operating Systems. Process Execution. Lecture 5 CS 326: Operating Systems Process Execution Lecture 5 Today s Schedule Process Creation Threads Limited Direct Execution Basic Scheduling 2/5/18 CS 326: Operating Systems 2 Today s Schedule Process Creation

More information

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals What Is A Process? A process is a program in execution. Process Fundamentals #include int main(int argc, char*argv[]) { int v; printf( hello world\n ); scanf( %d, &v); return 0; Program test

More information

CS/CoE 1541 Final exam (Fall 2017). This is the cumulative final exam given in the Fall of Question 1 (12 points): was on Chapter 4

CS/CoE 1541 Final exam (Fall 2017). This is the cumulative final exam given in the Fall of Question 1 (12 points): was on Chapter 4 CS/CoE 1541 Final exam (Fall 2017). Name: This is the cumulative final exam given in the Fall of 2017. Question 1 (12 points): was on Chapter 4 Question 2 (13 points): was on Chapter 4 For Exam 2, you

More information

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS SOLUTIONS ENGR 3950U / CSCI 3020U (Operating Systems) Midterm Exam October 23, 2012, Duration: 80 Minutes (10 pages, 12 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Question 1 (Computer Systgem)

More information

Part Two - Process Management. Chapter 3: Processes

Part Two - Process Management. Chapter 3: Processes Part Two - Process Management Chapter 3: Processes Chapter 3: Processes 3.1 Process Concept 3.2 Process Scheduling 3.3 Operations on Processes 3.4 Interprocess Communication 3.5 Examples of IPC Systems

More information

Threads. CS-3013 Operating Systems Hugh C. Lauer. CS-3013, C-Term 2012 Threads 1

Threads. CS-3013 Operating Systems Hugh C. Lauer. CS-3013, C-Term 2012 Threads 1 Threads CS-3013 Operating Systems Hugh C. Lauer (Slides include materials from Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew Tanenbaum and from Operating System Concepts,

More information

CS 426. Building and Running a Parallel Application

CS 426. Building and Running a Parallel Application CS 426 Building and Running a Parallel Application 1 Task/Channel Model Design Efficient Parallel Programs (or Algorithms) Mainly for distributed memory systems (e.g. Clusters) Break Parallel Computations

More information

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

Process a program in execution; process execution must progress in sequential fashion. Operating Systems Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks 1 Textbook uses the terms job and process almost interchangeably Process

More information

Chapter 3: Processes. Operating System Concepts 8th Edition,

Chapter 3: Processes. Operating System Concepts 8th Edition, Chapter 3: Processes, Administrivia Friday: lab day. For Monday: Read Chapter 4. Written assignment due Wednesday, Feb. 25 see web site. 3.2 Outline What is a process? How is a process represented? Process

More information

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation Why are threads useful? How does one use POSIX pthreads? Michael Swift 1 2 What s in a process? Organizing a Process A process

More information

Processes. Johan Montelius KTH

Processes. Johan Montelius KTH Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other

More information

Threads. CS3026 Operating Systems Lecture 06

Threads. CS3026 Operating Systems Lecture 06 Threads CS3026 Operating Systems Lecture 06 Multithreading Multithreading is the ability of an operating system to support multiple threads of execution within a single process Processes have at least

More information

Programming Scalable Systems with MPI. UvA / SURFsara High Performance Computing and Big Data. Clemens Grelck, University of Amsterdam

Programming Scalable Systems with MPI. UvA / SURFsara High Performance Computing and Big Data. Clemens Grelck, University of Amsterdam Clemens Grelck University of Amsterdam UvA / SURFsara High Performance Computing and Big Data Message Passing as a Programming Paradigm Gentle Introduction to MPI Point-to-point Communication Message Passing

More information

A process. the stack

A process. the stack A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes

More information

!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful?

!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful? Chapter 2: Threads: Questions CSCI [4 6]730 Operating Systems Threads!! How is a thread different from a process?!! Why are threads useful?!! How can OSIX threads be useful?!! What are user-level and kernel-level

More information

Processes, Threads, SMP, and Microkernels

Processes, Threads, SMP, and Microkernels Processes, Threads, SMP, and Microkernels Slides are mainly taken from «Operating Systems: Internals and Design Principles, 6/E William Stallings (Chapter 4). Some materials and figures are obtained from

More information

ECE 574 Cluster Computing Lecture 13

ECE 574 Cluster Computing Lecture 13 ECE 574 Cluster Computing Lecture 13 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 15 October 2015 Announcements Homework #3 and #4 Grades out soon Homework #5 will be posted

More information

Chapter 4: Processes. Process Concept

Chapter 4: Processes. Process Concept Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Silberschatz, Galvin and Gagne

More information

CSE 4/521 Introduction to Operating Systems

CSE 4/521 Introduction to Operating Systems CSE 4/521 Introduction to Operating Systems Lecture 5 Threads (Overview, Multicore Programming, Multithreading Models, Thread Libraries, Implicit Threading, Operating- System Examples) Summer 2018 Overview

More information

Page 1. Analogy: Problems: Operating Systems Lecture 7. Operating Systems Lecture 7

Page 1. Analogy: Problems: Operating Systems Lecture 7. Operating Systems Lecture 7 Os-slide#1 /*Sequential Producer & Consumer*/ int i=0; repeat forever Gather material for item i; Produce item i; Use item i; Discard item i; I=I+1; end repeat Analogy: Manufacturing and distribution Print

More information

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes Q1 (30 marks) NOTE: Unless otherwise stated, the questions are with reference

More information

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control Processes & Threads Concurrent Programs Process = Address space + one thread of control Concurrent program = multiple threads of control Multiple single-threaded processes Multi-threaded process 2 1 Concurrent

More information

Chapter 4: Processes

Chapter 4: Processes Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Silberschatz, Galvin and Gagne

More information

Multiprocessors 2007/2008

Multiprocessors 2007/2008 Multiprocessors 2007/2008 Abstractions of parallel machines Johan Lukkien 1 Overview Problem context Abstraction Operating system support Language / middleware support 2 Parallel processing Scope: several

More information

Threads Implementation. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Threads Implementation. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Threads Implementation Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics How to implement threads? User-level threads Kernel-level

More information

Definition Multithreading Models Threading Issues Pthreads (Unix)

Definition Multithreading Models Threading Issues Pthreads (Unix) Chapter 4: Threads Definition Multithreading Models Threading Issues Pthreads (Unix) Solaris 2 Threads Windows 2000 Threads Linux Threads Java Threads 1 Thread A Unix process (heavy-weight process HWP)

More information

Threads (light weight processes) Chester Rebeiro IIT Madras

Threads (light weight processes) Chester Rebeiro IIT Madras Threads (light weight processes) Chester Rebeiro IIT Madras 1 Processes Separate streams of execution Each process isolated from the other Process state contains Process ID Environment Working directory.

More information

Introduction to Parallel Programming

Introduction to Parallel Programming Introduction to Parallel Programming Linda Woodard CAC 19 May 2010 Introduction to Parallel Computing on Ranger 5/18/2010 www.cac.cornell.edu 1 y What is Parallel Programming? Using more than one processor

More information

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems Chapter 5: Processes Chapter 5: Processes & Threads Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems, Silberschatz, Galvin and

More information

Operating systems fundamentals - B06

Operating systems fundamentals - B06 Operating systems fundamentals - B06 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems fundamentals - B06 1 / 12 Introduction Introduction to threads Reminder

More information

CMPSC 311- Introduction to Systems Programming Module: Concurrency

CMPSC 311- Introduction to Systems Programming Module: Concurrency CMPSC 311- Introduction to Systems Programming Module: Concurrency Professor Patrick McDaniel Fall 2016 Sequential Programming Processing a network connection as it arrives and fulfilling the exchange

More information

ECE 598 Advanced Operating Systems Lecture 23

ECE 598 Advanced Operating Systems Lecture 23 ECE 598 Advanced Operating Systems Lecture 23 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 21 April 2016 Don t forget HW#9 Midterm next Thursday Announcements 1 Process States

More information

Computer Architecture

Computer Architecture Jens Teubner Computer Architecture Summer 2016 1 Computer Architecture Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2016 Jens Teubner Computer Architecture Summer 2016 2 Part I Programming

More information

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005 INF060: Introduction to Operating Systems and Data Communication Operating Systems: Processes & CPU Pål Halvorsen /9-005 Overview Processes primitives for creation and termination states context switches

More information

Shared-Memory Programming

Shared-Memory Programming Shared-Memory Programming 1. Threads 2. Mutual Exclusion 3. Thread Scheduling 4. Thread Interfaces 4.1. POSIX Threads 4.2. C++ Threads 4.3. OpenMP 4.4. Threading Building Blocks 5. Side Effects of Hardware

More information

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Lecture 3: Processes Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Process in General 3.3 Process Concept Process is an active program in execution; process

More information

Chapter 4 Concurrent Programming

Chapter 4 Concurrent Programming Chapter 4 Concurrent Programming 4.1. Introduction to Parallel Computing In the early days, most computers have only one processing element, known as the Central Processing Unit (CPU). Due to this hardware

More information

Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne

Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne Process Fundamentals Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne CSCI 315 Operating Systems Design 1 What

More information

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission Process Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission 1 Recap OS services Resource (CPU, memory) allocation, filesystem, communication, protection, security,

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 Lecture 7 Threads Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How many processes can a core

More information

Processes COMPSCI 386

Processes COMPSCI 386 Processes COMPSCI 386 Elements of a Process A process is a program in execution. Distinct processes may be created from the same program, but they are separate execution sequences. call stack heap STACK

More information

Multicore and Multiprocessor Systems: Part I

Multicore and Multiprocessor Systems: Part I Chapter 3 Multicore and Multiprocessor Systems: Part I Max Planck Institute Magdeburg Jens Saak, Scientific Computing II 44/337 Symmetric Multiprocessing Definition (Symmetric Multiprocessing (SMP)) The

More information

518 Lecture Notes Week 3

518 Lecture Notes Week 3 518 Lecture Notes Week 3 (Sept. 15, 2014) 1/8 518 Lecture Notes Week 3 1 Topics Process management Process creation with fork() Overlaying an existing process with exec Notes on Lab 3 2 Process management

More information

Concurrency, Thread. Dongkun Shin, SKKU

Concurrency, Thread. Dongkun Shin, SKKU Concurrency, Thread 1 Thread Classic view a single point of execution within a program a single PC where instructions are being fetched from and executed), Multi-threaded program Has more than one point

More information

Lecture 2 Process Management

Lecture 2 Process Management Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable

More information

High Performance Computing Course Notes Shared Memory Parallel Programming

High Performance Computing Course Notes Shared Memory Parallel Programming High Performance Computing Course Notes 2009-2010 2010 Shared Memory Parallel Programming Techniques Multiprocessing User space multithreading Operating system-supported (or kernel) multithreading Distributed

More information

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads 5.1 Silberschatz, Galvin and Gagne 2003 More About Processes A process encapsulates

More information

CHAPTER 3 - PROCESS CONCEPT

CHAPTER 3 - PROCESS CONCEPT CHAPTER 3 - PROCESS CONCEPT 1 OBJECTIVES Introduce a process a program in execution basis of all computation Describe features of processes: scheduling, creation, termination, communication Explore interprocess

More information

Processes. Process Concept

Processes. Process Concept Processes These slides are created by Dr. Huang of George Mason University. Students registered in Dr. Huang s courses at GMU can make a single machine readable copy and print a single copy of each slide

More information

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1 Reading Assignment 4 Chapter 4 Threads, due 2/7 1/31/13 CSE325 - Processes 1 What s Next? 1. Process Concept 2. Process Manager Responsibilities 3. Operations on Processes 4. Process Scheduling 5. Cooperating

More information

Thread. Disclaimer: some slides are adopted from the book authors slides with permission 1

Thread. Disclaimer: some slides are adopted from the book authors slides with permission 1 Thread Disclaimer: some slides are adopted from the book authors slides with permission 1 IPC Shared memory Recap share a memory region between processes read or write to the shared memory region fast

More information

CS 470 Spring Mike Lam, Professor. Distributed Programming & MPI

CS 470 Spring Mike Lam, Professor. Distributed Programming & MPI CS 470 Spring 2017 Mike Lam, Professor Distributed Programming & MPI MPI paradigm Single program, multiple data (SPMD) One program, multiple processes (ranks) Processes communicate via messages An MPI

More information

Concurrent Programming

Concurrent Programming Concurrent Programming is Hard! Concurrent Programming Kai Shen The human mind tends to be sequential Thinking about all possible sequences of events in a computer system is at least error prone and frequently

More information

! How is a thread different from a process? ! Why are threads useful? ! How can POSIX threads be useful?

! How is a thread different from a process? ! Why are threads useful? ! How can POSIX threads be useful? Chapter 2: Threads: Questions CSCI [4 6]730 Operating Systems Threads! How is a thread different from a process?! Why are threads useful?! How can OSIX threads be useful?! What are user-level and kernel-level

More information

CMPSC 311- Introduction to Systems Programming Module: Concurrency

CMPSC 311- Introduction to Systems Programming Module: Concurrency CMPSC 311- Introduction to Systems Programming Module: Concurrency Professor Patrick McDaniel Fall 2013 Sequential Programming Processing a network connection as it arrives and fulfilling the exchange

More information

CHAPTER 2: PROCESS MANAGEMENT

CHAPTER 2: PROCESS MANAGEMENT 1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:

More information