diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-09-12 05:04:13 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-09-12 05:04:13 +0000 |
commit | 0f640560421b0fe314e02f394b3216674d37639d (patch) | |
tree | 0bafa221895df8c254f8992da8114f2d3e0ef417 | |
parent | cef1d13d2e3ff43857bc32dfb657f7bacbc844bb (diff) | |
download | ATCD-0f640560421b0fe314e02f394b3216674d37639d.tar.gz |
Old Direct mapping revived as Continuous mapping.
-rw-r--r-- | TAO/docs/Options.html | 22 | ||||
-rw-r--r-- | TAO/docs/rtcorba/features.html | 25 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp | 130 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Continuous_Priority_Mapping.h | 75 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Continuous_Priority_Mapping.i | 1 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Direct_Priority_Mapping.h | 1 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Makefile | 1 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Makefile.bor | 1 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/RT_ORBInitializer.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/RT_ORBInitializer.h | 1 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/RT_ORB_Loader.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/TAO_RTCORBA.dsp | 12 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/TAO_RTCORBA_Static.dsp | 12 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Policy_Combinations/README | 39 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Policy_Combinations/client.cpp | 20 | ||||
-rwxr-xr-x | TAO/tests/RTCORBA/Policy_Combinations/run_test.pl | 8 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Policy_Combinations/server.cpp | 104 | ||||
-rw-r--r-- | TAO/threadpool-changes | 58 |
18 files changed, 418 insertions, 102 deletions
diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index 969ab823447..5fef6ab2f06 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -939,7 +939,7 @@ superseded by <code><A HREF="#-ORBReactorType">-ORBReactorType</A></code>. into the native OS priority range, but in some operating systems the range depends on the scheduling policy used. Valid values are <B>SCHED_OTHER</B>, <B>SCHED_FIFO</B> and - <B>SCHED_RR</B>. Default to <B>SCHED_OTHER</B>. Note that in + <B>SCHED_RR</B>. Defaults to <B>SCHED_OTHER</B>. Note that in some operating systems some of the scheduling policies require super user privileges. </TD> @@ -955,16 +955,18 @@ superseded by <code><A HREF="#-ORBReactorType">-ORBReactorType</A></code>. <TR> <TD><CODE>-ORBPriorityMapping</CODE> <EM>mapping_type</EM></TD> <TD><a name="-ORBPriorityMapping"></a> - Select the priority mapping to use. - The default resource factory provide two priority mapping - implementations, <B>linear</B> selects a linear mapping between + + Select the priority mapping to use. There are three priority + mappings provided by TAO: the <B>linear</B> mapping maps between the CORBA range of priorities and the native range of - priorities for the selected scheduling policy. - The <B>direct</B> mapping maps the first <B>n</B> CORBA - priorities to the range of native priorities, - where <B>n</B> is the number of native priorities. - In all the operating systems where TAO is supported the range of - CORBA priorities is larger than the native set. + priorities; the <B>direct</B> mapping maps CORBA priorities + directly to native priorities; and the <B>continuous</B> maps + the first <i>n</i> CORBA priorities to the range of native + priorities, where <i>n</i> is the number of native priorities. + + Defaults to <B>direct</B>. Note that <B>continuous</B> was + previously referred to as <B>direct</B>. + </TD> </TR> diff --git a/TAO/docs/rtcorba/features.html b/TAO/docs/rtcorba/features.html index 0ea93ee2c23..b93c52d1a50 100644 --- a/TAO/docs/rtcorba/features.html +++ b/TAO/docs/rtcorba/features.html @@ -35,12 +35,27 @@ unless Minimum CORBA support is turned on, <i>i.e.</i>, <h3><a name="mappings">Priority Mappings </a></h3> -<p>TAO provides two Priority Mappings, Direct and Linear, described below: </p> +<p>TAO provides three Priority Mappings: Direct, Linear, and +Continuous. If no mapping is specified, Direct Priority Mappings will +be used. Note that Continuous was previously referred to as +Direct.</p> <dl> <dt><b>Direct</b></dt> +<dd>Maps CORBA priorities directly to native priorities.</dd> + +<dt><b>Linear</b></dt> + +<dd>Maps each individual native priority to a contiguous range of +CORBA priorities, so that the complete CORBA priority range is used up +for the mapping. See +<CODE>$TAO_ROOT/tao/Strategies/Linear_Priority_Mapping.cpp </CODE>for +more details.</dd> + +<dt><b>Continuous</b></dt> + <dd>Maps the first <i>n</i> CORBA priorities to the range of native priorities, where <i>n</i> is the number of native priorities. The lowest native priority is mapped to CORBA priority 0, next higher @@ -52,14 +67,6 @@ native priorities -15 -2 -1 0 1 2 15 are mapped to CORBA priorities 0 1 2 3 4 5 6, respectively, and the rest of the CORBA priority range is not used.</dd> - <dt><b>Linear</b></dt> - -<dd>Maps each individual native priority to a contiguous range of -CORBA priorities, so that the complete CORBA priority range is used up -for the mapping. See -<CODE>$TAO_ROOT/tao/Strategies/Linear_Priority_Mapping.cpp </CODE>for -more details.</dd> - </dl> <p>Priority mappings implement the rules for mapping CORBA priority diff --git a/TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp new file mode 100644 index 00000000000..fe50a6d7e4d --- /dev/null +++ b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp @@ -0,0 +1,130 @@ +// $Id$ + +#include "Continuous_Priority_Mapping.h" +#include "ace/Sched_Params.h" + +#if !defined (__ACE_INLINE__) +# include "Continuous_Priority_Mapping.i" +#endif /* ! __ACE_INLINE__ */ + +ACE_RCSID(RTCORBA, Continuous_Priority_Mapping, "$Id: ") + +TAO_Continuous_Priority_Mapping::TAO_Continuous_Priority_Mapping (int policy) + : policy_ (policy) +{ + this->min_ = + ACE_Sched_Params::priority_min (this->policy_); + + this->max_ = + ACE_Sched_Params::priority_max (this->policy_); +} + +TAO_Continuous_Priority_Mapping::~TAO_Continuous_Priority_Mapping (void) +{ +} + +CORBA::Boolean +TAO_Continuous_Priority_Mapping::to_native (RTCORBA::Priority corba_priority, + RTCORBA::NativePriority &native_priority) +{ + if (corba_priority < 0) + return 0; + +#if defined (ACE_WIN32) + + int current_native_priority = this->min_; + int next_native_priority; + for (int i = 1; i <= corba_priority; ++i) + { + next_native_priority = + ACE_Sched_Params::next_priority (this->policy_, + current_native_priority); + + if (next_native_priority == current_native_priority) + return 0; + + current_native_priority = next_native_priority; + } + + native_priority = current_native_priority; + return 1; + +#else + + if (this->min_ < this->max_) + { + native_priority = corba_priority + this->min_; + if (native_priority > this->max_) + return 0; + } + else if (this->min_ > this->max_) + { + native_priority = this->min_ - corba_priority; + if (native_priority < this->max_) + return 0; + } + else + { + // There is only one native priority. + if (corba_priority != 0) + return 0; + + native_priority = this->min_; + } + + return 1; + +#endif /* ACE_WIN32 */ + +} + +CORBA::Boolean +TAO_Continuous_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority, + RTCORBA::Priority &corba_priority) +{ + +#if defined (ACE_WIN32) + + int current_native_priority = this->min_; + for (corba_priority = 0; ; ++corba_priority) + { + if (current_native_priority == native_priority) + return 1; + + else if (current_native_priority == this->max_) + return 0; + + else + current_native_priority = + ACE_Sched_Params::next_priority (this->policy_, + current_native_priority); + } + +#else + + if (this->min_ < this->max_) + { + if (native_priority < this->min_ + || native_priority > this->max_) + return 0; + corba_priority = native_priority - this->min_; + } + else if (this->min_ > this->max_) + { + if (native_priority > this->min_ + || native_priority < this->max_) + return 0; + corba_priority = this->min_ - native_priority; + } + else if (this->min_ == this->max_) + { + if (native_priority != this->min_) + return 0; + corba_priority = 0; + } + + return 1; + +#endif /* ACE_WIN32 */ + +} diff --git a/TAO/tao/RTCORBA/Continuous_Priority_Mapping.h b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.h new file mode 100644 index 00000000000..820df1379fb --- /dev/null +++ b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.h @@ -0,0 +1,75 @@ +//============================================================================= +/** + * @file Continuous_Priority_Mapping.h + * + * $Id$ + * + * @author Irfan Pyarali + */ +// =================================================================== + +#ifndef TAO_CONTINUOUS_PRIORITY_MAPPING_H +#define TAO_CONTINUOUS_PRIORITY_MAPPING_H + +#include "ace/pre.h" +#include "tao/orbconf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "rtcorba_export.h" +#include "Priority_Mapping.h" + +/** + * @class TAO_Continuous_Priority_Mapping + * + * @brief Maps the first n CORBA priorities to the range of native + * priorities, where n is the number of native priorities. + * + * The lowest native priority is mapped to CORBA priority 0, next + * higher native priority is mapped to CORBA priority 1, and so + * on. Since in all the operating systems where TAO is supported the + * native priority set contains less than 32767 priorities, part of + * the CORBA priority range is left unused. Consider NT as an + * example. NT native priorities -15 -2 -1 0 1 2 15 are mapped to + * CORBA priorities 0 1 2 3 4 5 6, respectively, and the rest of the + * CORBA priority range is not used. + * + * This class was previously called Direct_Priority_Mapping. + * + * \nosubgrouping + * + **/ +class TAO_RTCORBA_Export TAO_Continuous_Priority_Mapping + : public TAO_Priority_Mapping +{ +public: + + /// Constructor. + TAO_Continuous_Priority_Mapping (int policy = ACE_SCHED_OTHER); + + /// Destructor. + ~TAO_Continuous_Priority_Mapping (void); + + /// Convert CORBA priority to native priority. + CORBA::Boolean to_native (RTCORBA::Priority corba_priority, + RTCORBA::NativePriority &native_priority); + + /// Convert native priority to CORBA priority. + CORBA::Boolean to_CORBA (RTCORBA::NativePriority native_priority, + RTCORBA::Priority &corba_priority); + +private: + int policy_; + int min_; + int max_; +}; + +#if defined (__ACE_INLINE__) +# include "Continuous_Priority_Mapping.i" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" + +#endif /* TAO_CONTINUOUS_PRIORITY_MAPPING_H */ diff --git a/TAO/tao/RTCORBA/Continuous_Priority_Mapping.i b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/tao/RTCORBA/Direct_Priority_Mapping.h b/TAO/tao/RTCORBA/Direct_Priority_Mapping.h index f6d7cb5070f..640f9435927 100644 --- a/TAO/tao/RTCORBA/Direct_Priority_Mapping.h +++ b/TAO/tao/RTCORBA/Direct_Priority_Mapping.h @@ -31,7 +31,6 @@ class TAO_RTCORBA_Export TAO_Direct_Priority_Mapping : public TAO_Priority_Mapping { - // // = TITLE // A simple implementation of the Priority_Mapping interface // diff --git a/TAO/tao/RTCORBA/Makefile b/TAO/tao/RTCORBA/Makefile index 00bb6394df0..63df94108c9 100644 --- a/TAO/tao/RTCORBA/Makefile +++ b/TAO/tao/RTCORBA/Makefile @@ -25,6 +25,7 @@ ifeq ($(corba_messaging),1) CPP_SRCS += \ + Continuous_Priority_Mapping \ Direct_Priority_Mapping \ Linear_Priority_Mapping \ RT_Thread_Lane_Resources_Manager \ diff --git a/TAO/tao/RTCORBA/Makefile.bor b/TAO/tao/RTCORBA/Makefile.bor index 2e77010ee70..8cbfede95ce 100644 --- a/TAO/tao/RTCORBA/Makefile.bor +++ b/TAO/tao/RTCORBA/Makefile.bor @@ -5,6 +5,7 @@ NAME = TAO_RTCORBA OBJFILES = \ + $(OBJDIR)\Continuous_Priority_Mapping.obj \ $(OBJDIR)\Direct_Priority_Mapping.obj \ $(OBJDIR)\Linear_Priority_Mapping.obj \ $(OBJDIR)\RT_Thread_Lane_Resources_Manager.obj \ diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp index 83d76cbcb6b..c9e95c163db 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp @@ -19,6 +19,7 @@ ACE_RCSID (TAO, RT_ORBInitializer, "$Id$") #include "RT_ORB_Loader.h" #include "RT_Stub_Factory.h" #include "RT_Endpoint_Selector_Factory.h" +#include "Continuous_Priority_Mapping.h" #include "Linear_Priority_Mapping.h" #include "Direct_Priority_Mapping.h" #include "RT_ORB.h" @@ -91,6 +92,10 @@ TAO_RT_ORBInitializer::pre_init ( TAO_Priority_Mapping *pm; switch (this->priority_mapping_type_) { + case TAO_PRIORITY_MAPPING_CONTINUOUS: + ACE_NEW (pm, + TAO_Continuous_Priority_Mapping (sched_policy)); + break; case TAO_PRIORITY_MAPPING_LINEAR: ACE_NEW (pm, TAO_Linear_Priority_Mapping (sched_policy)); diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.h b/TAO/tao/RTCORBA/RT_ORBInitializer.h index d90a160eaab..d119a26e52b 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.h +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.h @@ -45,6 +45,7 @@ public: // Priority mapping types enum { + TAO_PRIORITY_MAPPING_CONTINUOUS, TAO_PRIORITY_MAPPING_LINEAR, TAO_PRIORITY_MAPPING_DIRECT }; diff --git a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp index 16e9bfc76f7..e32fd36fd83 100644 --- a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp +++ b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp @@ -48,7 +48,10 @@ TAO_RT_ORB_Loader::init (int argc, char *name = argv[curarg]; if (ACE_OS::strcasecmp (name, - "linear") == 0) + "continuous") == 0) + priority_mapping_type = TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_CONTINUOUS; + else if (ACE_OS::strcasecmp (name, + "linear") == 0) priority_mapping_type = TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_LINEAR; else if (ACE_OS::strcasecmp (name, "direct") == 0) diff --git a/TAO/tao/RTCORBA/TAO_RTCORBA.dsp b/TAO/tao/RTCORBA/TAO_RTCORBA.dsp index 279079d61e1..9d3671c9980 100644 --- a/TAO/tao/RTCORBA/TAO_RTCORBA.dsp +++ b/TAO/tao/RTCORBA/TAO_RTCORBA.dsp @@ -156,6 +156,10 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE=.\Continuous_Priority_Mapping.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.cpp
# End Source File
# Begin Source File
@@ -248,6 +252,10 @@ SOURCE=.\RT_Thread_Lane_Resources_Manager.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
+SOURCE=.\Continuous_Priority_Mapping.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.h
# End Source File
# Begin Source File
@@ -344,6 +352,10 @@ SOURCE=.\RT_Thread_Lane_Resources_Manager.h # PROP Default_Filter ".i"
# Begin Source File
+SOURCE=.\Continuous_Priority_Mapping.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.i
# End Source File
# Begin Source File
diff --git a/TAO/tao/RTCORBA/TAO_RTCORBA_Static.dsp b/TAO/tao/RTCORBA/TAO_RTCORBA_Static.dsp index 8527d2d246c..49b7dd78a44 100644 --- a/TAO/tao/RTCORBA/TAO_RTCORBA_Static.dsp +++ b/TAO/tao/RTCORBA/TAO_RTCORBA_Static.dsp @@ -95,6 +95,10 @@ LIB32=link.exe -lib # PROP Default_Filter "i,inl"
# Begin Source File
+SOURCE=.\Continuous_Priority_Mapping.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.i
# End Source File
# Begin Source File
@@ -155,6 +159,10 @@ SOURCE=.\Thread_Pool.i # PROP Default_Filter "h"
# Begin Source File
+SOURCE=.\Continuous_Priority_Mapping.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.h
# End Source File
# Begin Source File
@@ -251,6 +259,10 @@ SOURCE=.\Thread_Pool.h # PROP Default_Filter "cpp"
# Begin Source File
+SOURCE=.\Continuous_Priority_Mapping.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.cpp
# End Source File
# Begin Source File
diff --git a/TAO/tests/RTCORBA/Policy_Combinations/README b/TAO/tests/RTCORBA/Policy_Combinations/README index d5d1ddebee2..7dd8ed6e665 100644 --- a/TAO/tests/RTCORBA/Policy_Combinations/README +++ b/TAO/tests/RTCORBA/Policy_Combinations/README @@ -19,21 +19,26 @@ Test combines and tests several RT policies in different ways. - In addition to testing servants in the RootPOA and in a simple child POA, the following policy combinations are tested in this example: - ________________________________________ - - Thread-pool BANDS PRIORITY MODEL - ________________________________________ - - Default Pool NO CLIENT_PROPAGATED - Default Pool NO SERVER_DECLARED - Without Lanes NO CLIENT_PROPAGATED - Without Lanes NO SERVER_DECLARED - With Lanes NO CLIENT_PROPAGATED - With Lanes NO SERVER_DECLARED - Default Pool YES CLIENT_PROPAGATED - Default Pool YES SERVER_DECLARED - Without Lanes YES CLIENT_PROPAGATED - Without Lanes YES SERVER_DECLARED - With Lanes YES CLIENT_PROPAGATED - With Lanes YES SERVER_DECLARED + ________________________________________________________________________________ + + Thread-pool BANDS PRIORITY MODEL Client Priority Server Priority + ________________________________________________________________________________ + + Default Pool NO CLIENT_PROPAGATED 3 3 + Default Pool NO SERVER_DECLARED 3 5 + Without Lanes NO CLIENT_PROPAGATED 1 1 + Without Lanes NO SERVER_DECLARED 1 5 + With Lanes NO CLIENT_PROPAGATED 2 2 + With Lanes NO SERVER_DECLARED 3 5 + Default Pool YES CLIENT_PROPAGATED 3 3 + Default Pool YES SERVER_DECLARED 1 5 + Without Lanes YES CLIENT_PROPAGATED 1 1 + Without Lanes YES SERVER_DECLARED 3 5 + With Lanes YES CLIENT_PROPAGATED 3 2 + With Lanes YES SERVER_DECLARED 1 5 + + where the priorities are relative to the minimum priority of the + thread scheduling policy used for the test. + +- This test uses the -ORBPriorityMapping continuous option. diff --git a/TAO/tests/RTCORBA/Policy_Combinations/client.cpp b/TAO/tests/RTCORBA/Policy_Combinations/client.cpp index 28da801e2ec..bf74a4cd00e 100644 --- a/TAO/tests/RTCORBA/Policy_Combinations/client.cpp +++ b/TAO/tests/RTCORBA/Policy_Combinations/client.cpp @@ -2,6 +2,7 @@ #include "ace/Get_Opt.h" #include "testC.h" +#include "tao/ORB_Core.h" #include "tao/RTCORBA/RTCORBA.h" #include "../check_supported_priorities.cpp" @@ -72,6 +73,25 @@ main (int argc, char **argv) if (result != 0) return result; + // The following sets the current thread to the lowest priority + // for this scheduling policy. This will give us the biggest + // range on NT since the default priority is 0 where as the + // lowest priority is -15. + ACE_hthread_t current_thread; + ACE_Thread::self (current_thread); + + long sched_policy = + orb->orb_core ()->orb_params ()->sched_policy (); + + int minimum_priority = + ACE_Sched_Params::priority_min (sched_policy); + + result = + ACE_Thread::setprio (current_thread, + minimum_priority); + if (result != 0) + return result; + CORBA::Object_var object = orb->resolve_initial_references ("RTCurrent", ACE_TRY_ENV); diff --git a/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl b/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl index 300eeda77cc..ba5ea0cf50a 100755 --- a/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl +++ b/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl @@ -14,14 +14,14 @@ $status = 0; ( "root", "child", - "default_lane_no_bands_client_propagated", - "default_lane_no_bands_server_declared", + "default_pool_no_bands_client_propagated", + "default_pool_no_bands_server_declared", "no_lanes_no_bands_client_propagated", "no_lanes_no_bands_server_declared", "lanes_no_bands_client_propagated", "lanes_no_bands_server_declared", - "default_lane_bands_client_propagated", - "default_lane_bands_server_declared", + "default_pool_bands_client_propagated", + "default_pool_bands_server_declared", "no_lanes_bands_client_propagated", "no_lanes_bands_server_declared", "lanes_bands_client_propagated", diff --git a/TAO/tests/RTCORBA/Policy_Combinations/server.cpp b/TAO/tests/RTCORBA/Policy_Combinations/server.cpp index f7e8a2d603e..4fc38f62c2d 100644 --- a/TAO/tests/RTCORBA/Policy_Combinations/server.cpp +++ b/TAO/tests/RTCORBA/Policy_Combinations/server.cpp @@ -2,6 +2,7 @@ #include "ace/Get_Opt.h" #include "testS.h" +#include "tao/ORB_Core.h" #include "tao/RTPortableServer/RTPortableServer.h" #include "../check_supported_priorities.cpp" @@ -74,10 +75,10 @@ test_i::prioritized_method (CORBA::Environment &ACE_TRY_ENV) ACE_CHECK; ACE_DEBUG ((LM_DEBUG, - "test_i::prioritized_method suppose to run at priority %d " - "and is running at priority %d\n", - this->server_priority_, - priority)); + "test_i::prioritized_method: client = %d server = %d (should be %d)\n", + this->client_priority_, + priority, + this->server_priority_)); ACE_ASSERT (this->server_priority_ == priority); } @@ -185,7 +186,7 @@ public: const char *test_name, CORBA::Environment &ACE_TRY_ENV); - void test_default_lane_poa (CORBA::Short server_priority, + void test_default_pool_poa (CORBA::Short server_priority, CORBA::Short client_priority, server::test_function function, const char *test_name, @@ -234,25 +235,25 @@ public: const char *test_name, CORBA::Environment &ACE_TRY_ENV); - void test_default_lane_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); + void test_default_pool_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); void test_no_lanes_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); void test_lanes_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); - void test_default_lane_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); + void test_default_pool_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); void test_no_lanes_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); void test_lanes_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV); - void test_default_lane_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); + void test_default_pool_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); void test_no_lanes_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); void test_lanes_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); - void test_default_lane_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); + void test_default_pool_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); void test_no_lanes_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV); @@ -342,7 +343,7 @@ server::test_child_poa (CORBA::Environment &ACE_TRY_ENV) } void -server::test_default_lane_poa (CORBA::Short server_priority, +server::test_default_pool_poa (CORBA::Short server_priority, CORBA::Short client_priority, server::test_function function, const char *test_name, @@ -370,10 +371,10 @@ server::test_bands_poa (CORBA::PolicyList &policies, bands[0].low = default_thread_priority; bands[0].high = default_thread_priority; - bands[1].low = ::server_priority; - bands[1].high = ::server_priority; - bands[2].low = ::client_priority; - bands[2].high = ::client_priority; + bands[1].low = ::server_priority - 1; + bands[1].high = ::server_priority + 1; + bands[2].low = ::client_priority - 1; + bands[2].high = ::client_priority + 1; policies.length (policies.length () + 1); policies[policies.length () - 1] = @@ -546,12 +547,12 @@ server::test_bands_client_propagated_poa (CORBA::PolicyList &policies, } void -server::test_default_lane_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV) +server::test_default_pool_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV) { - this->test_default_lane_poa (::client_priority, - ::client_priority, + this->test_default_pool_poa (::client_priority + 1, + ::client_priority + 1, &server::test_no_bands_client_propagated_poa, - "default_lane_no_bands_client_propagated", + "default_pool_no_bands_client_propagated", ACE_TRY_ENV); ACE_CHECK; } @@ -579,12 +580,12 @@ server::test_lanes_no_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_E } void -server::test_default_lane_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV) +server::test_default_pool_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV) { - this->test_default_lane_poa (::client_priority - 1, - ::client_priority - 1, + this->test_default_pool_poa (::client_priority + 1, + ::client_priority + 1, &server::test_bands_client_propagated_poa, - "default_lane_bands_client_propagated", + "default_pool_bands_client_propagated", ACE_TRY_ENV); ACE_CHECK; } @@ -604,7 +605,7 @@ void server::test_lanes_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV) { this->test_lanes_poa (::client_priority, - ::client_priority, + ::client_priority + 1, &server::test_bands_client_propagated_poa, "lanes_bands_client_propagated", ACE_TRY_ENV); @@ -684,12 +685,12 @@ server::test_bands_server_declared_poa (CORBA::PolicyList &policies, } void -server::test_default_lane_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) +server::test_default_pool_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) { - this->test_default_lane_poa (::server_priority, - ::client_priority, + this->test_default_pool_poa (::server_priority, + ::client_priority + 1, &server::test_no_bands_server_declared_poa, - "default_lane_no_bands_server_declared", + "default_pool_no_bands_server_declared", ACE_TRY_ENV); ACE_CHECK; } @@ -698,7 +699,7 @@ void server::test_no_lanes_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) { this->test_no_lanes_poa (::server_priority, - ::client_priority, + ::client_priority - 1, &server::test_no_bands_server_declared_poa, "no_lanes_no_bands_server_declared", ACE_TRY_ENV); @@ -709,7 +710,7 @@ void server::test_lanes_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) { this->test_lanes_poa (::server_priority, - ::client_priority, + ::client_priority + 1, &server::test_no_bands_server_declared_poa, "lanes_no_bands_server_declared", ACE_TRY_ENV); @@ -717,12 +718,12 @@ server::test_lanes_no_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV } void -server::test_default_lane_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) +server::test_default_pool_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) { - this->test_default_lane_poa (::server_priority, - ::client_priority, + this->test_default_pool_poa (::server_priority, + ::client_priority - 1, &server::test_bands_server_declared_poa, - "default_lane_bands_server_declared", + "default_pool_bands_server_declared", ACE_TRY_ENV); ACE_CHECK; } @@ -731,7 +732,7 @@ void server::test_no_lanes_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) { this->test_no_lanes_poa (::server_priority, - ::client_priority, + ::client_priority + 1, &server::test_bands_server_declared_poa, "no_lanes_bands_server_declared", ACE_TRY_ENV); @@ -742,7 +743,7 @@ void server::test_lanes_bands_server_declared_poa (CORBA::Environment &ACE_TRY_ENV) { this->test_lanes_poa (::server_priority, - ::client_priority, + ::client_priority - 1, &server::test_bands_server_declared_poa, "lanes_bands_server_declared", ACE_TRY_ENV); @@ -775,6 +776,25 @@ main (int argc, char **argv) ACE_TRY_ENV); ACE_TRY_CHECK; + // The following sets the current thread to the lowest priority + // for this scheduling policy. This will give us the biggest + // range on NT since the default priority is 0 where as the + // lowest priority is -15. + ACE_hthread_t current_thread; + ACE_Thread::self (current_thread); + + long sched_policy = + orb->orb_core ()->orb_params ()->sched_policy (); + + int minimum_priority = + ACE_Sched_Params::priority_min (sched_policy); + + int result = + ACE_Thread::setprio (current_thread, + minimum_priority); + if (result != 0) + return result; + object = orb->resolve_initial_references ("RTCurrent", ACE_TRY_ENV); @@ -790,12 +810,12 @@ main (int argc, char **argv) ACE_TRY_CHECK; client_priority = - default_thread_priority + 1; + default_thread_priority + 2; server_priority = - default_thread_priority + 2; + default_thread_priority + 5; - int result = + result = parse_args (argc, argv); if (result != 0) return result; @@ -825,10 +845,10 @@ main (int argc, char **argv) server.test_child_poa (ACE_TRY_ENV); ACE_TRY_CHECK; - server.test_default_lane_no_bands_client_propagated_poa (ACE_TRY_ENV); + server.test_default_pool_no_bands_client_propagated_poa (ACE_TRY_ENV); ACE_TRY_CHECK; - server.test_default_lane_no_bands_server_declared_poa (ACE_TRY_ENV); + server.test_default_pool_no_bands_server_declared_poa (ACE_TRY_ENV); ACE_TRY_CHECK; server.test_no_lanes_no_bands_client_propagated_poa (ACE_TRY_ENV); @@ -843,10 +863,10 @@ main (int argc, char **argv) server.test_lanes_no_bands_server_declared_poa (ACE_TRY_ENV); ACE_TRY_CHECK; - server.test_default_lane_bands_client_propagated_poa (ACE_TRY_ENV); + server.test_default_pool_bands_client_propagated_poa (ACE_TRY_ENV); ACE_TRY_CHECK; - server.test_default_lane_bands_server_declared_poa (ACE_TRY_ENV); + server.test_default_pool_bands_server_declared_poa (ACE_TRY_ENV); ACE_TRY_CHECK; server.test_no_lanes_bands_client_propagated_poa (ACE_TRY_ENV); diff --git a/TAO/threadpool-changes b/TAO/threadpool-changes index 8d60d7bdcca..47233a32883 100644 --- a/TAO/threadpool-changes +++ b/TAO/threadpool-changes @@ -328,6 +328,22 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> class such that it is really direct, i.e., corba priority maps verbatim to native priority and vice versa. + * tao/RTCORBA/Continuous_Priority_Mapping.cpp: Maps the first + n CORBA priorities to the range of native priorities, where + n is the number of native priorities. + + The lowest native priority is mapped to CORBA priority 0, + next higher native priority is mapped to CORBA priority 1, + and so on. Since in all the operating systems where TAO is + supported the native priority set contains less than 32767 + priorities, part of the CORBA priority range is left unused. + Consider NT as an example. NT native priorities -15 -2 -1 0 + 1 2 15 are mapped to CORBA priorities 0 1 2 3 4 5 6, + respectively, and the rest of the CORBA priority range is + not used. + + This class was previously called Direct_Priority_Mapping. + * tao/RTCORBA/RT_ORBInitializer.cpp (pre_init): Set the scheduling policy and scope policy into ORB Parameters. Also, converted THR_SCHED_* values into ACE_SCHED_* values. @@ -366,7 +382,8 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> * tao/RTCORBA/TAO_RTCORBA_Static.dsp: Removed Pool_Per_Endpoint; added - RT_Thread_Lane_Resources_Manager. + RT_Thread_Lane_Resources_Manager and + Continuous_Priority_Mapping. * tao/ORB_Core.cpp: @@ -804,23 +821,28 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> - In addition to testing servants in the RootPOA and in a simple child POA, the following policy combinations are tested in this example: - ________________________________________ - - Thread-pool BANDS PRIORITY MODEL - ________________________________________ - - Default Pool NO CLIENT_PROPAGATED - Default Pool NO SERVER_DECLARED - Without Lanes NO CLIENT_PROPAGATED - Without Lanes NO SERVER_DECLARED - With Lanes NO CLIENT_PROPAGATED - With Lanes NO SERVER_DECLARED - Default Pool YES CLIENT_PROPAGATED - Default Pool YES SERVER_DECLARED - Without Lanes YES CLIENT_PROPAGATED - Without Lanes YES SERVER_DECLARED - With Lanes YES CLIENT_PROPAGATED - With Lanes YES SERVER_DECLARED + ________________________________________________________________________________ + + Thread-pool BANDS PRIORITY MODEL Client Priority Server Priority + ________________________________________________________________________________ + + Default Pool NO CLIENT_PROPAGATED 3 3 + Default Pool NO SERVER_DECLARED 3 5 + Without Lanes NO CLIENT_PROPAGATED 1 1 + Without Lanes NO SERVER_DECLARED 1 5 + With Lanes NO CLIENT_PROPAGATED 2 2 + With Lanes NO SERVER_DECLARED 3 5 + Default Pool YES CLIENT_PROPAGATED 3 3 + Default Pool YES SERVER_DECLARED 1 5 + Without Lanes YES CLIENT_PROPAGATED 1 1 + Without Lanes YES SERVER_DECLARED 3 5 + With Lanes YES CLIENT_PROPAGATED 3 2 + With Lanes YES SERVER_DECLARED 1 5 + + where the priorities are relative to the minimum priority + of the thread scheduling policy used for the test. + + - This test uses the -ORBPriorityMapping continuous option. * tests/RTCORBA/Linear_Priority: This is a test for the Linear Priority mapping in TAO. In addition, this test combines |