operating system support distributed systems chapter 6 lawrence heyman july 8, 2002

28
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

Upload: roderick-todd

Post on 04-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

OPERATING SYSTEM SUPPORT

DISTRIBUTED SYSTEMS

CHAPTER 6

Lawrence Heyman

July 8, 2002

Page 2: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

CONTENTS

1. INTRODUCTION

2. THE OPERATING SYSTEM LAYER

3. PROTECTION

4. PROCESSES AND THREADS

5. COMMUNICATION AND INVOCATION

6. OPERATING SYSTEM ARCHITECTURE

7. SUMMARY

Page 3: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

OPERATING SYSTEM SUPPORT

• Important aspect of DS is resource sharing• Client applications invoke operations• Middleware provides remote invocations

between processes at nodes of DS• OS is layer below middleware• OS supports middleware at nodes of a DS

– encapsulation– protection– invocation

Page 4: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

TASK OF OS

• Provide abstraction of physical resources– Processors– Memory– Communications– Storage media

• System call interface– Files rather than data blocks– Sockets rather than raw network access

Page 5: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

NETWORK OS vs DISTRIBUTED OS

• Multiple system images

• Autonomous nodes• Remote login

– rlogin & telnet

• Control at own node • User scheduling

• Single system image

• Not autonomous

• OS controls all nodes• Transparent access

Page 6: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

REASONS AGAINST DS

• Investment in current application software

• Preference for autonomy

• Combination of Middleware and Network offers balance

Page 7: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

WHAT DOES OS PROVIDE?

• OS running at a node provides abstractions of local hardware resourse

• Middleware uses these resources for remote invocations at the nodes

• Kernel and server processes manage resources and provide client interface

• Clients access resources

Page 8: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

PROTECTION

• Problems– malicious code, bugs– unanticipated behavior– illegitimate access

• Solutions– use of type-safe language– hardware support at kernel level

• Price is speed

Page 9: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

OS COMPONENTS

• Process manager

• Thread manager

• Communications manager

• Memory manager

• Supervisor

Page 10: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

PROCESSES & THREADS

• Process– an execution environment with one or more threads

• Execution Environment – unit of resource management

• local kernel-managed resources

• to which threads have access

– the protected domain in which threads exe

• Thread– the OS abstraction of an activity

Page 11: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

PROCESS CREATION

• Creation of execution environment– Address space

– Initialized contents

• Transparent to user• Choice of target host node is policy decision

– transfer policy

– location policy

– sender-initiated

– receiver-initiated

– migration

Page 12: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

ADVANTAGES OF THREADS

• dynamically created and destroyed

• maximize concurrent execution

• maximize throughput (rps)

• overlap of computation with input/output

• concurrent processing on multiprocessors– reduces bottlenecks

Page 13: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

MULTI-THREAD SERVERARCHITECTURES

1. Worker-pool

2. Thread-per-request

3. Thread-per-connection

4. Thread-per-object

( Various hybrids also possible )

Page 14: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

WORKER-POOLi/o

Page 15: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREAD-PER-REQUEST

Page 16: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREAD-PER-CONNECTION

Page 17: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREAD-PER-OBJECT

Page 18: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREADS vs MULTIPLE PROCESSES

1. Switching to different thread within process cheaper than switching to thread in 2nd process

2. Threads within process may share resources and data efficiently compared to separate processes

3. Creating new thread within process is cheaper than creating new process

4. Threads within a process not protected from one another

Page 19: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREADS PROGRAMMING

• Threads programming is concurrent– C - threads library– Java – methods

• Threads Lifetimes– New thread created in SUSPENDED state– Made RUNNABLE with start()– Executes on run() method– Ends on return from run() or destroy()

• Threads groups– Assigned at creation– Security

Page 20: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREADS PROGRAMMING #2

• Threads Synchronization– Local variables are private (private stack)– Synchronized through monitor construct so

only one thread can execute at a time• in Queue class

• in Object class

• Threads Scheduling– Preemptive– Non-preemptive

Page 21: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THREADS PROGRAMMING #3

• Threads Implementation– Many kernel-level implementations (NT,

Solaris) are multi-level– Creation and management system calls– Schedule threads individually– Threads run-time library

• Organizes multi-threaded processes• Linked to user-level applications• Kernel not involved here

Page 22: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

• User-level threads– Advantages over kernel-level threads– Disadvantages without kernel support

• Combining user-level and kernel-level enables user-level code provide scheduling hints to kernel’s thread scheduler– Advantages– Disadvantage

THREADS PROGRAMMING #4

Page 23: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

HIERARCHALEVENT-LEVEL SCHEDULING

• User-level scheduler requires kernel to notify it of scheduling-relevant events

• Each application process contains user-level scheduler– manages threads in that process

• Kernel allocates virtual processors– application requirements– priority– total demand

Page 24: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

ASSIGNMENT OF VIRTUAL PROCESSORS

PR OC ESSA

PR OC ESSB

KERNEL

Page 25: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

TYPES OF EVENTS

• Scheduler Activation call from kernel notifies process scheduler of an event– Virtual Processor Added (ready thread)

– SA blocked

– SA unblocked

– SA preempted

• Advantages– allocation based on user-level priorities

– kernel does not influence user-level scheduler’s behavior

Page 26: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

EVENTS SCHEDULING

P ADDE D

SA PRE EM PTED

SA UNBLO CK ED

SA BLO CKE D

P IDLE

P NE EDE D

P R O C E S S

K ER N E L

Page 27: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

SUMMARY

• OS Support of middleware– Implementing of resource management policy– Encapsulation and protection of resources– Allows concurrent sharing of resources

• Processes– Execution environment

• Address space• Communication interfaces• Local resources, i.e., semaphores

– Threads – kernel-level & user-level• Share the execution environment• Cheap concurrency• Parallel multiprocessors

Page 28: OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002

THE END