Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hybrid Suspend #6921

@marek-safar

Description

@marek-safar

Goal

As a way to reduce the risk of bing-bang change, we are approaching the project of transitioning to cooperative suspend by a middle ground approach: hybrid suspend. It consist in using cooperative suspend for runtime and managed code, and preemptive suspend for any other kind of code (external libraries, OS, etc.). Thus, preemptive suspend is used only for code which is not controlled by Mono, while cooperative suspend is only used for code which is fully controlled by Mono. This forces us to make sure we transition to the right state, to ensure we use the proper mechanism of suspending.

A hopefully exhaustive list of where these transitions are needed is:

  1. managed-to-native wrappers
  2. native-to-managed wrappers
  3. MONO_API functions
  4. trampolines
  5. external libraries calls (libc, btls, etc.)

Points 1. and 2. are quite easy to achieve, and are already working for supporting cooperative suspend on watchOS. Some of 3., 4. and 5. have already been done for watchOS and Mono's CI for cooperative suspend. Unfortunately, 3. and 4. are not complete enough to fully support VSfM, XI/XM and XA, or any other embedding project.

We want to switch to hybrid suspend by default by 2018-08, and to do so we have identified some necessary steps to ship, and some longer-term improvement steps.

Tasks

For 2018-08

For Future

  • Static analysis: Centrinel checks for missing transitions in MONO_API functions;
    • Centrinel checks to insert MONO_REQ_GC_UNSAFE_MODE assertions in functions that touch managed memory.
  • Diagnostics:
  • MONO_API functions:
    • All other MONO_API functions not loaded by XI/XM/XA
  • Performance: fix tail of regressions
  • Documentation: how does it work

Documentation

https://paper.dropbox.com/doc/What-I-know-about-suspend-GtXdT1CxuMsqwSBFVLqQf

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions