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

Eliminating the Scheduler type and module #84

Open
polytypic opened this issue Dec 6, 2015 · 8 comments
Open

Eliminating the Scheduler type and module #84

polytypic opened this issue Dec 6, 2015 · 8 comments

Comments

@polytypic
Copy link
Member

Is anyone using the Scheduler type/module?

If not, I'd like to eliminate the whole thing (meaning that there would only be one global scheduler) and simplify the library interface.

@vasily-kirichenko
Copy link
Contributor

I have not used it, but what if I will want to use more then Environment.ProcessorCount threads? Would it possible without substituting the standard scheduler with a custom one?

@polytypic
Copy link
Member Author

There could be [some mechanism](http://hopac.github.io/Hopac/Hopac.html#def:val Hopac.Scheduler.Global.setCreate) to specify parameters such as the number of threads to use.

@vasily-kirichenko
Copy link
Contributor

ok, then Scheduler can be removed.

@neoeinstein
Copy link
Member

I have actually been using it to compare concurrency with only one worker thread and demonstrate concurrency without parallelism, especially from within the same process. Scheduler.Global.setCreate wouldn't work for this, as I want to be able to use both schedulers from within one execution. Not often used. If removed, I'd be sad, but it wouldn't break any of my intentional use cases.

@polytypic
Copy link
Member Author

@neoeinstein Thanks for the note!

Here is some more info why I'd like to remove schedulers. I'm not entirely satisfied with the current design/implementation of the Scheduler concept. In particular, jobs are not tied to a scheduler so they can move from one scheduler to another (unintentionally). Fixing this would add some (small) amount of overhead and also change the interface a bit. But the real problem is that the scheduler concept is unlikely to be frequently used, it adds quite a bit of interface complexity and some amount of implementation complexity and (unfortunately) my time is very limited. So, I'd rather simplify things and then make it easier to otherwise improve the library.

@neoeinstein
Copy link
Member

+1

@haf
Copy link
Member

haf commented Feb 10, 2016

After having a bit of conversation with Marcus, we've found that Job.Scheduler.isolate and Job.switchToWorker can be fairly useful to keep if you decide to remove schedulers. Isolate provides a nice escape hatch when one has to block the thread. This is similar to the bug I experienced in Logary where I'd in parallel block a number of threads, effectively eating up all Hopac threads and causing a deadlock (parallel apply function was culprit)

@polytypic
Copy link
Member Author

Ideally such workarounds would be mostly unneeded and it is possible to change scheduling to mostly eliminate the need. That is actually the reason why I'd like to remove the scheduler - to make it easier to make the changes. Unfortunately, I'm not currently working on any F# projects and have no such projects in sight, so it is unlikely that I would have the opportunity to work towards that goal any soon. :(

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

4 participants