[haiku-bugs] Re: [Haiku] #8007: [app_server] fully unresponsive when resizing window of big textfile

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Sun, 08 Sep 2013 16:27:53 -0000

#8007: [app_server] fully unresponsive when resizing window of big textfile
-----------------------------+----------------------------
   Reporter:  ttcoder        |      Owner:  axeld
       Type:  bug            |     Status:  new
   Priority:  normal         |  Milestone:  R1
  Component:  System/Kernel  |    Version:  R1/Development
 Resolution:                 |   Keywords:
 Blocked By:                 |   Blocking:  7882, 8136
Has a Patch:  1              |   Platform:  All
-----------------------------+----------------------------

Comment (by bonefish):

 Since `sPortsLock` doesn't only protect the ports hash table but also
 `Team::port_list` and `Port::owner` only using a lock-free data structure
 won't suffice. Maybe you addressed that as well?

 Anyway, regarding optimizing the ports code, the following improvements
 come to mind:
  * Being a global lock `sPortsLock` shouldn't be used as an outer lock.
 The locking order `sPortsLock` -> `Port::lock` should be reversed. That
 requires making `Port` a `BReferenceable`, so `get_locked_port()` needs to
 hold `sPortsLock` only while incrementing the reference. Acquiring the
 port's lock would be done after already having unlocked `sPortsLock`.
 There are more changes necessary all over the ports code to make this work
 correctly, but it shouldn't be too hard.
  * `sPortsLock` could be made a R/W lock. In the most common use cases
 (reading from/writing to a port) there aren't any changes done to the data
 the lock guards.
  * A port-by-name hash table should be added, so that `find_port()`
 doesn't have to iterate through all ports. The function is e.g. used
 whenever a `BRoster` is created.

--
Ticket URL: <http://dev.haiku-os.org/ticket/8007#comment:85>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: