Author: gonzalo
Date: 2005-05-05 01:02:30 -0400 (Thu, 05 May 2005)
New Revision: 44061

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/threadpool.c
Log:
2005-05-04 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * threadpool.c: changed the default number of threads per cpu. From now
        on, the default will be 20 + (5 * number of cpus) instead of 50.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2005-05-05 04:13:42 UTC (rev 44060)
+++ trunk/mono/mono/metadata/ChangeLog  2005-05-05 05:02:30 UTC (rev 44061)
@@ -1,3 +1,8 @@
+2005-05-04 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * threadpool.c: changed the default number of threads per cpu. From now
+       on, the default will be 20 + (5 * number of cpus) instead of 50.
+
 2005-05-04  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * loader.c (mono_method_get_signature_full): Add locking here.

Modified: trunk/mono/mono/metadata/threadpool.c
===================================================================
--- trunk/mono/mono/metadata/threadpool.c       2005-05-05 04:13:42 UTC (rev 
44060)
+++ trunk/mono/mono/metadata/threadpool.c       2005-05-05 05:02:30 UTC (rev 
44061)
@@ -15,11 +15,10 @@
 #ifdef PLATFORM_WIN32
 #define WINVER 0x0500
 #define _WIN32_WINNT 0x0500
-#define THREADS_PER_CPU        25
-#else
-#define THREADS_PER_CPU        50
 #endif
 
+#define THREADS_PER_CPU        5 /* 20 + THREADS_PER_CPU * number of CPUs */
+
 #include <mono/metadata/domain-internals.h>
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/threads.h>
@@ -54,9 +53,9 @@
 #undef EPOLL_DEBUG
 
 /* maximum number of worker threads */
-static int mono_max_worker_threads = THREADS_PER_CPU;
-static int mono_min_worker_threads = 0;
-static int mono_io_max_worker_threads = THREADS_PER_CPU * 2;
+static int mono_max_worker_threads;
+static int mono_min_worker_threads;
+static int mono_io_max_worker_threads;
 
 /* current number of worker threads */
 static int mono_worker_threads = 0;
@@ -732,6 +731,9 @@
        g_assert (data->pipe [0] != INVALID_SOCKET);
        closesocket (srv);
 #endif
+       mono_io_max_worker_threads = mono_max_worker_threads / 2;
+       if (mono_io_max_worker_threads < 10)
+               mono_io_max_worker_threads = 10;
 
        data->sock_to_state = g_hash_table_new (g_direct_hash, g_direct_equal);
 
@@ -929,13 +931,13 @@
        ares_htable = mono_g_hash_table_new (NULL, NULL);
        job_added = CreateSemaphore (NULL, 0, 0x7fffffff, NULL);
        GetSystemInfo (&info);
-       if (getenv ("MONO_THREADS_PER_CPU") != NULL) {
-               threads_per_cpu = atoi (getenv ("MONO_THREADS_PER_CPU"));
+       if (g_getenv ("MONO_THREADS_PER_CPU") != NULL) {
+               threads_per_cpu = atoi (g_getenv ("MONO_THREADS_PER_CPU"));
                if (threads_per_cpu <= 0)
                        threads_per_cpu = THREADS_PER_CPU;
        }
 
-       mono_max_worker_threads = threads_per_cpu * info.dwNumberOfProcessors;
+       mono_max_worker_threads = 20 + threads_per_cpu * 
info.dwNumberOfProcessors;
 }
 
 MonoAsyncResult *

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to