OPERATING SYSTEM SUPPORT

Slides:



Advertisements
Similar presentations
Shared-Memory Model and Threads Intel Software College Introduction to Parallel Programming – Part 2.
Advertisements

Threads Chapter 4 Threads are a subdivision of processes
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Process Description and Control
1 Multithreaded Programming in Java. 2 Agenda Introduction Thread Applications Defining Threads Java Threads and States Examples.
Distributed Systems Architectures
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 11: Structure and Union Types Problem Solving & Program Design.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B
1 Processes and Threads Creation and Termination States Usage Implementations.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Real Time Versions of Linux Operating System Present by Tr n Duy Th nh Quách Phát Tài 1.
Configuration management
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc
Slide 19-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 19.
Threads, SMP, and Microkernels
DISTRIBUTED OBJECTS AND REMOTE INVOCATION
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
Chapter 3: Processes.
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Processes Management.
Processes Management.
Executional Architecture
Global Analysis and Distributed Systems Software Architecture Lecture # 5-6.
Operating System Architecture and Distributed Systems
Operating System Architecture and Distributed Systems
Operating Systems: Internals and Design Principles
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 15 Multithreading, Networks, and Client/Server Programming
PSSA Preparation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 14: Protection.
TCP/IP Protocol Suite 1 Chapter 18 Upon completion you will be able to: Remote Login: Telnet Understand how TELNET works Understand the role of NVT in.
Chapter 9: Using Classes and Objects. Understanding Class Concepts Types of classes – Classes that are only application programs with a Main() method.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Introduction to Operating Systems CS-2301 B-term Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials.
Slides for Chapter 6: Operating System support From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Multithreading in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Exercises for Chapter 6: Operating System Support
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.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Computer System Architectures Computer System Software
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Chapter 6 Operating System Support. This chapter describes how middleware is supported by the operating system facilities at the nodes of a distributed.
Threads, Thread management & Resource Management.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Exercises for Chapter 7 Operating.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
111 © 2002, Cisco Systems, Inc. All rights reserved.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers Distribuerede.
Operating Systems: Internals and Design Principles
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 7: Operating.
OPERATING SYSTEM SUPPORT
Background Computer System Architectures Computer System Software.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Chapter 6: Operating System Support
CS490 Windows Internals Quiz 2 09/27/2013.
Programming Models for Distributed Application
Slides for Chapter 6: Operating System support
Lecture Topics: 11/1 General Operating System Concepts Processes
Threads Chapter 4.
Presentation transcript:

OPERATING SYSTEM SUPPORT From Chapter 6 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison Wesley/Pearson Education June 2005

The Operating System Layer Processes and Threads Topics Introduction The Operating System Layer Processes and Threads Operating System Architecture Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Introduction Many distributed operating systems have been investigated, but there are none in general/wide use. But network operating system are in wide use for various reasons both technical and non-technical. Users have much invested in their application software; they will not adopt a new operating system that will not run their applications. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Introduction The second reason against the adoption of distributed operating system is that users tend to prefer to have a degree of autonomy for their machines, even in a organization. Unix and Windows are two examples of network operating systems. Those have a networking capability built into them and so can be used to access remote resources using basic services such as rlogin and telnet. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Introduction The combination of middleware and network operating systems provides an acceptance balance between the requirement of autonomy and network transparency. The network operating systems allows users to run their favorite word processor and other standalone applications. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Introduction Middleware enables users to take advantage of services that become available in their distributed system. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

The Operating System Layer Figure 1. System layers Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

The Operating System Layer Figure 1 shows how the operating system layer at each of two nodes supports a common middleware layer in providing a distributed infrastructure for applications and services. Kernels and server processes are the components that manage resources and present clients with an interface to the resources. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

The Operating System Layer The OS facilitates: Encapsulation Protection Concurrent processing Invocation mechanism is a means of accessing an encapsulated resource. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

The Operating System Layer Figure 2. Core OS functionality Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

