distributed (operating) systems -virtualization- -server design issues- -process and code migration-...

37
Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2014

Upload: jemimah-manning

Post on 27-Dec-2015

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Distributed (Operating) Systems -Virtualization-

-Server Design Issues- -Process and Code Migration-

Computer Engineering DepartmentDistributed Systems Course

Asst. Prof. Dr. Ahmet SayarKocaeli University - Fall 2014

Page 2: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

-Virtualization-

Page 3: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Resource Virtualization• On a single-processor computer, simultaneous execution is, of

course, an illusion.

• As there is only a single CPU, only an instruction from a single thread or process will be executed at a time.

• By rapidly switching between threads and processes, the illusion of parallelism is created

• The separation between having a single CPU and being able to pretend there are more can be extended to other resources as well, leading to what is known as resource virtualization.

Page 4: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Virtualization

• Virtualization: extend or replace an existing interface to mimic the behavior of another system.– Introduced in 1970s: Run legacy software on newer mainframe

hardware• Handle platform diversity by running apps in VMs

– Portability and flexibility

Page 5: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Virtualization

• Hardware - instruction sets• Software - API• Platform– Windows MI running on Windows 7

• Much higher level:– Middleware and its applications

Page 6: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Types of Interfaces

• Different types of interfaces1. Between hardware and software: Assembly instructions that can be invoked by

any program.2. Between OS and hardware: Assembly instructions by privileged programs3. System calls: Offered by OS4. Library functions: APIs

• Depending on what is replaced /mimicked, we obtain different forms of virtualization

Page 7: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Types of Virtualization1. Process Virtual Machines

• Runtime system that essentially provides an abstract instruction set that is to be used for executing applications.

• Instructions can be interpreted but could also be emulated as is done for running Windows applications on Unix platforms.– In this case, emulator also

mimic the system calls.

• Ex. JVM

Page 8: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Types of Virtualization 2. Virtual Machine Monitor VMM

• Typical examples are VMware and Xen

• Virtualization is implemented as a layer completely shielding hardware

• Offering the complete instruction sets

• Can be offered simultaneously to different programs at the same time

• It is possible to have multiple, and different operating systems run independently and concurrently on the same platform.

Page 9: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

-Server Design Issues-

Page 10: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Server Design Issues

