Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Chapter 4 Threads Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Threads, SMP, and Microkernels
Chapter 5 Threads os5.
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Chapter 5 Processes and Threads Copyright © 2008.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
Describe the concept of lightweight process (LWP) and the advantages to using LWPs Lightweight process (LWP) lies in a hybrid form of user-level & kernel-level.
Threads Clients Servers Code Migration Software Agents Summary
Ceng Operating Systems Chapter 2.5 : Threads Process concept  Process scheduling  Interprocess communication  Deadlocks  Threads.
Threads - Definition - Advantages using Threads - User and Kernel Threads - Multithreading Models - Java and Solaris Threads - Examples - Definition -
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
Threads CSCI 444/544 Operating Systems Fall 2008.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for Threads.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Inter-Process Communication  most OSs provide several abstractions for inter- process communication: message passing, shared memory, etc.  communication.
Threads. Processes and Threads  Two characteristics of “processes” as considered so far: Unit of resource allocation Unit of dispatch  Characteristics.
Process Concept An operating system executes a variety of programs
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Threads Chapter 4. Modern Process & Thread –Process is an infrastructure in which execution takes place  (address space + resources) –Thread is a program.
Processes.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Threads, Thread management & Resource Management.
Multithreading in Java Project of COCS 513 By Wei Li December, 2000.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Threads G.Anuradha (Reference : William Stallings)
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
ITFN 3601 Introduction to Operating Systems Lecture 3 Processes, Threads & Scheduling Intro.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Multithreaded Programing. Outline Overview of threads Threads Multithreaded Models  Many-to-One  One-to-One  Many-to-Many Thread Libraries  Pthread.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Distributed (Operating) Systems -Processes and Threads-
Module 2.0: Threads.
1 Chapter 2.5 : Threads Process concept  Process concept  Process scheduling  Process scheduling  Interprocess communication  Interprocess communication.
Processes & Threads Introduction to Operating Systems: Module 5.
1 OS Review Processes and Threads Chi Zhang
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Operating System Concepts
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Chapter 4: Threads 羅習五. Chapter 4: Threads Motivation and Overview Multithreading Models Threading Issues Examples – Pthreads – Windows XP Threads – Linux.
Lecturer 3: Processes multithreaded Operating System Concepts Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 4 – Thread Concepts
CS 6560: Operating Systems Design
Chapter 4 – Thread Concepts
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Chapter 4 Threads.
Chapter 4: Threads 羅習五.
Operating System Concepts
Operating Systems Processes and Threads.
Chapter 15, Exploring the Digital Domain
Threads Chapter 4.
Fast Communication and User Level Parallelism
Threads and Concurrency
Threads Chapter 4.
Prof. Leonardo Mostarda University of Camerino
Presentation transcript:

Processes Chapter 3

Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads in distributed systems –Clients/servers Code migration –Motivation and models –Migration in heterogeneous systems

Processes Virtual processors –Created by OS to execute a program –Process table to keep track of virtual processors Process is a program in execution –Executed on one of the virtual processors Operating systems ensure that processes are independent and transparent –Do not affect each other’s correctness –Resource sharing is transparent Address space

Costs of Processes Processes are costly Creating a process requires creation of an entire new address space –Initializing memory segment, copying instructions to text segment, initializing stack Switching b/w processes is costly as well –Saving CPU context, modify registers of the memory management unit, TLBs, swapping processes (if number of processors are larger than what can fit in main memory)

Threads Similar to a process –Perceived as execution of (a part of) program –Information maintained for sharing CPU is minimal Context of threads is captured by CPU context –May be a little more information is needed for management (like locks) Very little overheads –Thread switching is easy Can provide performance gains

Threads in Non-Distributed Systems With processes a blocking system call blocks the entire process –Interactive programs like spreadsheets –Computations cannot proceed while waiting on user inputs or vice-versa –Having two threads can solve problems Parallel programs –Multiple threads, single address space Cooperating programs need to communicate –IPCs are costly

Drawbacks of IPCs Needs kernel intervention (due to separate address spaces) Multiple context switches Context switches are costly (changing MMU, flushing TLB)

Implementing Threads Implemented as package –Creation, destruction, synchronization Simpler approach – User level thread library –All thread management is done at user level –Kernel not even that there are multiple threads Thread creation, destruction and context switching are cheap –Creating stack –Saving registers Drawback – Blocking system call blocks entire process

Lightweight Process A hybrid approach Lightweight process runs in context of single process Reside in kernel System also offers user-level threads –All operations occur in user mode Thread package can be shared by multiple LWPs LWP is created by kernel and given its own stack

Light-Weight Process

LWPs Continued LWP has a scheduling routine and searches for a thread to execute –Thread pool Context switching to a thread if found On mutex, context switching happens if a runnable thread is found –LWP need not be informed LWP context switching happens on a blocking system call Several advantages –Cheap, will not block entire process, extends to multiprocessing environment