operating systems in a multicore world - cornell · pdf fileoperating system state ......

37
Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish Operating Systems in a Multicore World Colin Ponce CS 6210 Professor: Ken Birman September 3, 2012 Colin Ponce CS 6210 Professor: Ken Birman Operating Systems in a Multicore World

Upload: hoangdang

Post on 11-Mar-2018

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Operating Systems in a Multicore World

Colin PonceCS 6210

Professor: Ken Birman

September 3, 2012

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 2: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

The Rise of the Multicore

Multicore computer: A computer with more than one CPU.

I 1960-1990: Multicore existed in mainframes andsupercomputers.

I 1990’s: Introduction of commodity multicore servers.

I 2000’s: Multicores placed on personal computers.

I Soon: Everywhere except embedded systems?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 3: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Why Multicore Research Matters

I Multicore machines have been getting more and more general.

I New types of computation introduced at each step ofgenerality.

I Very thorny issues!

I Why deal with these issues?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 4: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

The Power Wall

1

Making computers more powerful also means they run hotter. Canreduce power by reducing voltage, but can only go so far.

1Image by Hakim Weatherspoon, CS 3410 Lecture 23Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 5: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

The End of the General-Purpose Uniprocessor

2

2http://www.pcworld.com/article/116053/intel_changes_plans_

for_pentium_4.html

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 6: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Basic Multicore Concepts

Memory Sharing Styles:

I Uniform Memory Access (UMA)

I Non-Uniform Memory Access (NUMA)

I No Remote Memory Memory Access (NORMA)

Cache Coherence

Inter-Process (and inter-core) Communication

I Shared Memory

I Message Passing

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 7: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Writing Parallel Programs: Amdahl’s Law

3

Speedup given by parallel computation: 1(1−P)+P

S

3 http://en.wikipedia.org/wiki/File:AmdahlsLaw.svg

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 8: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Using Parallel Hardware

Experiment by Boyd-Wickizer et. al. on machine with fourquad-core AMD Operton chips running Linux 2.6.25.

n threads running on n cores:

i d = g e t t h r e a d i d ( ) ;f = c r e a t e f i l e ( i d ) ;w h i l e ( True ){

f 2 = dup ( f ) ;c l o s e ( f 2 ) ;

}

Embarrasingly parallel, so it’ll scale well, right?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 9: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Using Parallel Hardware

Experiment by Boyd-Wickizer et. al. on machine with fourquad-core AMD Operton chips running Linux 2.6.25.

n threads running on n cores:

i d = g e t t h r e a d i d ( ) ;f = c r e a t e f i l e ( i d ) ;w h i l e ( True ){

f 2 = dup ( f ) ;c l o s e ( f 2 ) ;

}

Embarrasingly parallel, so it’ll scale well, right?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 10: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Catastrophe!

4

4Boyd-Wickizer et. al., “Corey: An Operating System for Many Cores”Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 11: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Viewpoint: Hints from the application developer?

Application developer could provide the OS with hints on

I Parallelization opportunities

I Which data to share

I Which messages to pass

I Where to place data in memory

I Which cores should handle a given thread

Should hints be architecture specific?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 12: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Viewpoint: Hints from the application developer?

Example: OpenMP (Open MultiProcessing)

5

5http://en.wikipedia.org/wiki/OpenMP

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 13: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Viewpoint: A Single or Distributed System?

6

Figure : AMD Barcelona Quad-core, ca 2007

6Image by Hakim Weatherspoon, CS 3410 Lecture 23Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 14: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Viewpoint: A Single or Distributed System?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 15: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Viewpoint: A Single or Distributed System?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 16: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Viewpoint: A Single or Distributed System?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 17: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado

“Tornado: Maximizing Locality and Concurrency in a SharedMemory Multiprocessor Operating System”

Ben Gamsa, Orran Krieger, Jonathan Appavoo, Michael Stumm

OSDI 1999

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 18: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

State of Multicore in Late 90’s

Ten years prior, memory was fast relative to the CPU. During the90’s, CPU speeds improved over 5x as quickly as memory speeds.

Over the course of the 90’s, communication started to become abottleneck.

These problems are exacerbated in multicore systems.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 19: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado

Develops data structures and algorithms to minimize contentionand cross-core communication. Intended for use with multicoreservers.

These optimizations are all achieved through replication andpartitioning.

I Clustered Objects

I Protected Procedure Calls

I New locking strategy

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 20: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Clustered Objects

OS treats memory in an object-oriented manner.

