DS Lecture 3
Total Page:16
File Type:pdf, Size:1020Kb
Distributed System: Lecture 3 Box Leangsuksun SWECO Endowed Professor, Computer Science Louisiana Tech University [email protected] CTO, PB Tech International Inc. [email protected] Slides for Chapter 7: Operating System support From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Outline • Background • OS support 3 Backgound • With user/customer requirements • system modeling concepts – physical – Architecture – Fundamental (interaction/performance, failure and security) • what if analysis & Design 4/1/14 Towards survivable architecture 4 Clients-servers architecture: Processes & comm Client invocation invocation Server result result Server Client Key: Process: Computer: Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Peer-to-peer architecture Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Sockets and ports interaction model agreed port socket any port socket message client server other ports Internet address = 138.37.94.248 Internet address = 138.37.88.249 Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 7.1 System layers Applications, services Middleware OS: kernel, OS1 OS2 libraries & Processes, threads, Processes, threads, servers communication, ... communication, ... Platform Computer & Computer & network hardware network hardware Node 1 Node 2 Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 OS Support • Important roles of the system kernel/OS • an understanding of the advantages and disadvantages of splitting functionality between protection domains (kernel and user-level code) • the relation between operation system layer and middle layer • how well the requirement of middleware & operating system – Efficient and robust access to physical resources – The flexibility to implement a variety of resource-management policies Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 OS Support • The task of any operating system is to provide problem-oriented abstractions of the underlying physical resources (For example, sockets rather than raw network access) – the processors – Memory – Communications – storage media • System call interface takes over the physical resources on a single node and manages them to present these resource abstractions Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 OS Support • Network operating systems – They have a network capability built into them and so can be used to access remote resources. Access is network-transparent for some – not all – type of resource. – Multiple system images • The node running a network operating system retain autonomy in managing their own processing resources An operating system that produces a single system image like this for all the resources in a distributed system is called a distributed operating system OS Support • a network operating system retain autonomy in managing their own processing resources • Single system image – OS in which users are never concerned with where their programs run, or the location of any resources. The operating system has control over all the nodes in the system Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Middleware and network operating systems • No real distributed operating systems in general use, only network operating systems – users more focus on their application software, which often meets their current problem-solving needs – users tend to prefer to have a degree of autonomy for their machines, even is a closely knit organization The combination of middleware and network operating systems provides an acceptable balance between the requirement for autonomy Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 System layers Applications, services Middleware OS: kernel, OS1 OS2 libraries & Processes, threads, Processes, threads, servers communication, ... communication, ... Platform Computer & Computer & network hardware network hardware Node 1 Node 2 Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 What are core distinct features from OS support? • To enable DS applications • Network enabled features 4/1/14 Towards survivable architecture 15 OS to solve Challenges in DSs • Heterogeneity • Openness • Security • Scalability • Fault handling • Concurrency • Transparency 4/1/14 Towards survivable architecture 16 Core OS functionality Handles the creation of and Communication between operations upon threads attached to process different processes on the same computer Process manager Tread creation, synchronization Management of and scheduling Communication physical and manager virtual memory Dispatching of interrupts, Thread manager Memory manager system call traps and other exceptions Supervisor Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Kernel and Protection • A system program that always runs with complete access privileged for the physical resources on its host computer • Execute in supervisor (privileged) mode; the kernel arranges that other processes execute in user (unprivileged) mode • sets up address spaces to protect itself and other processes and to provide processes with their required virtual memory layout • The process can safely transfer from a user-level address space to the kernel’s address space via an exception such as an interrupt or a system call trap Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Processes and threads • A thread is the operating system abstraction of an activity (the term derives from the phrase “thread of execution”) • An execution environment is the unit of resource management: a collection of local kernel-managed resources to which its threads have access • An execution environment primarily consists – An address space – Thread synchronization and communication resources such as semaphore and communication interfaces – High-level resources such as open file and windows Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Single and Multithreaded Processes! Benefits! • Responsiveness # •! Resource Sharing" # •! Utilization of MP & Multicore Architectures# A comparison of processes and threads as follows •! Creating a new thread with an existing process is cheaper than creating a process. •! More importantly, switching to a different thread within the same process is cheaper than switching between threads belonging to different process. •! Threads within a process may share data and other resources conveniently and efficiently compared with separate processes. •! But, by the same token, threads within a process are not protected from one another. A comparison of processes and threads as follows (2) •! The overheads associated with creating a process are in general considerably greater than those of creating a new thread. –! A new execution environment must first be created, including address space table •! The second performance advantage of threads concerns switching between threads – that is, running one thread instead of another at a given process Types! •! User-level thread# •! Kernel-Level Thread# User Threads! •! Thread management done by user-level threads library" # •! Three primary thread libraries:# –! POSIX Pthreads! –! Win32 threads# –! Java threads# Threading Issues! •! Semantics of fork() and exec() system calls# •! Thread cancellation# •! Signal handling# •! Thread pools# •! Thread specific data# •! Scheduler activations# Semantics of fork() and exec()! •! Does fork() duplicate only the calling thread or all threads?# Thread Cancellation! •! Terminating a thread before it has finished# •! Two general approaches:# –! Asynchronous cancellation terminates the target thread immediately# –! Deferred cancellation allows the target thread to periodically check if it should be cancelled# # Signal Handling! •! Signals are used in UNIX systems to notify a process that a particular event has occurred# •! A signal handler is used to process signals# 1.! Signal is generated by particular event# 2.! Signal is delivered to a process# 3.! Signal is handled# •! Options:# –! Deliver the signal to the thread to which the signal applies# –! Deliver the signal to every thread in the process# –! Deliver the signal to certain threads in the process# –! Assign a specific thread to receive all signals for the process# Thread Programming Paradigms! •! On-demand - create a thread whenever you need # –! Easy to program# –! More overheads# •! Thread pool - create a pool of threads, and then assign tasks to them.# –! More efficient # –! Difficult to program due to you have to manage threads in your code# Thread Pools! •! Create a number of threads in a pool where they await work# •! Advantages: