Better HN
topnewbestaskshowjobs
Log inSign up

throwawaylinux

3,517 karma · joined Jul 23, 2021 (5y ago) · 2,823 submissions

Submissions

comment 3y ago · link · parent

I'm talking about in general you can implement a 1-bit mutex. Regardless of how you sleep and wake, you make a side structure which contains the contended state of the mutex.

In the kernel of course you could just reuse your wait queue structure for that, which is exactly what bit mutexes do in Linux, but that's an implementation detail to my point.

comment 3y ago · link · parent

> I think the USA is becoming more protectionist, but that doesn’t mean that free trade agreements amongst the rest of the world stop. In 2008 New Zealand signed a free trade agreement with China.

Knowing full well the scale of China's pollution (not just carbon), emvironmental destruction, human rights abuses, labor exploitation, militarization and annexation of regions like Tibet and Inner Mongolia, further expansionist aims in the South China Sea and Taiwan, intellectual property theft and currency manipulation, attacks on activists in western countries, and general brutal totalitarian government.

And it's the same story in the Middle East, Africa, Latin America, etc. Worse in many cases because of the wars and interventions from western countries.

This is why people are sick of globalism and sick of hypocritical corrupt western governments and their preaching and lies.

Globalism has just become synonymous with the ruling class shirking responsibility and making themselves unanswerable to the people. High time for a change I think.

comment 3y ago · link · parent

This isn't directed at you, but to add some more flavor - bit spinlocks require an atomic unlock, whereas byte/word ones can be non-atomic. Which isn't so much problem these days but it used to be a big one against bit spinlocks when locked operations took hundreds of cycles and even went on the bus and stopped everyone else accessing the memory.

But even byte/word spin locks that could avoid the atomic unlock, and even in modern systems where atomic operations are quite cheap relative to cache miss, still have two major problems, the "thundering herd" effect, and unfairness/starvation.

The basic spin lock is just a bit or byte or word in memory where waiters just keep reading the lock value until it becomes unlocked, and then they attempt to lock it. If that fails, continue waiting.

The thundering herd problem is at the cache coherency level. If you have a bunch of CPUs waiting on the lock then when the lock is released at the cache coherency level they all have that line invalidated, and then they will each request the line again, see the new (unlocked) value, and they will all try to take the lock, and each of those lock operations is an exclusive access to the line which also invalidates all others, and in the end only one succeeds, so all the others were wasted and go back to waiting, pulling the line back into shared state. So N CPUs taking a contended spin lock can become an O(N^2) operation all up. Coherency protocols might be smart enough to mitigate this somewhat so it may not be not quite so bad, but it's always going to be costly and those hardware heuristics could break down in extreme cases. So the effective critical section including the lock overhead can grow quickly as you increase CPU count, which can cause scalability to not just hit a wall but go off a cliff and get worse as you get more CPUs contending for the lock. Which is obviously bad, but the negative feedback spiral is particularly bad (workload slows down -> more CPUs recruited to handle workload -> workload gets slower) and means you can get stuck in a degraded state beyond the overload condition.

The fairness problem is difficult as well. A cache coherency protocol itself can be fair and anti-starvation, in that a CPU will get access to a line in a relatively equal and timely manner, and that could be mathematically proven and verified in the hardware. But when you start building on top of that, those properties don't automatically translate to the higher level primitive. In the above situation where it's a free-for-all on the lock word, any one waiter may get access to the line fairly and never be starved at the hardware level, but each time it performs the atomic operation to acquire the lock it might find that it has been taken by another CPU -- the hardware doesn't know what the lock is or that the value 0x1234 means it's free. So to truly have fair and non-starving locks, you need to build them with those guarantees in software, and only rely on the hardware for atomic operations.

The ticket locks that parent poster refers to are one such solution for fairness as they're FIFO. They were brought in to Linux due to unfairness/starvation problems. They are since superseded by "queued" spinlocks which are also FIFO but instead of spinning on the lock word each CPU spins on its own area, so unlock becomes closer to a 1:1 operation at the coherency level rather than 1:N (using the "MCS" algorithm) which tackles the former thundering herd problem.

