CLEANING UP OOo MULTI-THREADING ● Kay Ramme – Senior Technical Architect – StarOffice/OpenOffice.org UDK Project Lead ● Sun Microsystems.

Slides:



Advertisements
Similar presentations
Chapter 5 Processes and Threads Copyright © 2008.
Advertisements

Process Concept An operating system executes a variety of programs
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Chapter 2 (PART 1) Light-Weight Process (Threads) Department of Computer Science Southern Illinois University Edwardsville Summer, 2004 Dr. Hiroshi Fujinoki.
What’s TSP ? Code : STM#340 STM#340: What’s TSP ?
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
CSC Multiprocessor Programming, Spring, 2011 Chapter 9 – GUI Applications Dr. Dale E. Parson, week 11.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
1 OS Review Processes and Threads Chi Zhang
CS533 - Concepts of Operating Systems 1 Threads, Events, and Reactive Objects - Alan West.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
General Introduction and prospect Makoto Asai (SLAC PPA/SCA)
Adding Concurrency to a Programming Language Peter A. Buhr and Glen Ditchfield USENIX C++ Technical Conference, Portland, Oregon, U. S. A., August 1992.
Java Thread Programming
Chapter 4 – Thread Concepts
Introduction to threads
Chapter 3: Windows7 Part 5.
Object Oriented Programming in
A brief intro to: Parallelism, Threads, and Concurrency
OPERATING SYSTEM CONCEPT AND PRACTISE
Chapter 4: Threads.
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
LOCO Extract – Transform - Load
PA1 Discussion.
Operating Systems (CS 340 D)
Sujata Ray Dey Maheshtala College Computer Science Department
Practice Chapter Four.
Scheduler activations
Chapter 2: System Structures
Chapter 4 – Thread Concepts
Process Management Presented By Aditya Gupta Assistant Professor
Other Important Synchronization Primitives
Real-time Software Design
Operating Systems (CS 340 D)
Operating System Concepts
Operating Systems and Systems Programming
Concurrency: Threads, Address Spaces, and Processes
Chapter 3: Windows7 Part 5.
Chapter 4: Threads.
Lecture 2: Processes Part 1
ICS 143 Principles of Operating Systems
Recap OS manages and arbitrates resources
Concurrency: Threads, Address Spaces, and Processes
Present by Andie Saizan, MCP
Lecture Topics: 11/1 General Operating System Concepts Processes
Threads and Concurrency
CSCE 313 – Introduction to UNIx process
Sujata Ray Dey Maheshtala College Computer Science Department
CHAPTER 4:THreads Bashair Al-harthi OPERATING SYSTEM
Design Components are Code Components
Multithreaded Programming
PeopleSoft Grants Julie Gustafson Product Strategy Manager
Teneo Ganymede Simultaneous Release Graduation Review
Prof. Leonardo Mostarda University of Camerino
Chapter 3: Processes.
Why Threads Are A Bad Idea (for most purposes)
- When you approach operating system concepts there might be several confusing terms that may look similar but in fact refer to different concepts:  multiprogramming, multiprocessing, multitasking,
ITAS Cash Management Integration to an ERP
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
CS703 – Advanced Operating Systems
Light-Weight Process (Threads)
Chapter 13: I/O Systems.
Concurrency: Threads, Address Spaces, and Processes
Chapter 3: Process Management
CS Introduction to Operating Systems
Presentation transcript:

CLEANING UP OOo MULTI-THREADING ● Kay Ramme – Senior Technical Architect – StarOffice/OpenOffice.org UDK Project Lead ● Sun Microsystems

2 Agenda Current Use of Multi-Threading... Opportunities for Improvement... In an Ideal World... Proposed Solution... Current Implementations... The Plan... Q&A... May be some Deep Diving...

3 Current Use of Multi-Threading Basically single threaded, some dedicated threads: > Windows clipboard > Windows drag&drop > VOS timer > UCB-helper background loader > Acceptor thread(s) > Configuration flasher > ICE thread >... Uno request threads. Everything implemented thread-safe.

4 Opportunities for Improvement (see for details) Does not scale with multiple clients, CPUs,... No documentation regarding threading-model or - architecture. It is not (really) thread-safe. Fragile / no systematic approach to thread-safeness. Every developer has to take care of multi-threading. Hard to implement OLE/COM based components: > Thread-affinity has to be encapsulated. > All OSL threads are OLE/COM MTA.

5 Opportunities for Improvement (continued) (see for details) Subtle dependencies against the “main-thread“, > because VCL being thread-affine. Performance penalties because of much locking etc. (e.g. Interlock counters). Increased code size and complexity because of multi-thread constraints (locking). Long lasting (slow) operations blocking the GUI (partly addressed with polling). Competing threading models, Uno VCL.

