[haiku-bugs] Re: [Haiku] #2817: setpriority and getpriority are missing to compile ocaml out of the box under Haiku

  • From: "Timothy_Gu" <trac@xxxxxxxxxxxx>
  • Date: Thu, 15 Jan 2015 23:59:04 -0000

#2817: setpriority and getpriority are missing to compile ocaml out of the box
under Haiku
----------------------------+----------------------------
   Reporter:  oco           |      Owner:  nobody
       Type:  enhancement   |     Status:  new
   Priority:  normal        |  Milestone:  Unscheduled
  Component:  System/POSIX  |    Version:  R1/Development
 Resolution:                |   Keywords:
 Blocked By:                |   Blocking:
Has a Patch:  0             |   Platform:  All
----------------------------+----------------------------

Comment (by Timothy_Gu):

 Replying to [comment:15 pulkomandy]:
 > There is a limitation with the approach you implemented in these
 patches: the priority only applies to existing threads.

 I assume you only mean `setpriority()` here, as `getpriority()` is kind of
 irrelevant to the next comment.

 > As discussed in this ticket, a better solution would be to have a
 process-global "nice" value and also use it when creating new threads to
 adjust their priorities.

 (Assuming by "process" you mean "team")

 This badly conflicts with the current kernel architecture:

 1. What if you spawn a new thread and change the niceness of the new
 thread to another level? Should the process niceness be changed? If so, to
 what value?
 2. Say you have a process with two threads, 0 with niceness 1 and 1 with
 2. Also assume we have chosen the process niceness to be the maximum
 numerical values of the niceness of all the threads, so 2 in this case.
 What if I spawn a new thread from thread 0? Should the new thread have 2
 or 1?
 3. I assume the `team_info` ABI is locked.

 A more viable approach is to fix `spawn_thread()` and `fork()` to use the
 niceness of the spawning thread, which is out-of-scope for this patch
 alone.

--
Ticket URL: <https://dev.haiku-os.org/ticket/2817#comment:16>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: