Lecture Contents. 1. Overview. 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary

Size: px
Start display at page:

Download "Lecture Contents. 1. Overview. 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary"

Transcription

1 Lecture 4 Threads 1

2 Lecture Contents 1. Overview 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary 2

3 1. Overview Process is the unit of resource allocation and unit of protection. Thread is the basic unit of CPU utilization. In other words, thread is the unit of dispatching. 3

4 1. Overview Single-threaded process (also called heavyweight, task or job) contains one thread (also called lightweight process or miniprocess). It performs only one task at a time. Multithreaded process contains n threads (n = 2, 3, ). It performs more than one task at a time. Unix, Windows, and Java support thread libraries (via APIs). 4

5 Benefits of Threads It takes less time to create a new thread than a process It takes less time to terminate a thread than a process Switching between two threads takes less time than switching between processes Threads enhance efficiency in communication between programs 5

6 1. Overview Thread comprises thread ID, a program counter, a register set, priority, stack, and other threadrelated state information. Each thread of a multithreaded process has its own thread control block. 6

7 1. Overview Thread shares with other threads belonging to same process its code section, data section, open files, and so on. By default, threads share memory (i.e., the process s address space) and resources of the process to which they belong. 7

8 1. Overview Multithreading refers to the ability of an OS to support multiple, concurrent paths of execution within a single process. The difference between single-threaded process and multithreaded process is shown on next slide. 8

9 1. Overview Single-threaded and multithreaded processes. 9

10 Examples of Applications with Multithreaded Process - Web browser might have one thread display images or text while another thread retrieves data from the network. - Word processor may have a thread for displaying graphics, another thread for responding to keystrokes from the user, and a third thread for performing spelling and grammar checking in the background. - Web server has multithreaded process to service many clients as illustrated on next slide. 10

11 Examples of Applications with Multithreaded Process Multithreaded server architecture. Most OS kernels are now multithreaded such as Windows, Linux, Mac OS X, and Solaris. 11

12 Four Benefits of Multithreaded Programming 1. Responsiveness. Multithreading may allow program to continue running even if part of it is blocked or is performing lengthy operation, therefore responsiveness is increased. 2. Resource sharing. Threads share memory and resources of the process to which they belong by default. 12

13 Four Benefits of Multithreaded Programming 3. Economy - As a result of resource sharing, it is more economical to create new threads than new processes. - It is much more time consuming to create and manage processes than threads (e.g., context switching). 13

14 Four Benefits of Multithreaded Programming 4. Scalability (i.e., utilization of multiprocessor architectures ) - Single-threaded process can only execute on one processor regardless of the number of processors actually exists in the computer. - Multithreading can be greatly increased in multiprocessor architecture, where multiple threads can run in parallel on different processors. 14

15 Multicore Programming Multithreaded programming provides mechanism for more efficient use of multiple cores and improved concurrency. Consider application with four threads. - On system with single computing core, concurrency merely means that execution of threads will be interleaved over time (see figure on next slide), as processing core is capable of executing only one thread at a time. 15

16 Multicore Programming Concurrent execution on a single-core system. 16

17 Multicore Programming - On system with multiple cores, concurrency means that threads can run in parallel, as system can assign separate thread to each core. Parallel execution on a multicore system. 17

18 Thread Execution States States associated with a change in thread state - Spawn: when a new process is spawned, a thread for that process is also spawned. - Block: when a thread needs to wait for an event (e.g., I/O), it will block. Processor may execute another ready thread in the same or different process. 18

19 Thread Execution States States associated with a change in thread state - Unblock: the state changes from blocked to ready. - Finish: when a thread completes, its allocated resources (i.e., register context and stacks) are deallocated 19

20 Linux Tasks Linux does not distinguish between process and thread. Linux uses the term task rather than process or thread. A task in Linux is represented by a task_struct data structure This data structure contains the following. - State: ready, executing, blocked, stopped - Scheduling information: priority, allotted time 20

21 Linux Tasks - Identifiers: pid, user and group identifiers - Interprocess communication: - Links: link to its parent process and siblings - Times and timers: include process creation time, processor time used by process, interval timer 21