6 In an Ideal World (see for details) Always Responsive GUI... Scales with multiple clients, CPUs,... Systematic approach to concurrency... Simple to implement and use... Exactly one threading-model Good Documentation...

7 Always Responsive GUI GUI is soft real time. Long lasting (slow) operations, e.g. > loading, > printing, > saving, respectively > I/O in general need to be offloaded. Want to use dedicated threads for this. Need to ensure scalable I/O (UCB).

8 Scales with Multiple Clients, CPUs Scalability basically is about parallelism. OOo could scale on a... > application level – documents of different applications can be manipulated in parallel, > document level – multiple documents can be manipulated in parallel, > window level – every window can process events in parallel, >... Need to identify scaling sensitive code.

9 Systematic Approach to Concurrency (See for details) Automatic External locking. Only few thread-aware code. Only well tested thread-aware code. Support for encapsulating thread-affinity. Defined scalability.

10 Simple to Implement and Use In clients and services code. Be conservative, only require thread related programming where actually necessary. No surprise (thread-transparent): > No call back by another thread. > No asynchronous call backs. > Every activity is triggered by the client. Code can just marked to be either > thread-safe, > thread-unsafe, or > thread-affine.

11 Documentation Have specifications. Have implementation Descriptions. Have Tutorials / Best Practices. Publicly provide implementation status. Document everything in the wiki.

12 Proposed Solution (See for details) Drop VCL threading-model. Extend Unos threading-model. Switch all code to be thread-unsafe, except scaling sensitive parts (UCB, Config Manager). Fix thread-affinity. Introduce I/O threads. Enhance scalability step-wise, as needed only.

13 Current State Proof of Concept in CWS UTF2. Asynchronous Dialogs ~80% (Intel, CH2000, Sun). Uno threading-model extension nearly ready - 90%. Thread-Affinity fix is on the way – about 80%. Switch to thread-unsafe is ongoing - about 85%. Introducing I/O threads – open. Enhance scalability – open. Document in the wiki – about 85%.

14 The Plan Finish&Integrate new threading-model / - architecture. Remove outdated thread related constructs. Introduce I/O threads. And finally, switch to an event driven architecture...

15 Questions & Answers

16 Deep Diving Outlook... How Uno is going to support thread related code... Making VCL Thread-Transparent... Switching OOo to thread-unsafe... History...

17 Outlook Use a running office process not only for GUI, but also for other services (3 rd party integrations). This would be a push for more scalability / parallelism.

18 Unos Extended Threading-Model (See for details) Background > Environments – to manage objects of same OBI (and purposes) > Mappings – to map from one environment to another > Objects – the actual functionality Concrete > Map thread-unsafe objects to become thread-safe > Map thread-affine objects to become thread-safe Tutorials > Working with Environments, Mappings & Objects > Multi-Thread Programming

19 Unos Extended Threading-Model (See for details) Purpose Environments: “ [:purpose]*” Environment Stacking Cascaded Mappings > “ [:purpose]*” “ [:purpose]*” Two new, thread related purposes: > “:unsafe” > “:affine” Bootstrapping support

20 Make VCL Thread-Transparent (see for details) Problem: > VCL inherits Windows thread-affinity. > VCL provides the Solar-Mutex. > The solar mutex becomes released wrongly, in some situations. Fixing this introduces regressions because of “Dialog::execute”. > DDE depends on the “main” thread... Tasks: > Encapsulate thread-affinity by using a dedicated thread. > Remove the Solar-Mutex. > Replace “Dialog::execute” where necessary (Intel - D.Keskar).

21 Switching OOo to Thread-Unsafe Find Uno components a mark them as thread- unsafe. Find threads, make them use Unos extending threading-model. Take a look at the libraries / private APIs, mark them as thread-unsafe. FIND all EXCEPTIONS.

22 History ~1997: “Horst” introduced multi-threading. ~1998: “Horst” and Markus introduced the beloved Solar-Mutex. 2000: Markus asked me briefly, to spend some thoughts on this and to (just) solve it. 2002: I heard the same from Jörg (Heilig). 2002: Kai (Sommerfeld) and I started our journey to finally solve this. 2005: Intel / Dhananjay (Keskar) jumped on. 2006: Still on my way... but seem to be close.

23 Some Links y.../wiki/Spec/Threading-Model.../wiki/Spec/Threading-Architecture

CLEANING UP OOo MULTI-THREADING ● Kay Ramme –