Clustered objects are a form of object virtualization: present theillusion of a single object, but is actually composed of individualcomponents spread across the cores called representatives.

Can simply replicate an object, but can also partition functionalityacross the representatives.

Exactly how the representatives function is up to the developer.

Representative functionality can even be changed dynamically.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 21: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Clustered Objects

OS treats memory in an object-oriented manner.

Clustered objects are a form of object virtualization: present theillusion of a single object, but is actually composed of individualcomponents spread across the cores called representatives.

Can simply replicate an object, but can also partition functionalityacross the representatives.

Exactly how the representatives function is up to the developer.

Representative functionality can even be changed dynamically.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 22: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Clustered Objects

OS treats memory in an object-oriented manner.

Clustered objects are a form of object virtualization: present theillusion of a single object, but is actually composed of individualcomponents spread across the cores called representatives.

Can simply replicate an object, but can also partition functionalityacross the representatives.

Exactly how the representatives function is up to the developer.

Representative functionality can even be changed dynamically.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 23: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Protected Procedure Calls

Applicable during client-server interactions.

Virtualized similarly to clustered objects. Calls pass from a clienttask to a server task without leaving that core.

So a server also has representatives on each core.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 24: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Protected Procedure Calls

Applicable during client-server interactions.

Virtualized similarly to clustered objects. Calls pass from a clienttask to a server task without leaving that core.

So a server also has representatives on each core.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 25: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Locks

Locks are kept internal to an object, limiting the scope of the lockto reduce contention.

Locks can be partitioned by representative, allowing foroptimization.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 26: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Locks

Locks are kept internal to an object, limiting the scope of the lockto reduce contention.

Locks can be partitioned by representative, allowing foroptimization.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 27: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Discussion

Single vs Distributed System?

Demands on application developer?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 28: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Tornado: Discussion

Single vs Distributed System?

Demands on application developer?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 29: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Ten Years Later: Pollack’s Rule

“Thousand Core Chips–A Technology Perspective”

Shekhar Borkar

Pollack’s Rule: Performance increase is roughly proportional tothe square root of the increase in complexity.

Implication: Many small cores instead of a few large cores.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 30: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish

“The Multikernel: A new OS architecture for scalable multicoresystems”

Andrew Baumann, Paul Barham, Pierre-Evariste Dagand, TimHarris, Rebecca Isaacs, Simon Peter, Timothy Roscoe, Adrian

Schupbach, and Akhilesh Singhania

SOSP 2009

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 31: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish

I View multicore machines as networked, distributed systems.

I No inter-core communication except through message-passing.

I Create hardware-netural OS.

I Replicate state across cores.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 32: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish: A Networked System

Architectures are becoming increasingly diverse. Manyarrangements are possible in terms of

I Number of cores.

I Sharing of memory and caches.

I Types of cores within a system.

Especially with many-core systems, too difficult to view them assingle entities.

So view as distributed systems.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 33: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish: Message Passing

This is the only way for separate cores to communicate.

Advantages:

I Cache coherence protocols look like message passing anyways,just harder to reason about.

I Eases asynchronous application development.

I Enables rigorous, theoretical reasoning about communicationthrough tools like π-calculus.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 34: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish: A hardware-neutral OS

Separate the OS as much as possible from the hardware. Only twoaspects deal with specific architectures:

I Interface to hardware

I Message transport mechanisms

Advantages:

I Facilititates adapting an OS to new hardware, as there is onlya narrow bridge between OS and hardware.

I Allows easy and dynamic hardware- and situation-dependentmessage passing optimizations.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 35: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish: The multikernel

Operating system state (and potentially application state) is to bereplicated across cores as necessary.

OS state, in reality, may be a bit different from core to coredepending on needs, but that is behind the scenes.

I Reduces load on system interconnect and contention formemory.

I Allows us to specialize data structures on a core to its needs.

I Makes the system robust to architecture changes, failures, etc.

I Can leverage distributed systems research.

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 36: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Barrelfish: Discussion

Sufficiently optimizable?

Burden on the developer?

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World

Page 37: Operating Systems in a Multicore World - Cornell · PDF fileOperating system state ... Operating Systems in a Multicore World. Rise of the MulticoreBasic ConceptsThe Multicore ProblemOS

Rise of the Multicore Basic Concepts The Multicore Problem OS Design Philosophies Tornado Barrelfish

Thank you!

Colin Ponce CS 6210 Professor: Ken Birman

Operating Systems in a Multicore World