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

From Apache OpenOffice Wiki
< Uno‎ | Spec
Jump to: navigation, search
(reworked:)
m (Added category: Multi-Threading .)
 
(30 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>
+
changed: 03/06/2006    <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
+
[[Category:Draft]]
:: 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.
+
[[Category:Spec]]
: 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.
+
[[Category:Uno]]
 
+
[[Category:Uno:Spec]]
;; : The Thread Affine Code
+
[[Category:Multi-Threading]]
:: 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
+
: '''Extended Environment Types:''' The different threading models are implemented as standard UNO environments (CPP: uno/environment.h). Environment specifications (e.g. "gcc3", "java") are extended by "purpose" specifiers (e.g. ":mutex", ":thread").
+
 
+
: 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.
+
 
+
: '''Getting the Current Environment:''' The current purpose environment does not only vary with the implementation language (e.g. Java or G++), but also with the codes declared threading type. Therefor an API for accessing the ''current'' environment is provided.
+
 
+
; Dependencies: None.
+
 
+
; Compatibility Issues: None.
+

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