gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10960 - in gnunet: . src/util


From: gnunet
Subject: [GNUnet-SVN] r10960 - in gnunet: . src/util
Date: Sat, 17 Apr 2010 19:45:48 +0200

Author: grothoff
Date: 2010-04-17 19:45:48 +0200 (Sat, 17 Apr 2010)
New Revision: 10960

Modified:
   gnunet/TODO
   gnunet/src/util/os_priority.c
   gnunet/src/util/scheduler.c
   gnunet/src/util/test_os_start_process.c
Log:
change process priority based on scheduling priority

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-04-17 16:53:42 UTC (rev 10959)
+++ gnunet/TODO 2010-04-17 17:45:48 UTC (rev 10960)
@@ -1,27 +1,13 @@
 0.9.0pre1:
 * PEERINFO:
   - trust: need *fast* way to check/update trust in peers
-           (async peerinfo would not be right; certainly not with the
-            current API)
+           (async peerinfo would not be right; certainly not with the current 
API)
+* STATISTICS:
+  - does not seem to work with timeouts (especially if service is not running)
 * UTIL:
-  - scheduler should change OS process priority based on task priority;   
-    should make better use of task priorities in general
   - only connect() sockets that are ready (select()) [Nils]
     [On W32, we need to select after calling socket before
      doing connect etc.]
-* SETUP:
-  - design & implement new setup tool
-* TBENCH: [MW]
-  - good to have for transport/DV evaluation! 
-* DV: [Nate]
-  - write DV API (need to move declarations from dv_api.c to 
gnunet_dv_service.h!)
-  - implement DV service 
-  - implement DV library (looks done)
-  - implement DV transport plugin
-  - implement testcases 
-  - implement performance tests
-* STATISTICS:
-  - does not seem to work with timeouts (especially if service is not running)
 * TOPOLOGY:
   - needs more testing (especially F2F topology)
   - needs to re-try connecting after disconnect (currently, it
@@ -52,6 +38,9 @@
     more balanced load)
   - check if new HELLO learned is different from old HELLO
     before resetting entire state!
+* DATASTORE:
+  - API lacks cancellation methods (needed? or is disconnect enough?); 
+    may also want to integrate request queuing here instead of 
gnunet-service-fs_drq.c 
 * FS: [CG]
   - support recursive download even if filename is NULL and we hence
     do not generate files on disk (use temp_filename)
@@ -71,18 +60,26 @@
   - [gnunet-service-fs.c:700]: member 
'ConnectedPeer::last_client_replies_woff' is never used
   - GAP improvements:
     + active reply route caching design & implementation of service; gap 
extension!
-* DATASTORE:
-  - API lacks cancellation methods (needed? or is disconnect enough?); 
-    may also want to integrate request queuing here instead of 
gnunet-service-fs_drq.c 
+* TBENCH: [MW]
+  - good to have for transport/DV evaluation! 
+* DV: [Nate]
+  - write DV API (need to move declarations from dv_api.c to 
gnunet_dv_service.h!)
+  - implement DV service 
+  - implement DV library (looks done)
+  - implement DV transport plugin
+  - implement testcases 
+  - implement performance tests
 * GNUNET-GTK:
   - use g_main_context_set_poll_func to integrate GTK with GNUnet Scheduler!? 
(YUCK!)
   - OR: add scheduler API to enable integration with GTK main loop instead of 
doing our own select
   - use g_main_context_pending, g_main_context_query / g_main_context_check / 
g_main_context_dispatch
     and NEVER g_main_loop_run (can this be done? might be the clean way to do 
this! But how
-    to integrate this with "tak_main"?  Docu says:
+    to integrate this with "gtk_main"?  Docu says:
     "It's OK to use the GLib main loop directly instead of gtk_main(), though 
it involves 
      slightly more typing. See GMainLoop in the GLib documentation."
     => so maybe it "just works"?
+* SETUP:
+  - design & implement new setup tool
 
 0.9.0pre2:
 * TRACEKIT: [MW]

Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2010-04-17 16:53:42 UTC (rev 10959)
+++ gnunet/src/util/os_priority.c       2010-04-17 17:45:48 UTC (rev 10960)
@@ -62,6 +62,8 @@
                                 enum GNUNET_SCHEDULER_Priority prio)
 {
   int rprio = 0;
+  int have;
+  int delta;
 
   GNUNET_assert (prio < GNUNET_SCHEDULER_PRIORITY_COUNT);
   if (prio == GNUNET_SCHEDULER_PRIORITY_KEEP)
@@ -69,35 +71,39 @@
   /* convert to MINGW/Unix values */
   switch (prio)
     {
-    case GNUNET_SCHEDULER_PRIORITY_DEFAULT:
+    case GNUNET_SCHEDULER_PRIORITY_UI:
+    case GNUNET_SCHEDULER_PRIORITY_URGENT:
 #ifdef MINGW
-      rprio = NORMAL_PRIORITY_CLASS;
+      rprio = HIGH_PRIORITY_CLASS;
 #else
       rprio = 0;
 #endif
       break;
+
     case GNUNET_SCHEDULER_PRIORITY_HIGH:
 #ifdef MINGW
       rprio = ABOVE_NORMAL_PRIORITY_CLASS;
 #else
-      rprio = -5;
+      rprio = 5;
 #endif
       break;
-    case GNUNET_SCHEDULER_PRIORITY_BACKGROUND:
+
+    case GNUNET_SCHEDULER_PRIORITY_DEFAULT:
 #ifdef MINGW
-      rprio = BELOW_NORMAL_PRIORITY_CLASS;
+      rprio = NORMAL_PRIORITY_CLASS;
 #else
-      rprio = 10;
+      rprio = 7;
 #endif
       break;
-    case GNUNET_SCHEDULER_PRIORITY_UI:
-    case GNUNET_SCHEDULER_PRIORITY_URGENT:
+
+    case GNUNET_SCHEDULER_PRIORITY_BACKGROUND:
 #ifdef MINGW
-      rprio = HIGH_PRIORITY_CLASS;
+      rprio = BELOW_NORMAL_PRIORITY_CLASS;
 #else
-      rprio = -10;
+      rprio = 10;
 #endif
       break;
+
     case GNUNET_SCHEDULER_PRIORITY_IDLE:
 #ifdef MINGW
       rprio = IDLE_PRIORITY_CLASS;
@@ -113,10 +119,15 @@
 #ifdef MINGW
   SetPriorityClass (GetCurrentProcess (), rprio);
 #else
-  if (proc == getpid ())
+  if ( (0 == proc) ||
+       (proc == getpid () ) )
     {
+      have = nice (0);
+      delta = rprio - have;
       errno = 0;
-      if ((-1 == nice (rprio)) && (errno != 0))
+      if ( (rprio != 0) &&
+          (-1 == nice (delta)) && 
+          (errno != 0) )
         {
           GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
                                GNUNET_ERROR_TYPE_BULK, "nice");

Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2010-04-17 16:53:42 UTC (rev 10959)
+++ gnunet/src/util/scheduler.c 2010-04-17 17:45:48 UTC (rev 10960)
@@ -25,6 +25,7 @@
  */
 #include "platform.h"
 #include "gnunet_common.h"
+#include "gnunet_os_lib.h"
 #include "gnunet_scheduler_lib.h"
 #include "gnunet_signal_lib.h"
 #include "gnunet_time_lib.h"
@@ -167,6 +168,11 @@
    */
   enum GNUNET_SCHEDULER_Priority current_priority;
 
+  /**
+   * How 'nice' are we right now?
+   */
+  int nice_level;
+
 };
 
 
@@ -495,7 +501,11 @@
       GNUNET_assert (pos != NULL);      /* ready_count wrong? */
       sched->ready[p] = pos->next;
       sched->ready_count--;
-      sched->current_priority = pos->priority;
+      if (sched->current_priority != pos->priority)
+       {
+         sched->current_priority = pos->priority;
+         GNUNET_OS_set_process_priority (0, pos->priority);
+       }
       sched->active_task = pos;
       tc.sched = sched;
       tc.reason = pos->reason;

Modified: gnunet/src/util/test_os_start_process.c
===================================================================
--- gnunet/src/util/test_os_start_process.c     2010-04-17 16:53:42 UTC (rev 
10959)
+++ gnunet/src/util/test_os_start_process.c     2010-04-17 17:45:48 UTC (rev 
10960)
@@ -103,7 +103,7 @@
 {
   char *fn;
   const struct GNUNET_DISK_FileHandle *stdout_read_handle;
-  struct GNUNET_DISK_FileHandle *wh;
+  const struct GNUNET_DISK_FileHandle *wh;
 
   GNUNET_asprintf(&fn, "cat");
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]