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

What to do when two demos-sched instances are executed simultaneously? #31

Open
wentasah opened this issue Oct 30, 2020 · 8 comments
Open
Assignees

Comments

@wentasah
Copy link
Member

Options:

  • nothing (current state)
  • allow only one instance, others will fail
  • something else?
@MatejKafka
Copy link
Collaborator

I think that except for interference between the instances (which we cannot really do anything about), it should be quite simple to support multiple instances of demos just by suffixing the root cgroup name with an index/UUID to avoid naming collisions, no? So if it would be deemed useful, it should be just few hours of work to implement it.

@wentasah
Copy link
Member Author

wentasah commented Mar 4, 2021

Yes, it might be useful. But don't use UUID. Using the PID of demos-sched itself should be sufficient.

@MatejKafka
Copy link
Collaborator

MatejKafka commented Mar 4, 2021

For the CPU frequency scaling I'm currently working on, I don't think we can reasonably run it in multiple instances at once, as cpufreq is global for the whole system. Only reasonable solution I can think of would be to create a lockfile or a shared mutex whenever a demos instance takes control over power management, and delete it on exit. Any other instance would first attempt to create the lock and in case it already exists, run without active power management.

@wentasah
Copy link
Member Author

wentasah commented Mar 9, 2021

Locking is a good solution. I prefer shared mutex/semaphore over the lock file. The lock file can be stored in a network filesystem, which is potentially shared between multiple boards, which would be problematic. Shared mutex/semaphore lives always in the same kernel as the cpufreq subsystem, which is what's needed.

@MatejKafka
Copy link
Collaborator

Cgroup name collision will be solved by suffixing the scheduler PID to cgroup name.

For power management, I originally wanted to do locking, but with #48, instances of DEmOS won't use power management by default, so I think it is (at least for now) ok to not detect other running instances using a lockfile, and instead make it the users responsibility to only enable power management if he's running a single instance.

Using a lockfile may still be useful to provide better warnings and not break configured governor with multiple instances running, but I don't consider it a high priority with #48.

@wentasah
Copy link
Member Author

Agreed.

Maybe, it would make sense to print a warning, if demos is supposed to control CPU frequencies and the governor is set to userspace. In most cases, userspace governor is not the default, so if demos encounters this, it would mean that either another instance of demos or some other userspace cpufreq manager is running.

MatejKafka added a commit that referenced this issue Apr 26, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Apr 26, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Apr 26, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Apr 26, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
@MatejKafka MatejKafka self-assigned this Apr 26, 2021
@wentasah
Copy link
Member Author

Commit b0e6dc2 breaks running of demos without root. Demos then prints useless messages like this:

Cannot create necessary cgroups. Run demos-sched as root or run the following commands:
sudo mkdir /sys/fs/cgroup/freezer//demos-2066575
sudo chown -R 1000 /sys/fs/cgroup/freezer//demos-2066575
sudo mkdir /sys/fs/cgroup/cpuset//demos-2066575
sudo chown -R 1000 /sys/fs/cgroup/cpuset//demos-2066575

The name of the top-level group should stay the same. Perhaps, this issue should be solved together with unified cgroup hierarchy support (I'll create a separate issue for this).

@MatejKafka
Copy link
Collaborator

MatejKafka commented Apr 28, 2021

I know - for now, a working solution is to explicitly set the root cgroup name with -g (then the commands work again), but I agree it's not a good UX.

MatejKafka added a commit that referenced this issue Apr 28, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Apr 28, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Apr 28, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Apr 28, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Apr 29, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Apr 29, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue May 25, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue May 25, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue May 25, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue May 25, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue May 27, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue May 27, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue May 29, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue May 29, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 20, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 20, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 20, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 20, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 21, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 21, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 22, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 22, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 22, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 22, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 22, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 22, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 22, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 22, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 23, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 23, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Jul 23, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Jul 23, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Sep 3, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Sep 3, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Sep 9, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Sep 9, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Sep 9, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Sep 9, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Sep 10, 2021
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Sep 10, 2021
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Nov 13, 2022
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Nov 13, 2022
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
MatejKafka added a commit that referenced this issue Nov 13, 2022
…ple instances in parallel

TODO: cleanup_crash.sh
MatejKafka added a commit that referenced this issue Nov 13, 2022
…up naming scheme

Sidenote: Wow, do people actually willingly write scripts in bash? Is that a case of Stockholm syndrome?

closes #31
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