22 Linux Tasks - File system: includes pointers to files opened by process, pointers to current and root directories for this process - Address space: assigned to this process - Process context: includes registers and stack information of this process 22

23 Solaris Thread States RUN: thread is runnable, i.e., ready to execute ONPROC: thread is executing on processor SLEEP: thread is blocked ZOMBIE: thread has terminated. FREE: Thread resources have been released and thread is awaiting removal from OS thread data structure. 23

24 Solaris Process and Thread Solaris makes use of four separate thread-related concepts. - Process: includes the user s address space, stack, and process control block (PCB). - User-level threads (ULT): is a user-created unit of execution within a process. 24

25 Solaris Process and Thread - Lightweight processes (LWP): can be viewed as a mapping between ULTs and kernel threads. - Kernel threads: can be scheduled and dispatched to run on one of the system processors. 25

26 Windows Thread States Ready: thread may be scheduled for execution. The kernel dispatcher keeps track of all ready threads and schedules them in priority order. Standby: thread has been selected to run next on a particular processor. The thread waits in this state until that processor is made available. 26

27 Windows Thread States Running: Once kernel dispatcher performs a thread switch, standby thread enters Running state and begins execution and continues execution until it is preempted by a higher priority thread, exhausts its time slice, blocks, or terminates. In the first two cases, it goes back to the ready state. 27

28 Windows Thread States Waiting: A thread enters the Waiting state when (1) it is blocked on an event (e.g., I/O), (2) it voluntarily waits for synchronization purposes, or (3) an environment subsystem directs the thread to suspend itself. When the waiting condition is satisfied, the thread moves to the Ready state if all of its resources are available. 28

29 Windows Thread States Transition: A thread enters this state after waiting if it is ready to run but the resources are not available. Terminated: A thread can be terminated by itself, by another thread, or when its parent process terminates. 29

30 Lecture Contents 1. Overview 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary 30

31 2. Multithreading Models Two types of threads are user threads and kernel threads. Contemporary OSs supporting kernel threads include Windows, Linux, Mac OS X, Solaris. Three common relationships between user thread and kernel thread are m:1, 1:1, and m:n (m n). 31

32 Many-to-One Model Many-to-one model maps many user-level threads to one kernel thread. Thread management is done by thread library in user space, so it is efficient (i.e., creating one user thread may not require creating corresponding kernel thread). Solaris uses this model via the green threads (it is a thread library). 32

33 Many-to-One Model Many-to-one model. 33

34 Weaknesses of Many-to-One Model The entire process will block if a thread makes a blocking system call. Only one thread can access the kernel at a time, multiple threads are unable to run in parallel on multicore systems. 34

35 One-to-One Model One-to-one model maps each user thread to a kernel thread. Linux and Windows OSs use one-to-one model. 35

36 One-to-One Model One-to-one model. 36

37 One-to-One Model Strengths: - provides more concurrency than many-to-one model by allowing another thread to run when a thread makes blocking system call. - allows multiple threads to run in parallel on multiprocessors. Weakness - Creating user thread requires creating corresponding kernel thread. 37

38 Many-to-Many Model Many-to-many model multiplexes many userlevel threads to a smaller or equal number of kernel threads (m n). Strengths: - Many-to-many model suffers from neither of shortcomings of m:1 and 1:1 models. 38

39 Many-to-Many Model Many-to-many model. 39

40 Lecture Contents 1. Overview 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary 40

41 3. Examples of Thread Libraries Thread library provides programmer with API for creating and managing threads. Two primary ways of implementing thread library are 1. User-level thread (ULT) library/facility - all code and data structures for thread library reside in user space with no OS support - invoking API function results in local function call in user space, not system call. 41

42 Disadvantages of ULT If one thread is blocked, then the entire process (i.e., all threads within the process) is blocked. Only a single ULT within a process can execute at a time. 42

43 3. Examples of Thread Libraries 2. Kernel-level thread (KLT) library/facility - all code and data structures exist in kernel space so it is supported by OS call. - invoking API function results in system 43

44 Advantages of KLT The kernel can simultaneously schedule multiple threads from the same process on multiple processors. If one thread in a process is blocked, the kernel can schedule another thread of the same process. 44

