Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler based on memory snapshots #7

Open
dorooleg opened this issue Apr 3, 2018 · 2 comments
Open

Scheduler based on memory snapshots #7

dorooleg opened this issue Apr 3, 2018 · 2 comments

Comments

@dorooleg
Copy link
Contributor

dorooleg commented Apr 3, 2018

@dvyukov What do you think the scheduler based on memory snapshots can be useful? https://github.com/dorooleg/relacy/tree/scheduler-based-on-memory-snapshots

I see several uses of this approach:

  1. Acceleration of planning work. It is important when there are heavy operations between snapshots
  2. If the problem persists, you can debug the path
  3. The user can specify memory snapshots between which the application wants to test intensively. Can be useful for large projects
  4. To maintain the ability to work with files, @eugenyk suggested to use LD_PRELOAD

Currently, only the first item is made. Does the rest make sense?

@dvyukov
Copy link
Owner

dvyukov commented Apr 4, 2018

Hi @dorooleg,

Do you actually have something so expensive that justifies fork + several socket calls + several context switches? This should be something notoriously expensive.
However, snapshoting with fork can also be useful to:

  1. Fight accumulated global state in tests. Currently it's prohibited and schedulers break badly when program behavior changes from run to tun.
  2. Fight non-deterministic test. Non-determinism in tests is bad, but it's still better to test at least to the degree possible than to crash.

However, unfortunately I don't have lots of spare cycles for large relacy changes today. I would rather invest more in ThreadSanitizer:
https://clang.llvm.org/docs/ThreadSanitizer.html
https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual

ThreadSanitizer has lots of advantages over Relacy:

  • automatic instrumentation of memory access with compiler help (no ugly $!)
  • automatic instrumentation of atomic operations
  • extensive library of libc interceptors for pthread/semahores/thread-safe statics/malloc/read/write and lots of other functions
  • dynamic thread count
  • ability to handle real programs of any size

But it does not have a number of important features that Relacy has, in particular:

  • very precise memory model modelling
  • examination of different schedules

Taking into account that ThreadSanitizer's main goal is to handle any real programs with zero user effort, using fork-based scheduler looks like a good fit for ThreadSanitizer because of the ability to handle global state, non-determinism and larger programs.

@dvyukov
Copy link
Owner

dvyukov commented Apr 4, 2018

@kcc FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants