OPERATING SYSTEM TRANSACTIONS Donald E. Porter, Owen S. Hofmann, Christopher J. Rossbach, Alexander Benn, and Emmett Witchel The University of Texas at.

Slides:



Advertisements
Similar presentations
Lazy Asynchronous I/O For Event-Driven Servers Khaled Elmeleegy, Anupam Chanda and Alan L. Cox Department of Computer Science Rice University, Houston,
Advertisements

Managing Multi-User Databases (1) IS 240 – Database Management Lecture #18 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
1 Episode III in our multiprocessing miniseries. Relaxed memory models. What I really wanted here was an elephant with sunglasses relaxing On a beach,
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
Year 6 mental test 5 second questions
Data recovery 1. 2 Recovery - introduction recovery restoring a system, after an error or failure, to a state that was previously known as correct have.
Concurrency control 1. 2 Introduction concurrency more than one transaction have access to data simultaneously part of transaction processing.
1 Term 2, 2004, Lecture 6, TransactionsMarian Ursu, Department of Computing, Goldsmiths College Transactions 3.
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Making the System Operational
TOCTTOU Attacks Don Porter CS 380S
Real Time Versions of Linux Operating System Present by Tr n Duy Th nh Quách Phát Tài 1.
Configuration management
Software change management
Debugging operating systems with time-traveling virtual machines Sam King George Dunlap Peter Chen CoVirt Project, University of Michigan.
Content Overview Virtual Disk Port to Intel platform
ABC Technology Project
1 of 27 DA1241 Archive Companies Last updated: March-2004 DA1241 Archive Companies.
August 2012 This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit
HORIZONT TWS/WebAdmin TWS/WebAdmin for Distributed
Read-Write Lock Allocation in Software Transactional Memory Amir Ghanbari Bavarsad and Ehsan Atoofian Lakehead University.
Squares and Square Root WALK. Solve each problem REVIEW:
Database Concurrency Control and Recovery
Lecture plan Transaction processing Concurrency control
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Operating System Transactions
OPERATING SYSTEMS SHOULD PROVIDE TRANSACTIONS Donald E. Porter and Emmett Witchel The University of Texas at Austin.
Indra Budi Transaction Indra Budi
Chapter 5 Test Review Sections 5-1 through 5-4.
© 2004, D. J. Foreman 1 Scheduling & Dispatching.
Addition 1’s to 20.
25 seconds left…...
Håkan Sundell, Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin.
Week 1.
We will resume in: 25 Minutes.
Chapter 16: Recovery System
The University of Adelaide, School of Computer Science
Monitoring Data Structures Using Hardware Transactional Memory Shakeel Butt 1, Vinod Ganapathy 1, Arati Baliga 2 and Mihai Christodorescu 3 1 Rutgers University,
Ensuring Operating System Kernel Integrity with OSck By Owen S. Hofmann Alan M. Dunn Sangman Kim Indrajit Roy Emmett Witchel Kent State University College.
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
1 Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory.
1 MetaTM/TxLinux: Transactional Memory For An Operating System Hany E. Ramadan, Christopher J. Rossbach, Donald E. Porter and Owen S. Hofmann Presenter:
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
TxLinux: Using and Managing Hardware Transactional Memory in an Operating System Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan,
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan, Aditya Bhandari, and Emmett Witchel - Presentation By Sathish P.
Sangman Kim, Michael Z. Lee, Alan M. Dunn, Owen S. Hofmann, Xuan Wang, Emmett Witchel, Donald E. Porter 1.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
PAVANI REDDY KATHURI TRANSACTION COMMUNICATION. OUTLINE 0 P ART I : I NTRODUCTION 0 P ART II : C URRENT R ESEARCH 0 P ART III : F UTURE P OTENTIAL 0 R.
Concurrency Control. Objectives Management of Databases Concurrency Control Database Recovery Database Security Database Administration.
Speculative Execution in a Distributed File System Ed Nightingale Peter Chen Jason Flinn University of Michigan.
Transactions. Transaction: Informal Definition A transaction is a piece of code that accesses a shared database such that each transaction accesses shared.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Hany E. Ramadan and Emmett Witchel University of Texas at Austin TRANSACT 2/15/2009 The Xfork in the Road to Coordinated Sibling Transactions.
Solving Difficult HTM Problems Without Difficult Hardware Owen Hofmann, Donald Porter, Hany Ramadan, Christopher Rossbach, and Emmett Witchel University.
Speculative Execution in a Distributed File System Ed Nightingale Peter Chen Jason Flinn University of Michigan Best Paper at SOSP 2005 Modified for CS739.
Architectural Features of Transactional Memory Designs for an Operating System Chris Rossbach, Hany Ramadan, Don Porter Advanced Computer Architecture.
Scaling a file system to many cores using an operation log
Changing thread semantics
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E
Lecture 2 Part 2 Process Synchronization
Hybrid Transactional Memory
Software Transactional Memory Should Not be Obstruction-Free
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

OPERATING SYSTEM TRANSACTIONS Donald E. Porter, Owen S. Hofmann, Christopher J. Rossbach, Alexander Benn, and Emmett Witchel The University of Texas at Austin

OS APIs don’t handle concurrency 2  OS is weak link in concurrent programming model  Can’t make consistent updates to system resources across multiple system calls  Race conditions for resources such as the file system  No simple work-around  Applications can’t express consistency requirements  OS can’t infer requirements

System transactions 3  System transactions ensure consistent updates by concurrent applications  Prototype called TxOS  Solve problems  System level race conditions (TOCTTOU)  Build better applications  LDAP directory server  Software installation

System-level races if(access(“foo”)) { fd = open(“foo”); write(fd,…); … } (root) symlink(“/etc/passwd”, “foo”); 4 foo == /etc/passwd Time-of-check-to-time-of-use (TOCTTOU) race condition

TOCTTOU race eliminated sys_xbegin(); if(access(“foo”)) { fd = open(“foo”); write(fd,…); … } sys_xend(); (root) symlink(“/etc/passwd”, “foo”); 5

 How to make consistent updates to stable storage? Database rename() Sys Tx Example 1: better application design 6 Application Technique Editor User directory service (LDAP) Enterprise data storage ???? Simple Complex

Ex 2: transactional software install sys_xbegin(); apt-get upgrade sys_xend();  A failed install is automatically rolled back  Concurrent, unrelated operations are unaffected  System crash: reboot to entire upgrade or none 7

System transactions  Simple API: sys_xbegin, sys_xend, sys_xabort  Transaction wraps group of system calls  Results isolated from other threads until commit  Transactions execute concurrently for performance  Conflicting transactions must serialize for safety  Conflict most often read & write of same datum  Too much serialization hurts performance 8

Related work 9  Developers changing syscall API for concurrency  Ad hoc, partial solutions: openat(), etc.  System transactions have been proposed and built  QuickSilver [SOSP ‘91], LOCUS [SOSP ’85]  Key contribution: new design and implementation  Uphold strong guarantees and good performance  System transactions != transactional memory  TxOS runs on commodity hardware

Outline  Example uses of system transactions  TxOS design and implementation  Evaluation 10

Building a transactional system 11  Version management  Private copies instead of undo log  Detect conflicts  Minimize performance impact of true conflicts  Eliminate false conflicts  Resolve conflicts  Non-transactional code must respect transactional code

TxOS in action 12 CPU 0 (low priority) sys_xbegin(); chmod(“f”, 0x755); sys_xend(); CPU 0 (low priority) sys_xbegin(); chmod(“f”, 0x755); sys_xend(); CPU 1 (high priority) sys_xbegin(); chown(“f”, 1001); sys_xend(); CPU 1 (high priority) sys_xbegin(); chown(“f”, 1001); sys_xend(); 0x x Inode “f” Header Private Copies 0x x Inode “f” Data 0x x Conflicting Annotation Conflicting Annotation Contention Mgr. Abort CPU 0 (lower prio) Inode “f” Data

System comparison 13 Previous SystemsTxOS Speculative write location Isolation mechanism Rollback mechanism Commit mechanism Deadlock prone Can cause priority inversion Shared data structures Two-phase locking Undo log Discard undo log, release locks Private copies of data structures Private copies + annotations Discard private copies Publish private copy by ptr swap

RAdd/De l Add/Del+R R Add/Del Add/Del+R RW R W Minimizing false conflicts 14 sys_xbegin(); create(“/tmp/foo”); sys_xend(); sys_xbegin(); create(“/tmp/bar”); sys_xend();  Insight: object semantics allow more permissive conflict definition and therefore more concurrency  TxOS supports precise conflict definitions per object type  Increases concurrency without relaxing isolation RAdd/Del R OK if different files created, Dir not read OK if different files created, Dir not read

Serializing transactions and non- transactions (strong isolation) 15  TxOS mixes transactional and non-tx code  In database, everything is transaction  Semantically murky in historical systems  Critical to correctness  Allows incremental adoption of transactions  TOCTTOU attacker will not use a transaction  Problem: can’t roll back non-transactional syscall  Always aborting transaction undermines fairness

Strong isolation in TxOS 16 CPU 0 symlink(“/etc/passwd”, “/tmp/foo”); CPU 0 symlink(“/etc/passwd”, “/tmp/foo”); CPU 1 sys_xbegin(); if(access(“/tmp/foo”)) open(“/tmp/foo”); sys_xend(); CPU 1 sys_xbegin(); if(access(“/tmp/foo”)) open(“/tmp/foo”); sys_xend(); Dentry “/tmp/foo” Header Dentry “/tmp/foo” Data Conflicting Annotation Conflicting Annotation  Options:  Abort CPU1  Deschedule CPU0 Contention Manager Contention Manager

Transactions for application state 17  System transactions only manage system state  Applications can select their approach  Copy-on-write paging  Hardware or Software Transactional Memory (TM)  Application-specific compensation code

Transactions: a core OS abstraction 18  Easy to make kernel subsystems transactional  Transactional filesystems in TxOS  Transactions implemented in VFS or higher  FS responsible for atomic updates to stable store  Journal + TxOS = Transactional Filesystem  1 developer-month transactional ext3 prototype

Evaluation 19  Example uses of system transactions  TxOS design and implementation  Evaluation  What is the cost of using transactions?  What overheads are imposed on non-transactional applications?

TxOS Prototype 20  Extend Linux to support system transactions  Add 8,600 LOC to Linux  Minor modifications to 14,000 LOC  Runs on commodity hardware  Transactional semantics for a range of resources:  File system, signals, processes, pipes

Hardware and benchmarks 21  Quadcore 2.66 GHz Intel Core 2 CPU, 4 GB RAM BenchmarkDescription installinstall of svn makeCompile nano 2.06 inside a tx dpkgdpkg install OpenSSH 4.6 LFS large/smallWrap each phase in a tx RABReimplemeted Andrew Benchmark Each phase in a tx

Transactional software install  A failed install is automatically rolled back  Concurrent, unrelated operations are unaffected  System crash: reboot to entire upgrade or none 22 sys_xbegin(); dpkg –i openssh; sys_xend(); 10% overhead sys_xbegin(); install svn; sys_xend(); 70% overhead

Transaction overheads 23  Memory overheads on LFS large:  13% high, 5% low (kernel)

Write speedups 24  Better I/O scheduling – not luck  Tx boundaries provide I/O scheduling hint to OS

Lightweight DB alternative 25  OpenLDAP directory server  Replace BDB backend with transactions + flat files  2-4.2x speedup on write-intensive workloads  Comparable performance on read-only workloads  Primarily serviced from memory cache rename() Databases Sys Tx

Non-transactional overheads 26  Non-transactional Linux compile: <2% on TxOS  Transactions are “pay-to-play”  Single system call: 42% geometric mean  With additional optimizations: 14% geomean  Optimizations approximated by eliding checks

What is practical? 27  Feature creep over 2 years costs 16%  Developers are willing to give up performance for useful features  Transactions are in same range (14%), more powerful

OSes should support transactions  Practical implementation techniques for modern OS  Transactions solve long-standing problems  Replace ad hoc solutions  Transactions enable better concurrent programs 28

Backup Slides 29

Windows kernel transaction manager 30  Framework for 2-Phase Commit  Coordinate transactional file system, registry  Transactional FS and registry  Completely different implementation  FS updates in place, Registry uses private copies  Little opportunity for code reuse across subsystems  Explicitly transacted code  More conservative, limited design choice  TxOS allows implicit transactions, application wrappers

Distributed transactions 31  User/language-level transactions  Cannot isolate OS managed resources  TABS [SOSP ‘85], Argus [SOSP ‘87], Sinfonia [SOSP ’07]  TABS – transactional windows manager  Grayed out aborted dialog  Argus – similar strategies for limiting false conflicts

Transactional file systems 32  Good idea, difficult to implement  Challenging to implement below VFS layer  Valor [FAST ‘09] introduces OS support in page cache  Lack simple abstractions  Users must understand implementation details Deadlock detection (Transactional NTFS) Logging and locking mechanism (Valor)  Lack support for other OS resources in transactions  Windows KTM supports transactional registry

Speculator 33  Goal: hide latency of operations  NFS client requests, synchronous writes, etc.  Similar implementation at points  Different goals, not sufficient to provide transactional semantics  Isolation vs. dependences

xCalls [EuroSys ’09] 34  User-level techniques for transactional system calls  Within a single application only  Works for many common cases (buffering writes)  Edge cases difficult without system support E.g., close() or munmap() can implicitly delete a file