Difference between revisions of "Uno/Spec/Threading-Model"

From Apache OpenOffice Wiki
< Uno‎ | Spec
Jump to: navigation, search
m
m (Added category: Multi-Threading .)
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
author[[User:Kr|Kr]] <br>
+
Type: Specification State: draft Claim: optional
version: {{REVISIONID}} <br>
+
state:  draft         <br>
+
created: 12/12/2005    <br>
+
type:    specification  <br>
+
  
 +
==Feature==
 +
The [[../Runtime|Runtime]] provides dedicated support for implementing and handling
 +
* [[Uno/Term/Thread Safe|thread-safe]],
 +
* [[Uno/Term/Thread Unsafe|thread-unsafe]], and
 +
* [[Uno/Term/Thread Affine|thread-affine]]
 +
objects. The threading type of any code can be specified appropriately.
  
== UNO Threading Model ==
+
==Rationale==
 +
The [[Analysis/Multi-Threading| analysis of multi-threading]] shows OOo deficiencies wrt to multi-threading and [[Uno/Term/Thread Safe|thread-safeness]]. The [[Architecture/Goals for OOo Threading-Model&-Architecture|goals for the OOo Threading-Model & -Architecture]] identify three thread related types of code, which ([[Uno/Term/Thread Unsafe|thread-unsafe]], [[Uno/Term/Thread Safe|thread-safe]] and [[Uno/Term/Thread Affine|thread-affine]]).
  
; Feature
+
==API==
: A UNO Runtime provides support for implementing ''thread safe'', ''thread unsafe'' or ''thread affine'' code.  
+
Two thread related purposes:
 +
* <code>":unsafe"</code> - for [[Uno/Term/Thread Unsafe|thread-unsafe]] code.
 +
* <code>":affine"</code> - for [[Uno/Term/Thread Affine|thread-affine]] code.
  
: The UNO Threading Model allows code to leverage external locking, respectively to leverage thread specificy. Code can either be specified to be
+
==Dependencies==
:* thread safe, or to be
+
* [[Uno/Spec/Thread Affinity Bridge]]
:* thread unsafe, or to be
+
* [[Uno/Spec/Thread Unsafety Bridge]]
:* thread affine.
+
* [[Uno/Spec/Purpose Environment]]
 +
* [[Uno/Spec/Environment Stack]]
 +
* [[Uno/Spec/Cascaded Mapping]]
 +
* [[Uno/Spec/Environment Substitution]]
  
;; : Thread Safe Code
 
:: Thread safe code takes care of all threading issues, including locking critical sections etc. Code doing blocking I/O needs to be thread safe, so that system calls can be interrupted. Thread safe code may also be used to allow high concurrency, while avoiding the runtime overhead of external locking.
 
 
;; : Thread Unsafe Code
 
:: Thread unsafe code must not care of any threading issues, except thread affinity. Thread unsafe code must be implemented [[Thread Transparent]]. On the desgined level of granularity methods are guaranteed to not be called concurrently. The calling thread may vary over time.
 
: The Unsafe Threading Model should become the standard model of implementation. Ensuring all code to be in this Model and utilizing only one thread should give optimal performance without any threading overhead.
 
 
;; : The Thread Affine Code
 
:: Thread affine code must not care of any threading issues, ''including'' thread affinity. Thread affine code must be implemented [[Thread Transparent]]. On the designed level of granularity methods are guaranteed to not be called concurrelty. Thread calling thread ''does not'' vary over time.
 
: Declaring code to be thread affine is e.g. very usable for programming Windows thread affine APIs as OLE or WIN32.
 
 
 
; Rationale:
 
 
; API
 
: '''Purpose UNO Environments:''' The different threading models are accessible as standard UNO environments (CPP: uno/environment.h). Environment specifications (e.g. <code>"gcc3"</code>, <code>"java"</code>) are extended by "purpose" specifiers (e.g. <code>":mutex"</code>, <code>":thread"</code>), purpose specifiers may be chained (e.g. <code>":mutex:debug:test"</code>).
 
 
: The predefined purposes to objects according to their threading type are
 
:* <code>":mutex" </code> - for thread unsafe code,
 
:* <code>":thread"</code> - for thread affine code, and
 
:* <code>""      </code> - for thread safe code, to ensure compatibility with previous UNO versions.
 
 
: '''Stacked Environments:''' The current (purpose) environment does not only vary with the implementation language (e.g. Java or C++), but also with the executed codes declared threading type. Therefor an API for accessing the ''current'' environment is provided.
 
 
: '''Cascaded Mappings:''' Purpose environments may be passed to the Runtime for getting cascaded mappings (<code>"gcc3"</code> => <code>"java:mutex:debug"</code>).
 
 
: '''Implementation Environments:''' Client code as well as service code may be declared once, to either be thread safe, thread affine or thread unsafe.
 
 
; Dependencies
 
: [[Thread Environment]]
 
: [[Mutex Environment]]
 
: [[Cascaded Mapping]]
 
 
; Compatibility Issues: None.
 
  
 +
[[Category:Draft]]
 +
[[Category:Spec]]
 +
[[Category:Uno]]
 
[[Category:Uno:Spec]]
 
[[Category:Uno:Spec]]
 +
[[Category:Multi-Threading]]

Latest revision as of 07:08, 19 June 2007

Type: Specification State: draft Claim: optional

Feature

The Runtime provides dedicated support for implementing and handling

objects. The threading type of any code can be specified appropriately.

Rationale

The analysis of multi-threading shows OOo deficiencies wrt to multi-threading and thread-safeness. The goals for the OOo Threading-Model & -Architecture identify three thread related types of code, which (thread-unsafe, thread-safe and thread-affine).

API

Two thread related purposes:

Dependencies

Personal tools