Prof. Leonardo Mostarda University of Camerino

Slides:



Advertisements
Similar presentations
1 Processes and Threads Creation and Termination States Usage Implementations.
Advertisements

Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 3 Process Description and Control
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Threads Clients Servers Code Migration Software Agents Summary
3.5 Interprocess Communication
Threads CSCI 444/544 Operating Systems Fall 2008.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Process Concept An operating system executes a variety of programs
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
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.
Threads, Thread management & Resource Management.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Threads G.Anuradha (Reference : William Stallings)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Thread Usage.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Threads, Thread management & Resource Management.
Threads. Readings r Silberschatz et al : Chapter 4.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-2: Threads Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Introduction to Operating Systems Concepts
Chapter 4 – Thread Concepts
Operating System Overview
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Processes and threads.
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
CS 6560: Operating Systems Design
Operating System Concepts
Processes and Threads Processes and their scheduling
OPERATING SYSTEMS CS3502 Fall 2017
Chapter 4 – Thread Concepts
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Process Management Presented By Aditya Gupta Assistant Professor
Processes Overview: Process Concept Process Scheduling
Chapter 4 Threads.
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Threads & multithreading
Chapter 4: Threads.
Operating System Concepts
Operating Systems Processes and Threads.
Lecture 2: Processes Part 1
Process & its States Lecture 5.
Operating System Concepts
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Fast Communication and User Level Parallelism
Threads and Concurrency
Threads Chapter 4.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Operating Systems (CS 340 D)
Chapter 3: Processes.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
Process Management -Compiled for CSIT
What is a Thread? A thread is similar to a process, but it typically consists of just the flow of control. Multiple threads use the address space of a.
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Prof. Leonardo Mostarda University of Camerino Distributed Systems – processes Prof. Leonardo Mostarda University of Camerino Prof. Leonardo Mostarda-- Camerino,

Last lecture Decentralised architectures Structured peer-to-peer architectures Unstructured peer-to-peer architectures Hybrid architectures Superpeer architectures Collaborative Distributed Systems

Outline Processes Threads Multithreaded clients Multithreaded servers Virtualisation

Learning outcomes Understand threads and processes Critically compare threads and processes Understand the use of threads in distributes systems Understand the role of virtualisation in distributes systems

Process A process is a program in execution Processes are like human beings: they are generated they have a life they optionally generate one or more child processes and eventually they die A small difference Each process has exactly one parent

Processes: The Process Model A) Conceptual model of 4 independent, sequential processes B) Multiprogramming of four programs C) Only one program active at any instant

Process States Possible process states running blocked ready Transitions between states shown

Processes Creation of processes incurs in high overhead (concurrency transparency) Independent address space Initialising memory Zeroing a data segment Copying the program into the data segment …… Switching between processes incurs in high overhead Saving CPU context (register values, program counter, open files, stack pointer, …) Swap processes between memory and disk Load a new process ……..

The Thread Model (a) Three processes each with one thread (b) One process with three threads

The Thread Model Items shared by all threads in a process Items private to each thread

Threads vs Processes Multithreading leads to performance gain(creation and switching are faster) A multithread system maintains minimum information in order to allow different threads to share the same CPU Switching can take place in the user space Processes require Interprocess Communication (IPC) (pipes, message queues, shared memory) which require kernel intervention Advantages of processes? Thread are not automatically protected against each other (no concurrency transparency) Developing multithreading application requires additional intellectual effort

Thread Usage in non-distributed systems A word processor with three threads The user can still write while the text is saved, and the spell check is performed

Threads in Distributed systems Threads allow blocking system calls without blocking the entire process Multiple connection can take place at the same time We describe multithreaded clients We describe multithreaded servers

Multithreaded client Clients hide communication latencies with threads After a thread initiates the communication a different thread can run For instance Google chrome When the html is fetched various threads are used Display the text and GUI elements Fetch images Fetch data When WEB servers are replicated connections are set up to different replicas

Multithreaded server Multithreading simplifies the server code and makes easier to develop server with better performance even on uniprocessor systems For instance in a file server A dispatcher reads the incoming request for a file operation An idle worker thread is selected The worker thread can block until data are fetched from the disk The dispatcher can acquire new works A single thread solution would waste CPU (3-4 cannot run in parallel)

Multithreaded server What if threads are not available? How do we implement our file server? Finite state machine The server runs as a big state machine There is a single thread that does not block. It records a request and its state (e.g., waiting from disk) and gets the next message The next message may be a replay from the disk Any important comments? The server will have to make use of no blocking calls to send and receive (better performance but hard to program)

The Role of Virtualization in Distributed Systems Every distributed computer system offers an interface to higher level software (Figure a) Virtualisation modifies the existing interface so as to mimic the behaviour of another system (Figure b) Introduced in 1970s to allow legacy software to run on expensive mainframe Different OSs were ported on the IBM 370 mainframe

The use of virtualisation today Hardware and low-level system change fast while higher level applications are more stable. Virtualisation help by porting a legacy interface to new platforms. System administrators can manage a single platform type. An applications runs on its own virtual machine that in turn runs on the platform. Other example?

Architectures of Virtual Machines In order to understand how virtualisation can be realised we need to understand the different levels at which interfaces are provided: An interface between the hardware and software consisting of machine instructions that can be invoked by any program. An interface between the hardware and software, consisting of machine instructions that can be invoked only by privileged programs, such as an operating system.

Architectures of Virtual Machines Interfaces at different levels An interface consisting of system calls as offered by an operating system. An interface consisting of library calls generally forming what is known as an application programming interface (API). In many cases, the aforementioned system calls are hidden by an API.

Architectures of Virtual Machines First way of implement virtualisation A runtime system can provide an abstract instruction set that can be used by applications The runtime system can be an interpreter or the emulation of an OS

Architectures of Virtual Machines Second way of implement virtualisation A layer completely shields the original hardware This is referred to as Virtual Machine Monitor (VMM) Decoupling between hardware and software

Summary Processes Threads Multithreaded client Multithreaded server Virtualisation