I know that SELECT pseudo-randomly select a channel among ready channels to proceed. But could it be that starvation happen when a channel compete with large enough number of other channels in the same SELECT statement? What I really want to know is the mechanic (or algorithm) behind that makes SELECT statement starvation possible or not.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Starvation doesn't happen. Don't worry about it.
Come to think of it, why not introduce 2 different kinds of SELECT:
[...]
Some newbie boring thoughts on a big subject. Thanks in advanced for taking the time to read it.
Adding a new select via keyword or API wouldn't break the guarantee if it wouldn't break old source code.
Sent from my mobile.
I think finite time is enough to make result stale in real-time programs. Though not the entire time, but aren't intermittent failures the thing we always want to avoid? Base the correctness of programs on probability is a risky choice, don't you think?
May I ask what is the original purposes of making SELECT pseudo-randomly choose between ready channels each time it's entered? Is it to distract programmers from over-ordering cases?
Hello Ian.
I read your comment and I am confused. Was your response meant to include the original premise of a real-time program?
If so, I think that the most common error isn't hardware failure but missing a timing deadline. I've worked on systems where accuracy of 0.1 microseconds was required. Even human interfaces require sub-second response times.
> Go is for programs that run in the real world.
What programs don't? Certainly real-time programs do. Errors due to probabilistic scheduling increase as the response requirement approaches the speed of the system.
I realize that Go isn't designed for tight real-time requirements. It currently does well in average cases. With scheduling (preemption and forced rescheduling) and GC improvements (past and planned) is getting "faster". I think this is wonderful. It will make coding more possible for gamers and drone controllers, for example.
In one of my programs I used multiple selects in a "waterfall" arrangement to achieve a priority effect. Yes, it would have been nice had Select offered some sort of priority scheduling, but since it didn't I worked around it.
>>> I think that if you look at real numbers you will see that that is
achieved when using a uniform pseudo-random choice.
If a task needs to run once a second, yes. Once a millisecond, probably (except for GC and for compute-bound GoRoutines which don't force rescheduling). Once a microsecond, no.
John
John Souvestre - New Orleans LA
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
Hi Jan.
Nice! It certainly changes the odds, but still isn’t quite as deterministic as if channels had different priorities.
John
John Souvestre - New Orleans LA