I am considering authoring a webserver (think nginx, apache, cowboy,
etc) in Rust. From a user point of view, mapping tasks (green) to web
requests makes the most sense as the tasks could be long running,
perform their own I/O, sessions, or what have you. It would also allow
the user to do per-request in memory caching.

My main concern is obviously the cooperative scheduler. Given that the
mantra of Rust seems to be safety, I'm curious about how feasible it
would be to provide the option for task safety as well. Preemptive
scheduling provides two things:

1. If preemption is used aggressively, the user can opt for a lower
latency system (a la Erlang style round robin preemptive scheduling)
2. Preemption of any sort can be used as a safety net to isolate bugs
or blocks in tasks for long running systems, or at least mitigate
damage until the developer intervenes.

I noticed in issue 5731[1] on the repo, it was pointed out that this
was possible, albeit difficult. The issue was closed with a comment
that the user should use OS threads instead. I really think this
misses the point as it no longer allows preemption on a smaller
granularity scale. Could any devs chime in on the scope and difficulty
of this project? Could any users/devs chime in on any of the points
above?

tl;dr I think preemptive scheduling is a must for safe concurrency in
long running executables at the bottom of the stack. Opinions?


[1] https://github.com/mozilla/rust/issues/5731
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to