• How to locate an end-point (port #)?– Well known port # 21 80 etc. - IANAa) Directory service (port mapper in Unix)b) Super server (inetd daemon in Unix)

Page 11: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

A. Client to server binding using a daemon

• Daemon runs servers and keeps track of current end point of each service implemented by a co-located server.

• The daemon itself listens to a well known end point. • A client will first contact the daemon, request the end point,

and then contact the specific server.

Page 12: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

B- Client to server binding using super server

• Super server is actually a daemon. Actually implementing each service by means of a separate server may be a waste of resources. Instead of having to keep track of so many passive processes, it is often more efficient to have a single superserver listening to each end point associated with a specific service.

• When a request comes in, the daemon forks a process to take further care of the request. The process will exit after it finishes.

Page 13: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Server Designs -more-1. Iterative or sequential

– Single process no threads in that process– Service one request at a time– No concurrency– Concurrent server: Does not handle the request itself but passes it to a

separate thread or another process. And wait for another request

2. Multithreaded – Every time new request comes in handed it to new thread– Full concurrency

3. Event-based– Sits in between 1 and 2– Single process with single thread– The way you emulate concurrency is that all calls are not blocking (non-

blocking IO)– Sequential calls and single process but you still get concurrency

Page 14: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Server Designs -more-Stateful or Stateless?

• Stateful server– Maintain state of connected clients– Sessions in web servers

• Stateless server– No state for clients

• Soft state– Maintain state for a limited time; discarding state does not impact

correctness• Compare stateful vs. stateless

– What if server crashes– Performance – in terms of different metrics– Session – no session in stateless servers

Page 15: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Server Clusters

• Collection of machines connected through a network, where each machine runs one or more servers

• Mostly connected with LAN having high bandwidth and low latency• Logically organized into three tiers

– Each tier may be optionally replicated; uses a dispatcher– Use TCP handoffs

Page 16: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

TCP hand off• Standard way of accessing server cluster – TCP connection• Transport layer switch• Switches accept incoming TCP connection requests and hand off

connections to one of the servers.

Page 17: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Switches and single access point• Switch can play an important role in distributing the load among the various

servers.• It can be seen that switch can play an important role in distributing the load among

the various servers load balancer (switch)– Switch can inspect the payload of the incoming request: content-aware request

distribution.– The simplest load-balancing policy that switch can follow is round robin. More advanced

server selection criteria can be deployed as well.

• Server Cluster Implementations1. HTTP redirecting

New connection comes - tells the browser the server available for the client. then browser talks to that replica to get the service – this is not transparent from the browser point of view (presence of replica is exposed to the client/browser)

2. TCP handoff (see previous slide)

Page 18: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Scalability

• Question : How can you scale the server capacity?– Buy bigger machine!– Replicate– Distribute data and/or algorithms– Ship code instead of data– Cache

Page 19: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

-Process and Code Migration-

Page 20: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Code and Process Migration

• Motivation• How does migration occur?• Resource migration• Agent-based system• Heterogeneous - Homogeneous systems• Which one is more complicated? – Code vs. process migration

• There are situations in which passing programs, sometimes even while they are being executed

Page 21: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Process migration- Strong Mobility -

• Key reasons: Performance and flexibility

• Entire process is moved from one machine to another.

• The overall system performance can be improved if the process is moved from the heavily loaded to lightly loaded machines.

• Better utilization of system-wide resources

• Distributed scheduling

• Examples: Condor

Page 22: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Code Migration- Weak Mobility -

• Basic motivation: Process data close to where those data resides

• Server to Client shipment: – Shipment of server code to client – filling forms (reduce communication, no

need to pre-link stubs with client)

• Client to Server Shipment:– Ship parts of client application to server instead of data from server to client

(e.g., databases)

• Improve parallelism – agent-based web searches

• Ex. Java applet, search engine – Google

Page 23: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Motivation - Code migration

• Flexibility– Dynamic configuration of distributed system– Clients don’t need preinstalled software – download on demand– The big area where it is becoming popular is drivers

Page 24: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Migration models

• Process = Code segment + Resource segment + Execution segment

• Weak versus strong mobility– Weak => transferred program starts from initial state

• Sender-initiated versus receiver-initiated• Sender-initiated (machine having the code)

– Migration initiated by machine where code resides– Client sending a query code to a database server

• Client should be pre-registered

• Receiver-initiated (machine receiving the code)– Migration initiated by machine that receives code– Java applets– Receiver can be anonymous

Page 25: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Who executes migrated entity?

• Code migration (weak mobility)1. Execute in a separate process2. [Applets] Execute in target process• Execute in the same process that downloaded the code• Process needs to be protected against malicious codes

• Process migration (strong mobility)1. Migrate the same process2. Create a clone and migrate it

1. Remote cloning (remote fork)

Page 26: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Models for Code Migration

Page 27: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

What about resource segmentDo Resources Migrate?

• So far, migration of the code and execution segment are mentioned. What about resource segment?

• Depends on resource to process binding– By identifier (strongest): specific web site, ftp server– By value: Java libraries– By type (weakest): printers, local devices

• Depends on type of “attachments”– Unattached to any node: Data files– Fastened resources (can be moved only at high cost)

• Local database, web sites

– Fixed resources• Can not be moved: Local devices, communication end points

Page 28: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Resource Migration Actions

• Actions to be taken with respect to the references to local resources when migrating code to another machine.

• GR: Establish global system-wide reference• MV: Move the resources• CP: Copy the resource• RB: Rebind process to locally available resource

Page 29: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Migration in Heterogeneous Systems• Systems can be heterogeneous (different architecture, OS)

1. Support only weak mobility: Recompile code, no run time information2. Strong mobility: Recompile code segment, transfer execution segment

[migration stack] (figure)3. Virtual machines - interpret source (scripts) or intermediate code [Java]

Page 30: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Case Studies

Back up slides

Page 31: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Case study: Agents

• Software agents– Autonomous process capable of reacting to, and

initiating changes in its environment, possibly in collaboration

– More than a “process” – can act on its own• Mobile agent– Capability to move between machines– Needs support for strong mobility– Example: D’Agents (aka Agent TCL)

• Support for heterogeneous systems, uses interpreted languages

Page 32: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Case Study: Viruses and Malware

• Viruses and malware are examples of mobile code– Malicious code spreads from one machine to another

• Sender-initiated:– proactive viruses that look for machines to infect

• Autonomous code• Receiver-initiated– User (receiver) clicks on infected web URL or opens

an infected email attachment

Page 33: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Case Study: PlanetLab

• Distributed cluster across universities– Used for experimental research by students and faculty in networking and

distributed systems• Uses a virtualized architecture

– Linux Vservers– Node manager per machine– Obtain a “slice” for an experiment: slice creation service

Page 34: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Case Study: ISOS

• Internet scale operating system– Harness compute cycles of thousands of PCs on the

Internet– PCs owned by different individuals– Donate CPU cycles/storage when not in use (pool

resources)– Contact coordinator for work– Coordinator: partition large parallel app into small tasks

• Assign compute/storage tasks to PCs

• Examples: Seti@home, P2P backups

Page 35: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Case study: Condor

• Condor: use idle cycles on workstations in a LAN

• Used to run large batch jobs, long simulations• Idle machines contact condor for work• Condor assigns a waiting job• User returns to workstation => suspend job,

migrate• Flexible job scheduling policies

Page 36: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

backup

Page 37: Distributed (Operating) Systems -Virtualization- -Server Design Issues- -Process and Code Migration- Computer Engineering Department Distributed Systems

Types of Virtualization

• Emulation– VM emulates/simulates complete hardware– Unmodified guest OS for a different PC can be run

• Bochs, VirtualPC for Mac, QEMU

• Full/native Virtualization– VM simulates “enough” hardware to allow an

unmodified guest OS to be run in isolation• Same hardware CPU– IBM VM family, VMWare Workstation, Parallels,…