comment 3y ago · link · parent

You can implement a 1-bit mutex, by keeping the contended state in a side structure. The side structure need only scale with about the number of contending threads, or approximately the number of total threads, rather than the number of locks.

comment 3y ago · link · parent

I don't think they did used to look quite like this. They also didn't have the metallic element so were a more solid color, but they didn't have the same quality -- flat while still being glossy. The last two pictures of the old Porsche and BMW are what old cars looked like, and that's not the same as the "putty" look.

comment 3y ago · link · parent

Is Twitter always so melodramatic? Have to laugh at the mopey sad sacks calling it "dystopian".

comment 3y ago · link · parent

I think a lot of journalists, experts, and politicians arrived at the same conclusion around the same time, which is that credibility isn't worth bothering with because there's a base level of people who will unquestioningly believe them if they make them feel the right way. If you're angry at the right people and causes, and you "stand with" and support the correct things, then truth and reason is not relevant. Actually it's something dangerous to be feared, because it could cause uncomfortable emotions.

comment 3y ago · link · parent

How do you define leading?

comment 3y ago · link · parent

It's also sad that the people don't realize that they are the highest authority and ultimate deciders in a society. Not a politician, not a judge, not a police officer, not an expert, but the people. And the people have an absolute right and responsibility to relieve those delegates from positions of power if they derelict their duty to society.

comment 3y ago · link · parent

What exactly did you try?

comment 3y ago · link · parent

That's not what I said was the conspiracy theory.

comment 3y ago · link · parent

From Putin, obviously. If you disagree or need more evidence then you're a Russian traitor who must be censored to protect our democracy.

comment 3y ago · link · parent

This is a long way from conspiracy theories like "Jacinda Ardern and her current government are being targeted internationally by hybrid warfare type disinformation techniques." and "it’s a reaction to her being held up as an example of a young progressive woman in a position of power and getting through the beginning of Covid without to many deaths by relying on a functional social contract."

Sure, some shadowy entity (probably connected to Putin and also secret Nazis) are waging hybrid warfare on New Zealand because Jacinta is so progressive and young and a woman, and that's why she needs the ability to take down any facebook content (critical of her authoritarianism?), also something something covid and mass shootings. Just screams hysterical ultra left wing fear mongering conspiracy theory.

comment 3y ago · link · parent

There was no serious discussion of it, just some baseless conspiratorial rambling that I called out.

comment 3y ago · link · parent

Sounds exactly like the kind of baseless conspiracy theory that would be made up to try to deflect criticism about authoritarian actions by a government.

comment 3y ago · link · parent

"people on the left" have no better than than people on the right or anybody else in this regard. When it suits them, when they believe it will advantage them, they are all for suppression of peoples' rights.

comment 3y ago · link · parent

It is not even slightly odd. Everybody from the lowest pleb working at any company is made very aware that emails, messages, and any communication that goes through company systems or computers or phones are not private, and may be accessed by the company at any time for any reason, or be subject to subpoena by third parties.

> Maybe twitter's policies were bad, and applied inconsistently. But there is no clear evidence that they explicitly favored one party, and to be honest- I don't really care if they do. If Elon thinks this is some sort of big shock that will cause people to get excited.... I can't really see why.

Authoritarians love the idea of corporations subservient to government being used as a tool of the state to crack down on human rights. Lots of people don't see a problem with it.

comment 4y ago · link · parent

Also lions.

comment 4y ago · link · parent

When you say "we", policy that can affect carbon emissions and even population trends to some degree are usually made on a country level. So it makes sense for highly emitting countries to reduce their emissions, not for them to be able to purchase "share" by encouraging population growth.

comment 4y ago · link · parent

It is for the political party that controls the DoJ and other federal prosecuting agencies.

comment 4y ago · link · parent

Carbon footprint per capita is a poor metric because it incentivizes nations to increase population and suppress quality of life improvements.

If you want to assign blame sure an American might be 10 time more responsible than a Pakistani, a Chinese may be twice as culpable is a French. That doesn't really solve anything though. The problem isn't the amount of CO2 in the air divided by the number of living humans.

