Thread Distribution for Magenta:devmgr Process

The relationship between devmgr and devhost Let's move on to see what devmgr threads do today.After the latest version of Agata runs on Qemu, the following hierarchy appears after running the command "ps-T":

$ ps -T
TASK             PSS PRIVATE  SHARED   STATE NAME
j:1028         38.5M   37.0M                 root
  p:1043     9894.0k   9892k     28k         bin/devmgr
    t:1046                           blocked bin/devmgr
    t:1084                           blocked mxio-dispatcher
    t:1100                           blocked local-multiloader
    t:1135                           blocked service-starter
  j:1075       26.4M   25.7M                 magenta-drivers
    p:1168    430.0k    428k     28k         /boot/bin/acpisvc
      t:1218                         blocked initial-thread
      t:1370                         blocked thrd_t:0x36b0ee2cfb30/TLS=0x4f8
      t:1378                         blocked thrd_t:0x36f9fdcb2b30/TLS=0x4f8
    p:1539    202.0k    200k     28k         devhost:root
      t:1563                         blocked initial-thread
    p:1576    566.0k    564k     28k         devhost:misc
      t:1599                         blocked initial-thread
      t:1879                         blocked debug-reader
      t:1990                         blocked i8042-kbd-irq
      t:2107                         blocked dmctl-multiloader
      t:2290                         blocked i8042-mouse-irq
    p:1719    994.0k    224k   1564k         devhost:pci#1:1234:1111
      t:1742                         blocked initial-thread
    p:1781     24.3M   24.3M     28k         devhost:pci#3:8086:2922
      t:1823                         blocked initial-thread
      t:1945                         blocked ahci-irq
      t:1950                         blocked ahci-watchdog
      t:1955                         blocked ahci-worker
  j:1087     2456.0k   1672k                 magenta-services
    p:1089    254.0k    252k     28k         crashlogger
      t:1122                         blocked initial-thread
      t:1363                         blocked self-dump-thread
    p:1157   1078.0k    308k   1564k         virtual-console
      t:1193                         blocked initial-thread
    p:1198    166.0k    164k     28k         netsvc
      t:1237                         blocked initial-thread
    p:2000    226.0k    224k     28k         sh:console
      t:2052                         blocked initial-thread
    p:2095    186.0k    184k     28k         vc:sh
      t:2130                         blocked initial-thread
    p:2167    186.0k    184k     28k         vc:sh
      t:2192                         blocked initial-thread
    p:2229    190.0k    188k     28k         vc:sh
      t:2254                         blocked initial-thread
    p:2424    170.0k    168k     28k         /boot/bin/ps
      t:2457                         running initial-thread
  j:1088          0B      0B                 fuchsia
TASK             PSS PRIVATE  SHARED   STATE NAME

Where "j" means Job, "p" means Process, "t" means Thread.The process bin/devmgr has four threads with the following roles:

bin/devmgr

This is the main thread, which listens for device events and handles them as a daemon thread after initialization.Mainly handles add, remove, bind requests for device initiated by devhost.
In implementation, we listen on a specific port object, dc_port, and the fallback handler is dc_handle_device.Dc_port listens for devhost's request channel, and when a new device is created based on devhost's request, it listens for device's request channel in response to deice's operation request.The object type of the callback is port_handler_t.

mxio-dispatcher

It also uses listening port s and handling related events.For access to the main processing files, see mxrio_handler and vfs_handler.Its file operation requests come from various processes.

local-multiloader

When launchpad runs an application or service, you need to request the loader service to load the file.Initialization of this service is shown in mxio_loader_service.It creates a thread called "local-multiloader", which listens for port, and the event fallback function is multiloader_cb, which calls default_load_object to load the file.

service-starter

The entry function for this thread is service_starter, which, after starting some services, listens on the folder "/dev/class/block" as a daemon thread. If a new file appears in this folder, a new block device is added.Call back function block_device_added to process this device.Usually mount this device.

Added by dan231 on Fri, 14 Jun 2019 21:08:44 +0300