45 3. Examples of Thread Libraries Windows uses a KLT approach. Solaris uses a combined ULT and KLT approach. 45

46 3. Examples of Thread Libraries Three main thread APIs are: - POSIX Pthreads on UNIX-based OS - Win32 on Windows OS - Java thread API uses thread library of host OS. Example: write multithreaded program that computes sum = n, where value of n is entered on command line. 46

47 Pthread API - Ubuntu Linux Pthreads (refers to specification for thread behavior, not implementation) Pthreads share global data (i.e., global variable sum). 47

48 Pthread API - Linux - pthread_create(&tid, &attr, runner, argv[1]): parent thread creates child thread - pthread_join(tid, NULL): parent thread waits for child thread to terminate - pthread_exit(0): child thread signals its completion. 48

49 Pthread API - Linux - C Program #include <pthread.h> #include <stdio.h> #include <stdlib.h> int sum = 0; // shared by thread(s) void *runner(void *param); /* the thread */ int main(int argc, char *argv[]) { 49

50 Pthread API - Linux - C Program pthread_t tid; // thread identifier pthread_attr_t attr; // attributes int n = 0; if (argc!= 2) { printf("usage: Pthread n\n"); return -1; } n = atoi(argv[1]) 50

51 Pthread API - Linux - C Program if (n < 0) { printf("usage:pthread n >= 0); return -1; } /* get the default attributes */ pthread_attr_init(&attr); 51

52 Pthread API - Linux - C Program /* create the thread */ pthread_create(&tid, &attr, runner, &n); //pthread_create(&tid, NULL, // runner, &n); /*wait for child thread to exit*/ pthread_join(tid, NULL); printf("sum = %d\n", sum); } // main 52

53 Pthread API - Linux - C Program /* The thread will begin control in this function */ void *runner(void *param) { int i, n = *(int*)param; } for (i = 1; i <= n; i++) sum += i; pthread_exit(0); 53

54 Win32 Thread API - Windows Win32 threads share global data (i.e., global variable Sum). 54

55 Win32 Thread API - Windows - CreateThread(NULL, 0, Summation, &n, 0, &ThreadId): parent thread creates child thread - WaitForSingleObject(ThreadHandle, INFINITE): parent thread waits for child thread to terminate - return 0: child thread completes its execution. 55

56 Win32 Thread API - Windows - C/C++ Program #include <windows.h> #include <stdio.h> #include <stdlib.h> /*data is shared by the thread(s)*/ DWORD Sum; 56

57 Win32 Thread API - Windows - C/C++ Program /* the thread runs in this separate function */ DWORD WINAPI Summation(LPVOID Param) { DWORD n = *(DWORD*)Param; } for (DWORD i = 0; i <= n; i++) Sum += i; return 0; 57

58 Win32 Thread API - Windows - C/C++ Program int main(int argc, char *argv[]) { DWORD ThreadId; HANDLE ThreadHandle; int n; 58

59 Win32 Thread API - Windows - C/C++ Program /*perform basic error checking*/ if (argc!= 2) { printf("an integer >= 0 is required\n"); return -1; } 59

60 Win32 Thread API - Windows - C/C++ Program n = atoi(argv[1]); if (n < 0) { printf("an integer >= 0 is required\n"); return -1; } 60

61 Win32 Thread API - Windows - C/C++ Program // create the child thread ThreadHandle = CreateThread( NULL, // default security attributes 0, // default stack size Summation, // thread function &n, // parameter to thread function 0, // default creation flags &ThreadId); // returns the thread identifier 61

62 Win32 Thread API - Windows - C/C++ Program if (ThreadHandle!= NULL) { // now wait for the thread to finish WaitForSingleObject( ThreadHandle, INFINITE); // close the thread handle CloseHandle(ThreadHandle); printf("sum = %d\n", Sum); } } // main 62

63 Java Thread API Two techniques for writing multithreaded Java program are - First approach: extend Thread class and override run() method. That is, create new class that is derived from Thread class and override its run() method. - Second approach (more commonly used): define a class that implements the Runnable interface as follows. 63

64 Java Thread API class Summation implements Runnable { // Data members // Constructors public void run() { // perform required task } } 64

65 Java Thread API - When a class implements Runnable, it must define its run() method. - The code implementing the run() method is what runs as a separate thread. 65

66 Java Thread API - Thread creation is performed by creating object instance of Thread class and passing the constructor of Runnable object. - Creating Thread object does not specifically create new thread. The start() method creates new thread. Calling thrd.start() method for the new object does two things: 66

67 Java Thread API 1. It allocates memory and initializes new thread in the JVM. 2. It calls run() method. Child thread begins execution in run() method of Summation class. 67

68 Java Thread API - Java Program class Sum // object shared by parent/main() // and child/summation threads { private int sum; public int getsum() { return sum; } 68

69 Java Thread API - Java Program public void setsum(int tsum) { sum = tsum; } } // Sum 69

70 Java Thread API - Java Program class Summation implements Runnable // object used to create child thread { private int upper; // n private Sum sumobt; // sumobject 70

71 Java Thread API - Java Program public Summation(int upr, Sum so) { upper = upr; sumobt = so; } 71

72 Java Thread API - Java Program public void run() { // child thread begins its // execution here int sum = 0; for (int i = 0; i <= upper; i++) sum += i; sumobt.setsum(sum); } } // Summation 72

73 Java Thread API - Java Program public class SumApp { public static void main( String[] args) { // main/parent thread if (args.length!= 1) { System.err.println("Usage: SumApp integer >= 0"); System.exit(0); } 73

74 Java Thread API - Java Program int upper = Integer.parseInt(args[0]); if (upper < 0) { System.out.println( "Usage: SumApp integer >= 0"); System.exit(0); } 74

75 Java Thread API - Java Program // create object shared by parent and child threads Sum sumobject = new Sum(); // create Thread object, // it does not create a new/child thread Thread thrd = new Thread( new Summation(upper, sumobject)); 75

76 Java Thread API - Java Program thrd.start(); // creates child thread and calls the run() method try { // parent thread waits for // summation/child thread to finish thrd.join(); } 76

77 Java Thread API - Java Program catch ( InterruptedException ie) { } System.out.println("Sum = " + sumobject.getsum()); } // main() } // public class SumApp 77

78 Lecture Contents 1. Overview 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary 78

79 4. Summary Thread is flow of control within process. A multithreaded process contains several different flows of control within the same address space. Benefits of multithreading include increased responsiveness to user, resource sharing within process, economy, and scalability issues such as more efficient use of multiple cores. 79

80 4. Summary User-level threads are threads that are visible to programmer and are unknown to kernel. OS kernel supports and manages kernel-level threads. Three different types of models relate user and kernel threads: m:1, 1:1, and m:n models. - The m:n model multiplexes many user threads to a smaller or equal number of kernel threads. 80

81 4. Summary Most modern OSs (Windows, UNIX, JVM) provide kernel-level threads via POSIX Pthreads, Win32 thread API, and Java thread API. 81

82 Exercise Write a threading program to sort an n-element array of integers. The sorting task is done by the child thread. The parent thread waits for the child threads to complete its task. The sorted array is output by the parent thread. You can use a sorting algorithm of your choice (e.g., bubble sort, selection sort, insertion sort, and so on). 82

83 Installing and Using Java on Ubuntu Linux I. Installation $ sudo apt-get f install (use this command only when you got error messages) $ sudo apt install pythonsoftware-properties $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt update $ sudo apt install oracle-java8- installer 83

84 Installing and Using Java on Ubuntu Linux II. Usage 1. Compilation $ javac SumApp.java Note: The file SumApp.class is generated 84

85 Installing and Using Java on Ubuntu Linux 2. Execution $ java SumApp 5 The sum of 5 numbers is 15 Note: Load the file SumApp.class for execution 85

86 Installing and Using Java on Ubuntu Linux 3. Check Java version $ java -version java version "1.8.0_101" 86

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

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

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 8 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How many partners can we cave for project:

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2019 Lecture 7 Threads Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Amdahls law example: Person

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

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

Last Class: CPU Scheduling. Pre-emptive versus non-preemptive schedulers Goals for Scheduling: CS377: Operating Systems.

Last Class: CPU Scheduling. Pre-emptive versus non-preemptive schedulers Goals for Scheduling: CS377: Operating Systems. Last Class: CPU Scheduling Pre-emptive versus non-preemptive schedulers Goals for Scheduling: Minimize average response time Maximize throughput Share CPU equally Other goals? Scheduling Algorithms: Selecting

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

Chapter 4: Threads. Operating System Concepts with Java 8 th Edition

Chapter 4: Threads. Operating System Concepts with Java 8 th Edition Chapter 4: Threads 14.1 Silberschatz, Galvin and Gagne 2009 Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples 14.2 Silberschatz, Galvin and Gagne

More information

CISC2200 Threads Spring 2015

CISC2200 Threads Spring 2015 CISC2200 Threads Spring 2015 Process We learn the concept of process A program in execution A process owns some resources A process executes a program => execution state, PC, We learn that bash creates

More information

Threads. studykorner.org

Threads. studykorner.org Threads Thread Subpart of a process Basic unit of CPU utilization Smallest set of programmed instructions, can be managed independently by OS No independent existence (process dependent) Light Weight Process

More information

Operating Systems 2 nd semester 2016/2017. Chapter 4: Threads

Operating Systems 2 nd semester 2016/2017. Chapter 4: Threads Operating Systems 2 nd semester 2016/2017 Chapter 4: Threads Mohamed B. Abubaker Palestine Technical College Deir El-Balah Note: Adapted from the resources of textbox Operating System Concepts, 9 th edition

More information

CSE 306/506 Operating Systems Threads. YoungMin Kwon

CSE 306/506 Operating Systems Threads. YoungMin Kwon CSE 306/506 Operating Systems Threads YoungMin Kwon Processes and Threads Two characteristics of a process Resource ownership Virtual address space (program, data, stack, PCB ) Main memory, I/O devices,

More information

Multithreading. Reading: Silberschatz chapter 5 Additional Reading: Stallings chapter 4

Multithreading. Reading: Silberschatz chapter 5 Additional Reading: Stallings chapter 4 Multithreading Reading: Silberschatz chapter 5 Additional Reading: Stallings chapter 4 Understanding Linux/Unix Programming, Bruce Molay, Prentice-Hall, 2003. EEL 602 1 Outline Process and Threads Multithreading

More information

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Objectives To introduce the notion of a

More information

CSMC 412. Operating Systems Prof. Ashok K Agrawala Ashok Agrawala Set 4. September 2006 CMSC 412 Set 4

CSMC 412. Operating Systems Prof. Ashok K Agrawala Ashok Agrawala Set 4. September 2006 CMSC 412 Set 4 CSMC 412 Operating Systems Prof. Ashok K Agrawala 2005 Ashok Agrawala Set 4 1 Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads 2 Single and

More information

Chapter 3 Process Description and Control

Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles Chapter 3 Process Description and Control Seventh Edition By William Stallings Process Control Block Structure of Process Images in Virtual Memory How

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Multilevel Feedback Queues (MLFQ) Multilevel feedback queues use past behavior to predict the future and assign

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

Chapter 5: Threads. Single and Multithreaded Processes

Chapter 5: Threads. Single and Multithreaded Processes Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads Chapter 5: Threads 5.1 Silberschatz, Galvin and Gagne 2003 Single and Multithreaded Processes 5.2

More information

Chapter 4: Threads. Operating System Concepts 8 th Edition,

Chapter 4: Threads. Operating System Concepts 8 th Edition, Chapter 4: Threads, Silberschatz, Galvin and Gagne 2009 Chapter 4: Threads Overview Multithreading Models Thread Libraries 4.2 Silberschatz, Galvin and Gagne 2009 Objectives To introduce the notion of

More information

Operating Systems Prof. Ashok K Agrawala

Operating Systems Prof. Ashok K Agrawala CSMC 412 Operating Systems Prof. Ashok K Agrawala 2005 Ashok Agrawala Set 4 4.1 Silberschatz, Galvin and Gagne 2005 Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux

More information

操作系统原理与设计. 第 4 章 Threads( 线程 ) 陈香兰. March 28, 2014 中国科学技术大学计算机学院. 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计 March 28, /

操作系统原理与设计. 第 4 章 Threads( 线程 ) 陈香兰. March 28, 2014 中国科学技术大学计算机学院. 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计 March 28, / 操作系统原理与设计 第 4 章 Threads( 线程 ) 陈香兰 中国科学技术大学计算机学院 March 28, 2014 陈香兰 ( 中国科学技术大学计算机学院 ) 操作系统原理与设计 March 28, 2014 1 / 44 提纲 1 Overview 2 Multithreading Models 3 Thread Libraries 4 Threading Issues 5 OS Examples

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Slides based on the book Operating System Concepts, 9th Edition, Abraham Silberschatz, Peter B. Galvin and Greg Gagne,

More information

CS420: Operating Systems

CS420: Operating Systems Threads James Moscola Department of Physical Sciences York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Threads A thread is a basic unit of processing

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2019 Lecture 6 Processes Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Fork( ) causes a branch

More information

OPERATING SYSTEM. Chapter 4: Threads

OPERATING SYSTEM. Chapter 4: Threads OPERATING SYSTEM Chapter 4: Threads Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples Objectives To

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. 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

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

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

Threads Assistant Professor DCS Operating System Concepts

Threads Assistant Professor DCS Operating System Concepts Threads Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS Lahore Pakistan Operating System Concepts Definitions Threads In the previous discussion, a process

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

Chapter 4: Threads. Chapter 4: Threads

Chapter 4: Threads. Chapter 4: Threads Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

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

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, 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

Process Description and Control

Process Description and Control Process Description and Control 1 Process:the concept Process = a program in execution Example processes: OS kernel OS shell Program executing after compilation www-browser Process management by OS : Allocate

More information

Chapter 4: Multithreaded

Chapter 4: Multithreaded Chapter 4: Multithreaded Programming Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading Issues Operating-System Examples 2009/10/19 2 4.1 Overview A thread is

More information

Chapter 4: Multithreaded Programming Dr. Varin Chouvatut. Operating System Concepts 8 th Edition,

Chapter 4: Multithreaded Programming Dr. Varin Chouvatut. Operating System Concepts 8 th Edition, Chapter 4: Multithreaded Programming Dr. Varin Chouvatut, Silberschatz, Galvin and Gagne 2010 Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading Issues Operating

More information

Chapter 4 Threads. Images from Silberschatz 03/12/18. CS460 Pacific University 1

Chapter 4 Threads. Images from Silberschatz 03/12/18. CS460 Pacific University 1 Chapter 4 Threads Images from Silberschatz Pacific University 1 Threads Multiple lines of control inside one process What is shared? How many PCBs? Pacific University 2 Typical Usages Word Processor Web

More information

Chapter 4: Threads. Operating System Concepts 9 th Edit9on

Chapter 4: Threads. Operating System Concepts 9 th Edit9on Chapter 4: Threads Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads 1. Overview 2. Multicore Programming 3. Multithreading Models 4. Thread Libraries 5. Implicit

More information

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne Chapter 4: Threads Silberschatz, Galvin and Gagne Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Linux Threads 4.2 Silberschatz, Galvin and

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

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

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: Threads. Operating System Concepts 9 th Edition

Chapter 4: Threads. Operating System Concepts 9 th Edition Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 4: MULTITHREADED PROGRAMMING

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 4: MULTITHREADED PROGRAMMING I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 4: MULTITHREADED PROGRAMMING Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading

More information

Chapter 4: Threads. Operating System Concepts 9 th Edition

Chapter 4: Threads. Operating System Concepts 9 th Edition Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

Chapter 4: Multi-Threaded Programming

Chapter 4: Multi-Threaded Programming Chapter 4: Multi-Threaded Programming Chapter 4: Threads 4.1 Overview 4.2 Multicore Programming 4.3 Multithreading Models 4.4 Thread Libraries Pthreads Win32 Threads Java Threads 4.5 Implicit Threading

More information

Chapter 4: Threads. Chapter 4: Threads

Chapter 4: Threads. Chapter 4: Threads Chapter 4: Threads Silberschatz, Galvin and Gagne 2009 Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads 4.2

More information

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering Operating System Chapter 4. Threads Lynn Choi School of Electrical Engineering Process Characteristics Resource ownership Includes a virtual address space (process image) Ownership of resources including

More information

Processes and Threads

Processes and Threads Processes and Threads Giuseppe Anastasi g.anastasi@iet.unipi.it Pervasive Computing & Networking Lab. () Dept. of Information Engineering, University of Pisa Based on original slides by Silberschatz, Galvin

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

Chapter 4 Multithreaded Programming

Chapter 4 Multithreaded Programming Chapter 4 Multithreaded Programming Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 1 Outline Overview Multithreading

More information

COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads. Zhi Wang Florida State University

COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads. Zhi Wang Florida State University COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads Zhi Wang Florida State University Contents Thread overview Multithreading models Thread libraries Threading issues Operating

More information

Threads. Threads (continued)

Threads. Threads (continued) Threads A thread is an alternative model of program execution A process creates a thread through a system call Thread operates within process context Use of threads effectively splits the process state

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

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture) EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture) Dept. of Computer Science & Engineering Chentao Wu wuct@cs.sjtu.edu.cn Download lectures ftp://public.sjtu.edu.cn User:

More information

4. Concurrency via Threads

4. Concurrency via Threads CSC400 - Operating Systems 4. Concurrency via Threads J. Sumey Overview Multithreading Concept Background Implementations Thread States & Thread Switching Thread Operations Case Study: pthreads CSC400

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

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Processes and Threads

Processes and Threads OPERATING SYSTEMS CS3502 Spring 2018 Processes and Threads (Chapter 2) Processes Two important types of dynamic entities in a computer system are processes and threads. Dynamic entities only exist at execution

More information

Threads Chapter 5 1 Chapter 5

Threads Chapter 5 1 Chapter 5 Threads Chapter 5 1 Chapter 5 Process Characteristics Concept of Process has two facets. A Process is: A Unit of resource ownership: a virtual address space for the process image control of some resources

More information

Operating Systems: Internals and Design Principles. Chapter 4 Threads Seventh Edition By William Stallings

Operating Systems: Internals and Design Principles. Chapter 4 Threads Seventh Edition By William Stallings Operating Systems: Internals and Design Principles Chapter 4 Threads Seventh Edition By William Stallings Operating Systems: Internals and Design Principles The basic idea is that the several components

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

Creating Threads COMP755

Creating Threads COMP755 Creating Threads COMP755 "I pledged California to a Northern Republic and to a flag that should have no treacherous threads of cotton in its warp, and the audience came down in thunder." Thomas Starr King

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

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5. Lecture Topics Today: Threads (Stallings, chapter 4.1-4.3, 4.6) Next: Concurrency (Stallings, chapter 5.1-5.4, 5.7) 1 Announcements Make tutorial Self-Study Exercise #4 Project #2 (due 9/20) Project #3

More information

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4 Motivation Threads Chapter 4 Most modern applications are multithreaded Threads run within application Multiple tasks with the application can be implemented by separate Update display Fetch data Spell

More information

For use by students enrolled in #71251 CSE430 Fall 2012 at Arizona State University. Do not use if not enrolled.

For use by students enrolled in #71251 CSE430 Fall 2012 at Arizona State University. Do not use if not enrolled. Operating Systems: Internals and Design Principles Chapter 4 Threads Seventh Edition By William Stallings Operating Systems: Internals and Design Principles The basic idea is that the several components

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

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

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Processes and threads 1 Overview Process concept Process scheduling Thread

More information

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012 Eike Ritter 1 Modified: October 16, 2012 Lecture 8: Operating Systems with C/C++ School of Computer Science, University of Birmingham, UK 1 Based on material by Matt Smart and Nick Blundell Outline 1 Concurrent

More information

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues 4.2 Silberschatz, Galvin

More information

Chapter 4: Multithreaded Programming

Chapter 4: Multithreaded Programming Chapter 4: Multithreaded Programming Silberschatz, Galvin and Gagne 2013! Chapter 4: Multithreaded Programming Overview Multicore Programming Multithreading Models Threading Issues Operating System Examples

More information

York University Lassonde School of Engineering Department of Electrical Engineering and Computer Science

York University Lassonde School of Engineering Department of Electrical Engineering and Computer Science York University Lassonde School of Engineering Department of Electrical Engineering and Computer Science Midterm EECS 3221.03Z Operating Systems Fundamentals Feb 26, 2015 (14:30-16:00) Section: EECS3221Z

More information

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors 1 Process:the concept Process = a program in execution Example processes:

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

Exercise (could be a quiz) Solution. Concurrent Programming. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - IV Threads

Exercise (could be a quiz) Solution. Concurrent Programming. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - IV Threads Exercise (could be a quiz) 1 2 Solution CSE 421/521 - Operating Systems Fall 2013 Lecture - IV Threads Tevfik Koşar 3 University at Buffalo September 12 th, 2013 4 Roadmap Threads Why do we need them?

More information

Process Concept Process in Memory Process State new running waiting ready terminated Diagram of Process State

Process Concept Process in Memory Process State new running waiting ready terminated Diagram of Process State Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks Textbook uses the terms job and process almost interchangeably Process a

More information

pthreads CS449 Fall 2017

pthreads CS449 Fall 2017 pthreads CS449 Fall 2017 POSIX Portable Operating System Interface Standard interface between OS and program UNIX-derived OSes mostly follow POSIX Linux, macos, Android, etc. Windows requires separate

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

Process Characteristics. Threads Chapter 4. Process Characteristics. Multithreading vs. Single threading

Process Characteristics. Threads Chapter 4. Process Characteristics. Multithreading vs. Single threading Process Characteristics Threads Chapter 4 Reading: 4.1,4.4, 4.5 Unit of resource ownership - process is allocated: a virtual address space to hold the process image control of some resources (files, I/O

More information

Threads Chapter 4. Reading: 4.1,4.4, 4.5

Threads Chapter 4. Reading: 4.1,4.4, 4.5 Threads Chapter 4 Reading: 4.1,4.4, 4.5 1 Process Characteristics Unit of resource ownership - process is allocated: a virtual address space to hold the process image control of some resources (files,

More information

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University Che-Wei Chang chewei@mail.cgu.edu.tw Department of Computer Science and Information Engineering, Chang Gung University 1. Introduction 2. System Structures 3. Process Concept 4. Multithreaded Programming

More information

Chapter 4: Multithreaded Programming. Operating System Concepts 8 th Edition,

Chapter 4: Multithreaded Programming. Operating System Concepts 8 th Edition, Chapter 4: Multithreaded Programming, Silberschatz, Galvin and Gagne 2009 Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading Issues 4.2 Silberschatz, Galvin

More information

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved.

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved. Operating Systems: Internals and Design Principles Chapter 4 Threads Ninth Edition By William Stallings Processes and Threads Resource Ownership Process includes a virtual address space to hold the process

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

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009 CS211: Programming and Operating Systems Lecture 17: Threads and Scheduling Thursday, 05 Nov 2009 CS211 Lecture 17: Threads and Scheduling 1/22 Today 1 Introduction to threads Advantages of threads 2 User

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

Chapter 5 Process Scheduling

Chapter 5 Process Scheduling Chapter 5 Process Scheduling Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 Outline Basic Concepts Scheduling Criteria

More information

Chapter 4 Threads, SMP, and

Chapter 4 Threads, SMP, and Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. 2008, Prentice Hall Roadmap Threads: Resource ownership

More information

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts CS307 Basic Concepts Maximize CPU utilization obtained with multiprogramming CPU Scheduling CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait CPU burst distribution

More information

Thread. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Thread. Operating Systems (Fall/Winter 2018) Yajin Zhou (  Zhejiang University Operating Systems (Fall/Winter 2018) Thread Yajin Zhou (http://yajin.org) Zhejiang University Acknowledgement: some pages are based on the slides from Zhi Wang(fsu). Review Process Multiple parts: text,

More information

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Processes and Threads. Processes and Threads. Processes (2) Processes (1) Processes and Threads (Topic 2-1) 2 홍성수 Processes and Threads Question: What is a process and why is it useful? Why? With many things happening at once in a system, need some way of separating them all

More information

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm Operating Systems Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) armahmood786@yahoo.com alphasecure@gmail.com alphapeeler.sf.net/pubkeys/pkey.htm http://alphapeeler.sourceforge.net pk.linkedin.com/in/armahmood

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