Emissions intensity of production IMO is a better one because it promotes efficient industry without exerting the wrong incentives on population or quality of life.

comment 4y ago · link · parent

Do you believe it is honest because it's something you want to hear? This is the single fundamental concept that con artistry boils down to.

Whenever anybody says "<something you want to hear>, I can't show you but trust me," the reaction shouldn't be to marvel at their honesty, it should be to smell bullshit and ask yourself what their angle is. I mean even when they're not a known conman and liar who just fleeced people out of billions of dollars. I feel this should go without saying but there are an incredible amount of people still lining up to believe this clown for some reason.

comment 4y ago · link · parent

Can't PR play a big part in high profile and political trials? I feel it can definitely be a strategy to try to put your story out before someone else does.

Obviously you're not going to come out and say you're doing this as a PR strategy developed with your legal team, you're going to act like it's a personal risk to yourself to tell your story, which I suppose lends it some credibility in the eyes of some people. Like some of the people in this thread.

The man's a con artist. I'm astounded that people still believe anything he says. I suppose I shouldn't be, he must be a very good con man because he managed to steal billions of dollars.

comment 4y ago · link · parent

I guess that depends - what do the "trust the experts" crowd do when faced with dueling "experts"? Is the layperson an expert in expert-choosing, or do we need a second layer of experts for that?

comment 4y ago · link · parent

> What capitalist utopia do you live in where homeless people are running legit toxic waste removal operations?

One of the ones where I don't have to pry into peoples' personal life because I have no legal requirement or desire to discriminate against "undesirables". Which is just about all of them. Now you still haven't told me about about you.

> You can’t reduce your liability simply because a dollar exchanges hands.

I assure you that people can buy and sell things, including goods, including waste, including liabilities for all sorts of things all the time.

> Those other disposal sites you speak of are authorized and regulated.

Is your allegation that this Chilean company that was paid to take care of this waste not "authorized or regulated"?

comment 4y ago · link · parent

> Do you have any obligation to ensure it’s disposed of properly by that company?

Unless there are specific laws about it, then not particularly more or less than any other transaction with anybody else. That is to say, probable some diligence, but at some point you can certainly pay others to take your waste. This isn't even remotely unusual. I've paid battery places to dispose of old lead acid batteries, tire shops to dispose of my old tires, a landfill to dispose of lots of stuff from motor oil to broken appliances.

> Can I just pay the homeless guy on the street $1MM to my waste? What if he sets up an LLC?

Why would being homeless bar him from conducting private business like anybody else? What sort of authoritarian communist hellhole do you live in?

Where I live, sure you could do that. And if he didn't dispose of it properly, government regulators would come after him and get that money back. That's how these things work. If they didn't do that, then unscrupulous corporations sure aren't going to pay a middle-man money to not do something that they can not do for free.

How much are you on the hook for slavery, corruption, environmental destruction, and war crimes when you purchased your iPhone, filled your gas tank, bought a pair of sneakers, or ate something containing palm oil? How many years in the slammer and how large a fine can I put you down for?

comment 4y ago · link · parent

Phew, well I'm glad somebody is thinking of the children. Thank you for your service :) Sorry if I hit a nerve.

comment 4y ago · link · parent

I'm not even slightly surprised that people who were worth their salt and could actually create fled universities and went to private industry and did great things there, while traditional academia languished and stagnated. It's not the people who are necessarily unsuited, it's the institutions.

comment 4y ago · link · parent

Turns out just about everybody, all around the world, loves authoritarian laws when they agree with the alleged goal, or when the psychological propaganda worked on them. If it's not the children, it's grandma, or someone else.

Turns out there are a small number of actual anti-authoritarians who have always been consistent. And then there are countless hangers-on who proclaim to be an anti-authoritarian resistance when it suits them. It's funny, the fact people co-opt it shows that they see it as a noble and worthy ideology, yet it's still one they're happy to discard the minute some talking head put on TV by a corporation tells them to be outraged.

1
262728
95