You are on page 1of 23

Slides for Chapter 7:

Operating System support

From Coulouris, Dollimore, Kindberg and


Blair
Distributed Systems:
Concepts and Design
Edition 5, © Addison-Wesley 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
Figure 7.2
Core OS functionality

Process manager

Communication
manager

Thread manager Memory manager

Supervisor

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.3
Address space

2N

Auxiliary
regions

Stack

Heap

Text
0

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.4
Copy-on-write

Process A’s address space Process B’s address space

RB copied
from RA
RA RB

Kernel

Shared
frame
A's page B's page
table table

a) Before write b) After write

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.5
Client and server with threads

Thread 2 makes
requests to server
Receipt & Input-output

Thread 1 queuing
generates
results
T1
Requests
N threads
Client
Server

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.6
Alternative server threading architectures (see also Figure 7.5)

per-connection threads per-object threads


workers

I/O remote I/O remote


remote
objects
objects objects

a. Thread-per-request b. Thread-per-connection c. Thread-per-object

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.7
State associated with execution environments and threads

Execution environment Thread


Address space tables Saved processor registers
Communication interfaces, open files Priority and execution state (such as
BLOCKED)
Semaphores, other synchronization Software interrupt handling information
objects
List of thread identifiers Execution environment identifier
Pages of address space resident in memory; hardware cache entries

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.8
Java thread constructor and management methods

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()
Causes the thread to enter the READY state and invoke the scheduler.
destroy()
Destroy the thread.

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.9
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.

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.10
Scheduler activations

P added
Process Process
A B SA preempted
Process SA unblocked

Kernel SA blocked

P idle
Virtual processors Kernel
P needed

A. Assignment of virtual processors B. Events between user-level scheduler & kernel


to processes Key: P = processor; SA = scheduler activation

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.11
Invocations between address spaces

(a) System call Thread Control transfer via


trap instruction

Control transfer via


privileged instructions
User Kernel

Protection domain
(b) RPC/RMI (within one computer) boundary

Thread 1 Thread 2

User 1 Kernel User 2


(c) RPC/RMI (between computers)

Thread 1 Network Thread 2

User 1 User 2
Kernel 1 Kernel 2

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.12
RPC delay against parameter size

RPC delay

Requested data
size (bytes)
0 1000 2000
Packet
size

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.13
A lightweight remote procedure call

Client Server

A stack
A

1. Copy args 4. Execute procedure


and copy results

User stub stub

Kernel
2. Trap to Kernel 3. Upcall 5. Return (trap)

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.14
Times for serialized and concurrent invocations

Serialised invocations Concurrent invocations


process args process args
marshal marshal
Send transmission Send
process args
marshal
Receive Send Receive
unmarshal unmarshal
execute request execute request
marshal marshal
Send Send
Receive
unmarshal
Receive Receive execute request
unmarshal unmarshal marshal
process results process results Send
process args
marshal Receive
Send
unmarshal
process results
Receive time
unmarshal
execute request
marshal
Send

Receive
unmarshal
process results
Client Server Client Server
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.15
Monolithic kernel and microkernel

S4 .......

S1 S2 S3 S4 .......
.......
S1 S2 S3

Monolithic Kernel Microkernel


Key:

Server: Kernel code and data: Dynamically loaded server program:

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.16
The role of the microkernel

Middleware

Language Language OS emulation


support support subsystem
....
subsystem subsystem

Microkernel

Hardware

The microkernel supports middleware via subsystems

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.17
The architecture of Xen

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
1
8
Figure 7.18
Use of rings of privilege

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
1
9
Figure 7.19
Virtualization of memory management

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
2
0
Figure 7.20
Split device drivers

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
2
1
Figure 7.21
I/O rings

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
2
2
Figure 7.22
The XenoServer Open Platform Architecture

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
2
3

You might also like