The Operating System Layer Figure 2 shows the core OS components: Process manager Thread manager Memory manager Communication manager Supervisor Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Process A process consists of an execution environment together with one or more threads. A thread is the operating system abstraction of an activity. An execution environment is the unit of resource management: a collection of local kernel managed resources to which its threads have access. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads An execution environment consists of : An address space Thread synchronization and communication resources (e.g., semaphores, sockets) Higher-level resources (e.g., file systems, windows) Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Threads Threads are schedulable activities attached to processes. The aim of having multiple threads of execution is : To maximize degree of concurrent execution between operations To enable the overlap of computation with input and output To enable concurrent processing on multiprocessors. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Threads can be helpful within servers: Concurrent processing of client’s requests can reduce the tendency for servers to become bottleneck. E.g. one thread can process a client’s request while a second thread serving another request waits for a disk access to complete. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Processes vs. Threads Threads are “lightweight” processes, processes are expensive to create but threads are easier to create and destroy. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Threads programming Thread programming is concurrent programming. Java provides methods for creating, destroying and synchronizing threads. The Java thread class includes the constructor and management methods listed in Figure 3. The thread and object synchronization methods are in Figure 4. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Thread(ThreadGroup group, Runnable target, String name) Creates a new thread in the SUSPENDED state, which will belong to group and be identified as name; the thread will execute the run() method of target. setPriority(int newPriority), getPriority() Set and return the thread’s priority. run() A thread executes the run() method of its target object, if it has one, and otherwise its own run() method (Thread implements Runnable). start() Change the state of the thread from SUSPENDED to RUNNABLE. sleep(int millisecs) Cause the thread to enter the SUSPENDED state for the specified time. yield() Enter the READY state and invoke the scheduler. destroy() Destroy the thread. Figure 3. Java thread constructor and management methods Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Figure 4. Java thread synchronization calls thread.join(int millisecs) Blocks the calling thread for up to the specified time until thread has terminated. thread.interrupt() Interrupts thread: causes it to return from a blocking method call such as sleep(). object.wait(long millisecs, int nanosecs) Blocks the calling thread until a call made to notify() or notifyAll() on object wakes the thread, or the thread is interrupted, or the specified time has elapsed. object.notify(), object.notifyAll() Wakes, respectively, one or all of any threads that have called wait() on object. Figure 4. Java thread synchronization calls Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Programs can manage threads in groups. Processes and Threads Programs can manage threads in groups. Every thread belongs to one group assigned at thread creation time. thread groups are useful to shield various applications running in parallel on one Java Virtual Machine (JVM). A thread in one group cannot perform management operations on a thread in another group. E.g., an application thread may not interrupt a system windowing (AWT) thread. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Thread synchronization Processes and Threads Thread synchronization The main difficult issues in multi-threaded programming are the sharing of objects and the techniques used for thread coordination and cooperation. Each thread’s local variables in methods are private to it. Threads have private stack. Threads do not have private copies of static (class) variables or object instance variables. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Java provides the synchronized keyword for thread coordination. any object can only be accessed through one invocation of any of its synchronized methods. an object can have synchronized and non-synchronized methods. example synchronized addTo() and removeFrom() methods to serialize requests in worker pool example. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads Threads can be blocked and woken up example The thread awaiting a certain condition calls an object’s wait() method. The other thread calls notify() or notifyAll() to awake one or all blocked threads. example When a worker thread discovers that there are no requests to process, it calls wait() on the instance of Queue. When the I/O thread adds a request to the queue, it calls the queue’s notify() method to wake up the worker. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Processes and Threads The Java synchronization methods are given in Figure 4. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Client and server with threads N threads Input-output Client Thread 2 makes T1 Thread 1 requests to server generates results Requests Receipt & queuing Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture A key principle of distributed systems is openness. The major kernel architectures: Monolithic kernels Micro-kernels Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture An open distributed system should make it possible to: Run only that system software at each computer that is necessary for its particular role in the system architecture. For example, system software needs for PDA and dedicated server are different. Loading redundant modules wastes memory resources. Allow the software (and the computer) implementing any particular service to be changed independent of other facilities. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Allow for alternatives of the same service to be provided, when this is required to suit different users or applications. Introduce new services without harming the integrity of existing ones. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture A guiding principle of operating system design: The separation of fixed resource management “mechanisms“ from resource management “policies”, which vary from application to application and service to service. For example, an ideal scheduling system would provide mechanisms that enable a multimedia application such as videoconferencing to meet its real-time demands while coexisting with a non-real-time application such as web browsing. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture The kernel would provide only the most basic mechanisms upon which the general resource management tasks at a node are carried out. Server modules would be dynamically loaded as required, to implement the required resourced management policies for the currently running applications. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Monolithic Kernels A monolithic kernel can contain some server processes that execute within its address space, including file servers and some networking. The code that these processes execute is part or the standard kernel configuration. (Figure 5) Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Figure 5. Monolithic kernel and microkernel Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Microkernel The microkernel appears as a layer between hardware layer and a layer consisting of major systems. If performance is the goal, rather than portability, then middleware may use the facilities of the microkernel directly. (Figure 6) Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Figure 6. The role of the microkernel Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Monolithic and Microkernel comparison The advantages of a microkernel Its extensibility Its ability to enforce modularity behind memory protection boundaries. Its small kernel has less complexity. The advantages of a monolithic The relative efficiency with which operations can be invoked because even invocation to a separate user-level address space on the same node is more costly. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005

Operating System Architecture Hybrid Approaches Pure microkernel operating system such as Chorus & Mach have changed over a time to allow servers to be loaded dynamically into the kernel address space or into a user-level address space. In some operating system such as SPIN, the kernel and all dynamically loaded modules grafted onto the kernel execute within a single address space. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4 , Pearson Education 2005