News for hackers. Stuff that matters.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by babuskov on Thursday October 03, 2019 @09:39AM (#21146795)
It's more like traffic lights being turned off.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by vanderZwan on Thursday October 03, 2019 @10:33AM (#21147429)
I grew up near a city where they set up the traffic lights along one of the main roads in such a way that if you kept to the speed limit you would always arrive at the next light just after it turned green, so you never would have to brake or accelerate. I wouldn't be surprised if there are concurrency patterns analogous to that.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by Fnoord on Thursday October 03, 2019 @10:42AM (#21147551)
Ah yeah, groene golf (green wave [1]). I grew up remembering my parents also using that. Except it never bloody worked.

[1] https://en.wikipedia.org/wiki/Green_wave

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by devicetray0 on Thursday October 03, 2019 @10:59AM (#21147790)
Wow, from that article:

> In the UK, in 2009, it was revealed that the Department for Transport had previously discouraged green waves as they reduced fuel usage, and thus less revenue was raised from fuel taxes.

Ugh...

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by vonmoltke on Thursday October 03, 2019 @12:56PM (#21149101)
Perverse behaviors like this are what make we worry about the calls to tax negative externalities without earmarking the funds for addressing those externalities. If you tax the externalities, but get to use the revenue for something else, what is your incentive to reduce the behavior causing the problems in the first place?
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by aeorgnoieang on Thursday October 03, 2019 @02:15PM (#21150080)
Yes! This is a point I raise frequently. My go-to example is cigarette taxes being used to fund public schools. They should be used to cover costs (borne by the relevant government) of people smoking cigarettes! Otherwise, as has happened, school funding can be hurt by people smoking less, which is not a good situation to have created.

The degree by which governments routinely violate the accounting principle of matching revenues to expenses is awful.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by loeg on Thursday October 03, 2019 @03:01PM (#21150750)
I think you're describing the problem of earmarking funds at all. In general it's just a stupid posturing maneuver. Spending is fungible; it just replaces the amount contributed from the legal body's general fund. As needs change, general fund money can be spent as needed. Earmarked funds are stuck.

A carbon tax on consumers (incl. businesses) is effective at producing good market behavior regardless of how the tax revenue is spent.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by vonmoltke on Thursday October 03, 2019 @03:19PM (#21150950)
> A carbon tax on consumers (incl. businesses) is effective at producing good market behavior regardless of how the tax revenue is spent.

In the example I reacted to, a government agency actively worked to inhibit that behavior in order to preserve its revenue. Your point would hold if governments didn't have the power to do things like this.

> Earmarked funds are stuck.

If the revenue is being raised to pay for damage caused by society, those funds should be stuck to that purpose and should rise and fall based on the level of damage being done.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by loeg on Thursday October 03, 2019 @07:33PM (#21153367)
> In the example I reacted to, a government agency actively worked to inhibit that behavior in order to preserve its revenue. Your point would hold if governments didn't have the power to do things like this.

A governmental bad actor is basically orthogonal to the idea of a carbon tax. The government could equally try to increase sales of liquor and cigarettes for sin taxes, or go around murdering people for the estate taxes. The UK example is shameful but reflects on that government body rather than the specific tax on petrol.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by thomasz on Friday October 04, 2019 @08:08AM (#21156757)
This is very likely an urban myth.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by aeorgnoieang on Friday October 04, 2019 @11:46AM (#21158798)
The problem isn't earmarking funds in general. Money has to be allocated somehow and it's good to do so explicitly.

The problem is earmarking or allocating a variable set of revenue as funding for something unrelated, and in particular something unrelated that's otherwise valuable or important.

And NOT earmarking or allocating 'sin taxes' to pay for the supposed costs of those sins, borne by the public in the form of the government, seems pretty stupid (to me) if it's actually necessary or desirable for the government to 'manage' those sins or those sin's consequences.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by red75prime on Friday October 04, 2019 @03:10AM (#21155487)
Ave, Government, morituri te financiert.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by smolder on Thursday October 03, 2019 @11:38AM (#21148228)
It makes me really disappointed in the world every time I hear stories like this. Supposedly we chose 110v power over a higher voltage in the US so we could sell more copper in wires. And everyone can see Health Care is a two-faced profiteer-filled industry here.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by philjohn on Thursday October 03, 2019 @12:06PM (#21148578)
Yes - but smart motorways are doing a pretty good job of handling congestion at peak times by keeping traffic moving at a slower pace, which ends up with everyone using less fuel ... so at least UK roads are becoming slightly better in that regard :)
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by KirinDave on Thursday October 03, 2019 @11:50AM (#21148380)
Yes, well, the green wave is a good idea in principle, but it's sorta mistaking averages for reality.

There is this thing called the "waiting time paradox" [0] (or more generally the "inspection paradox") that suggests a surprising thing, the average time between discrete events observed by many other randomly interspersed observation is the same as the average time between events. This should be surprising, because it suggests that many more people experience times LONGER than the average wait to balance out people who experience a shorter wait because they were randomly closer to the event.

This happens because longer intervals, when they do exist, get a larger proportion of the random observations than the shorter intervals between events. More precisely and generically, when the quantity being observed affects the observer, the observations will be distorted by the quantity in question and have to be normalized.

In the case of a green wave, those rare times when someone waits too long on a green because they were looking at their phone or a naked person in a nearby window and create slowdowns and stalls in the pipeline? Those moments are longer, so there is a longer window where you could experience them.

This actually comes up a lot in observations of things in nature. Imagine if instead of light flips or bus arrivals we were observing clicks on a geiger counter and you'll realize how fundamental this is to experiencing the world.

tl;dr: The Green Wave only works in averages and it can be correct even as your experience of it never working is also correct. :)

[0]: https://jakevdp.github.io/blog/2018/09/13/waiting-time-parad...

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by mmjaa on Thursday October 03, 2019 @11:18AM (#21148014)
Here in Vienna, it works great. Its often quite amusing to me, as I ride a slow moped - about horse speed - and get passed by irate drivers all the time. However, I ride that green wave, while they are constantly stopping/starting at the lights ...
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by babuskov on Thursday October 03, 2019 @10:54AM (#21147716)
Works fine in my town (population around 100k). 50kmph (around 31mph) and it's all green for some 20+ crossroads.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by jandrese on Thursday October 03, 2019 @02:08PM (#21149995)
There is a road near where I used to live that was the opposite. Speed about 10mph over the limit (55 in a 45) and it would be green all the way. Go the speed limit and you get stopped at every single light. It was shockingly reliable. The difference between speeding and going the speed limit was 15 minutes on a 20 minute drive. The only time it got broken up was the one intersection with a pedestrian crosswalk where people sometimes hit the button.

Of course traffic was heavy enough that you'd be stuck behind someone doing the speed limit most days, but sometimes you got to ride the wave.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by perl4ever on Thursday October 03, 2019 @11:17PM (#21154496)
As I wrote in another post, there's a highway near me where you almost always hit every red light, but it's designed such that going say 20% over the limit won't work either. I believe some people deliberately go 20% under to reduce the waiting.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by jsgo on Thursday October 03, 2019 @01:34PM (#21149587)
I'd be willing to give that a shot; I drive the speed limit in my town (population estimated at about 15.6k), but the lights seem more in relation to current traffic at the intersection. So you catch this red light and you're going straight, you stop and wait. Now when you approach the second light, because you and others were held back there was no one approaching the light so it will likely be red or turning red when you approach. To actually get out of this loop, you basically have to speed up a bit which seems like a behavior that shouldn't be rewarded as such.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by mikestew on Thursday October 03, 2019 @01:57PM (#21149848)
Sounds like sensor-based lights and not timed lights? Regardless, Redmond, WA is full of sensor-based lights. Hence I catch myself speeding up to an otherwise empty lane and a green light. 'cuz if I don't hurry up, it'll turn red.

Timed lights work, I've seen it in action. Top of my head, Indianapolis 20 some years ago, Capitol Avenue going north I'd bet you could go from (what is effectively) Zero Street to 38th and not hit a red light.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by vanderZwan on Thursday October 03, 2019 @10:53AM (#21147696)
Worked fine for my family near Drachten, but that had the advantage that they also had a sign showing your speed next to the road. I suspect one issue is that the speedometer in cars are not that accurate
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by SECProto on Thursday October 03, 2019 @03:05PM (#21150797)
I live somewhere with lots of roadside speed signs (they flash speed in red if you're speeding, green if under). In the tens of cars I've driven/ridden here, the speedometer is always within a small range (±2km) of what the road sign says
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by vanderZwan on Saturday October 05, 2019 @08:51AM (#21165223)
The thing is that you have to look at this from the perspective of the expected largest difference between different cars, not one speedometer and actual speed.

If two cars both say they drive at 50 km/h, and one is actually 45 km/h and the other 55 km/h, that is quite a bit relative margin of error. And we only need two cars like that in the whole group to start causing problems.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by SECProto on Saturday October 05, 2019 @10:08PM (#21169369)
But I don't think you have to look that hard at some technical error causing this variance. Drivers speeds vary between 40 and 60 pretty regularly on residential roads. Having a speedometer error doesn't even have to enter into the conversation.

If you can't design a green wave to be tolerant of varying speeds, then it isn't useful.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by perl4ever on Thursday October 03, 2019 @11:20PM (#21154504)
There are some weird speed signs near me. One that particularly irritates me is set up to flash if you're over 25 mph. But the speed limit is 30! There's also a flashing sign by a school, that is left on at times that the regular sign specifically says the school speed limit is not in effect.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by kevin_thibedeau on Thursday October 03, 2019 @04:32PM (#21151849)
radar detectors always read lower than your true speed since they can't be positioned directly in your line of travel.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by SECProto on Thursday October 03, 2019 @06:22PM (#21152888)
In the situation I experience on my commute daily: I'm 40m back and the detector is 3m perpendicular off my line of travel (reasonable approximation, as they're on a roadside light standard, the lane width is 3.5m, and the car is centered in the lane), that is a very minor discrepency. On the order of 0.2 km/h
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by dekhn on Thursday October 03, 2019 @10:35AM (#21147463)
systolic matrix multiplication is roughly analogous to that.

Great Highway in SF, if you drive 35MPH you will just get greens on the evenly spaced lights. The worst is when you get stuck behind a person who drives 40, then brakes heavily, then drives 40, then brakes heavily, etc.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by svnpenn on Thursday October 03, 2019 @01:27PM (#21149493)
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by hawski on Thursday October 03, 2019 @11:50AM (#21148383)
There's a road in Berlin (and probably it's not an exception) that has overhead displays showing how fast you should go to be on a green wave. At least that's how I understood how it works from driving there several times. Additionally it has variable number of lanes for each direction signaled by lights.

Here it's street view of the road, it's not perfectly visible, because those are LED displays: https://goo.gl/maps/T7RzQCUS4nk3QVZN9

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by perl4ever on Thursday October 03, 2019 @11:13PM (#21154478)
There's a highway near me with periodic lights triggered by the cross traffic such that you almost always have to stop. The limit is 55 mph, but if you see someone on the side street and speed up to, say 70, to try to beat the light, you will probably see it turn yellow within a second and have to stop anyway. There aren't that many lights, but you almost always have to stop for every one because of the cross traffic taking precedence.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by Doubl on Thursday October 03, 2019 @10:41AM (#21147534)
Slow drivers must cause extreme road rage on that road
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by IggleSniggle on Thursday October 03, 2019 @11:20AM (#21148036)
In my experience, it is the “fast” drivers that cause road rage by being slow. They race to the next light, stop, and because they are stopped, prevent everyone from riding the green wave because they now must accelerate from stopped. Sooooo frustrating. Just go the speed limit and none of us will need to stop you idiots!

Edit: (or go double the speed limit if you must but please stop creating stops)

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by philjohn on Thursday October 03, 2019 @11:56AM (#21148450)
You run the risk of the computational equivalent of speedo not beeing 100% accurate, e.g. clock innacuracy.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by V-eHGsd_ on Thursday October 03, 2019 @11:15AM (#21147990)
there's a 3 or 4 mile stretch of road in san francisco called the great highway that's like this (https://www.google.com/maps/@37.750302,-122.5062241,14.64z)

It was one my little pleasures to drive along that at 35 (or 30, I forget what the speed limit was) and see cars zip ahead at each light at 45, only to watch them ride the brakes as they hit the next red.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by guan on Thursday October 03, 2019 @03:22PM (#21150981)
When there’s not too much traffic, Ocean Parkway in Brooklyn also has a green wave.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by smolder on Thursday October 03, 2019 @11:34AM (#21148184)
They did this on a few roads around where I grew up.(Southern Tier of New York.)
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by nashequilibrium on Thursday October 03, 2019 @10:52AM (#21147677)
The road I take to the gym is exactly like this, if you keep just under 40mph.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by swebs on Thursday October 03, 2019 @11:02AM (#21147841)
In both directions? How would that work?
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by ninkendo on Thursday October 03, 2019 @11:19AM (#21148024)
You can actually do all 4 directions.

Imagine a translucent checker board of blue and black squares overlaid on top of a map of roads. You can see the color of the squares but you can also see the roads underneath them.

If a light falls on a blue square, make its principal north/south direction Red at t=0 and it’s principal east/west direction green. For black squares do the opposite.

Calculate how long it would take cars to travel through each square unimpeded. It helps if this time is roughly the same regardless of direction. It also helps if the squares are roughly large enough that it takes roughly one light phase worth of time to travel through it. Call that time N.

At t=N, switch the lights to the opposite color, so now north/southbound traffic gets green lights on blue squares, and east/west gets red. Black squares get the opposite.

What you’ll see if you imagine yourself as a car driving through this, is that as you enter a black square as it turns green, the green lights will stay green until you enter the nearest blue square, at which point the phase shifts and now the blue square gets green lights as you drive through it.

This works in both directions, with both north and south bound traffic.

Now, this falls apart when roads are diagonal, although it’s mitigated if diagonal roads have higher speed limits. It also means if you make a turn, you’re in the wrong light cycle, but it will correct itself after the next red light.

It also doesn’t work well at all if you have left turn arrows complicating your light cycles, so you’ll need to have something like a Michigan Left and the requisite wide medians to make this work.

It’s not as ideal as I described in real life, but the basic principle works.

Re:Google Is Uncovering Hundreds of Race Conditions Within t... by cameronh90 on Thursday October 03, 2019 @11:58AM (#21148479)
I'm guessing it doesn't work so well if the stretches of road between lights are of significantly different distances.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by AnimalMuppet on Thursday October 03, 2019 @02:52PM (#21150632)
Or, worse, if the roads aren't on a rectangular grid. But for square blocks, it can work very well.
Re:Google Is Uncovering Hundreds of Race Conditions Within t... by PyroLagus on Thursday October 03, 2019 @02:18PM (#21150125)
So lock-free datastructures such as ring buffers are like roundabouts, huh?