Medicare for All – How Can We Pay for It? - <AUTHOR> https://therealnews.com/stories/medicare-for-all-how-can-we-pay-for-it <comment><USER2> On our current trajectory, "who pays" isn't the most pressing issue. Suppose Medicare for All does save 10% as the article claims, if the cost just keeps rising then it only buys a little more time before no entity can foot the bill.

100 million people in the US have diabetes or pre-diabetes according to the CDC.[1] Diabetes costs $14,000/yr(?) and people are getting it at an earlier age and living longer. Of all the threats to the US, this one is particularly insidious.

There is also the concern that big pharma (along with big-sugar/corn) has too much influence over congress. The U.S. is the only country besides NZ to allow direct to consumer drug advertisement. That fact alone makes me lose faith in the government. Is it prudent to give more power and money to our government when they appear to be complicit and bereft of root cause solutions to address the rising cost ? Bloomberg, as NYC's mayor, seemed like the only politician who was willing to pass unpopular and extreme legislation by way of banning or limiting certain foods.

[1] [https://www.cdc.gov/media/releases/2017/p0718-diabetes- repor...](https://www.cdc.gov/media/releases/2017/p0718-diabetes-report.html)

<comment><USER3> As a tangent, I do think it's increasingly obvious that T2D (and metabolic syndrome) is a disease that's specific to the modern western diet and that lifestyle interventions are very effective at stopping or reversing T2D entirely.

Here's a recent publication on a controlled study being done by Virta Health et al. Of especial interest will be Fig 3 showing just how effective carbohydrate restriction was vs "usual care": [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6194375/](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6194375/)

IDF has also recently published case studies on the effectiveness of intermittent fasting as T2D treatment for those that can't/won't carb restrict: [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6194375/](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6194375/)

To expand on the costs a bit, the ADA has similar estimates, and in their 2018 report [1] estimates $16.75K/ppy costs (also cited by the CDC [2]), with direct+indirect costs estimated at $327B/yr, and that 1/7th of every health- care dollar is spent on diabetes-related costs. The Milken Institute [3] recently published a report on American Obesity [4] that gives even bigger numbers: "chronic diseases driven by the risk factor of obesity and overweight accounted for $480.7 billion in direct health care costs in the U.S., with an additional $1.24 trillion in indirect costs due to lost economic productivity."

[1] [http://www.diabetes.org/advocacy/news-events/cost-of- diabete...](http://www.diabetes.org/advocacy/news-events/cost-of- diabetes.html)

[2] [https://www.cdc.gov/diabetes/diabetesatwork/plan/costs.html](https://www.cdc.gov/diabetes/diabetesatwork/plan/costs.html)

[3] [https://en.wikipedia.org/wiki/Milken_Institute](https://en.wikipedia.org/wiki/Milken_Institute)

[4] [https://www.milkeninstitute.org/publications/view/944](https://www.milkeninstitute.org/publications/view/944)

</comment></comment><comment><USER4> > So we say by shifting everything to a single-payer system, with the > government being the Medicare equivalent for everybody, we're going to get > about 9 percent savings for the whole system. Then we say, well, in Europe, > on average they pay 50 percent less for drugs than we do. And we say, OK, > well, we'll take a more conservative number. We'll say 40 percent less as > opposed to 50 percent less.

Cutting reimbursements for drugs by 40% is going to have impacts on everything from R&D to what drugs are available. Drug companies median profit margin varies widely but its about on average 12-14% [0]. I don't think you can just wave a magic wand and say now you get 40% less and you'll just deal with it. It's also naive to believe you can just export some reimbursement model from another country to the US and just plug and play.

> That gives us 6 percent total savings in the system. Then we say Medicare > rates for all providers, all doctors, hospitals, dentists. Everybody gets > the Medicare rate. And that saves about 7 percent savings for the system > cost.

Same problem here. Paying doctors and hospitals 7% less will have an impact. Prices aren't just some arbitrary number you can change on a whim and have no effect.

> And then finally we have high levels of inefficiency with so-called doctor- > induced demand, where there's too many procedures using high tech when you > don't need it, because they can charge more.

This is just a change from bottom up (doctor) to top down (some medicare committee). I agree that there is a problem with over-treatment but I'm skeptical that a rule based system would be the ideal way to address this problem.

> And there's fraud. And so there's a lot of estimates at very high levels of > fraud and excessive costs. We took that service delivery savings as modest, > maybe 1 to 2 percent. Add them all up, you get 19 percent savings.

Traditionally government services are more susceptible to fraud as there is less of an incentive to address fraud. I'm not sure why a single federal agency would be more effective at rooting out fraud than smaller private insurers.

Overall I'm skeptical of a top down approach primarily because they mainly address the problem by lowering prices by fiat rather than addressing the systematic issues of high costs.

[0] [https://yourbusiness.azcentral.com/average-profit-margin- pha...](https://yourbusiness.azcentral.com/average-profit-margin- pharmaceuticals-20671.html)

<comment><USER5> If you're the only customer for their businesses, yes you can waive a magic wand and say now you'll get 40% less and deal with it. Especially if you're the government and it's a law. It's like Walmart with their suppliers. If you're the biggest baddest around you can kinda do what you want.

Certainly it will have impacts on R&D but are you suggesting that new drugs won't get created anymore? Don't drugs get created all throughout the EU?

<comment><USER6> Yes, we'll have the Walmart of healthcare. Very inspiring.

<comment><USER7> We already have that, we're just paying Whole Foods prices to get it.

<comment><USER5> Exactly. We're controlled by a handful of pharma/healthcare companies currently. I'd put more faith in the government being on the other side than those companies.

</comment></comment></comment></comment></comment><comment><USER8> I don't understand why there's so much resistance to having everybody save a huge amount of money while at the same time allowing everybody to be healthier. Boggles the mind.

<comment><USER9> Part of it is distrust of government. Part of it is status quo. Part of it is belief they will be worse off in the new system. Part of it is not wanting to have to supliment other's heath care. Those are the real underlying reasons, as far as I can tell.

<comment><USER10> For me, it's that I can't think of anything the government really does a good job at while also controlling costs.

<comment><USER11> The good news is that government only needs to keep costs lower than the private system. That doesn't require a good job of controlling costs.

</comment></comment></comment></comment><comment><USER12> I don't understand the reasoning / appeal of a new national sales tax for half of the new funding, as opposed to making this financed through payroll taxes exclusively. Maybe it's to emphasize the 8% cost savings right off the bat to get private companies on board, but man, solving the escalating cost problem is a gift on its own. And we have already done the dance of trickle down, how about we directly deliver cost relief to the worker one time...

<comment><AUTHOR> I don't really wanna defend it but I'll try. If it's payroll taxes then it's only workers paying, but financed partially by sales tax broadens the base to include trust fund babies as well as retirees and public aid recipients.

</comment></comment><comment><USER13> There is no problem paying for Medicare for All. The US federal government does not face an affordability constraint in dollars. It can pay for anything it wants, the only real constraint is inflation.

[https://www.forbes.com/sites/francescoppola/2018/04/17/every...](https://www.forbes.com/sites/francescoppola/2018/04/17/everything- youve-been-told-about-government-debt-is-wrong/) [https://www.nytimes.com/2017/10/05/opinion/deficit-tax- cuts-...](https://www.nytimes.com/2017/10/05/opinion/deficit-tax-cuts- trump.html)

<comment><USER14> MMT is largely nonsense, sorry. Inflation would be the immediate result of such a policy and would largely destroy the spending ability of such money printing.

No such thing as a free lunch.

<comment><USER13> "MMT is largely nonsense, sorry."

You have not rebutted any content in either of the articles I posted.

"Inflation would be the immediate result"

I said that inflation is a risk, as does every MMTer. The conversation we should be having is "how much inflation is really at risk here?" And inflation has been, in fact, quite elusive for a long time. A bit of inflation would be a good thing.

"such a policy"

What policy? MMT is not a policy, it's a description of the way the economic system already functions. It's an explanation of why the Federal Reserve can engage in $4 trillion of QE and not cause inflation to budge. It's an explanation of why the US federal government can run $1 trillion annual deficits and not cause interest rates to skyrocket. It's most definitely not nonsense.

"No such thing as a free lunch"

It's not free. The government is paying for it, and will later collect that money back in tax revenues. That's the way the government buys anything.

<comment><USER14> The first is just saying you can borrow as long as nominal growth exceeds the interest you need to pay. Sure, but that doesn't mean you can borrow an infinite amount, since as you borrow more interest will rise.

"What policy" you're advocating for printing money to spend regardless of the cost, which means costs will certainly rise.

If you want to have the "is the current inflation target optimal, or should we have a higher one" debate, don't pollute it by implying that spending doesn't matter. I agree the with the second article that the risk is inflation, not bankruptcy, but that doesn't mean it's not a real risk or that we should have larger deficits.

<comment><USER13> Of course spending matters. MMT is in agreement. Here's the main public advocate of MMT tweeting that:

[https://twitter.com/stephaniekelton/status/10443137336008744...](https://twitter.com/stephaniekelton/status/1044313733600874496)

Before we continue this discussion, you need to define "printing money". Because I will provide the definition: in the MMT worldview, printing money is synonymous with government deficit spending. Can we agree on that definition?

Ok, then inflation is a controllable problem. Because what I'm suggesting is increasing government spending to pay for Medicare. That's like... pushing on a gas pedal. It can create inflation. Now, there are 2 ways to deal with inflation:

1) Stop pushing on the gas pedal. Cut spending. 2) Raise taxes. That's like pushing on the brakes. Because my definition of "printing money" is "deficit spending", and raising taxes lowers the deficit.

So we shouldn't be afraid of inflation, because it is something we can control. And if we start by spending first on Medicare, and then taxing later to control inflation... then we've stabilized the size of the deficit while growing the overall size of the federal government budget. And there's Medicare for All.

<comment><USER14> No, you can print money without spending. Central bank is independent.

<comment><USER13> I'm not sure what we are really arguing about at this point.

I'm claiming that the government would increase deficit spending to pay for Medicare For All.

If you want to discuss the impact of having a larger government deficit, I would agree with you that inflation is the potential risk. We can have that discussion. I'm probably more optimistic about the risk of inflation and the effectiveness of mechanisms for controlling inflation.

If you want to discuss government debt default risk for a country that prints its own currency, MMT and many mainstream economists says it is zero.

If you want to discuss technical constraints on the size of the deficit for a country that prints its own currency (through mechanisms like bond vigilantes, etc) MMT would say there is no constraint. There is plenty of evidence to support this. Just look at what's happening with the US federal government deficit right now.

If you want to discuss what fraction of GDP is appropriate for government spending, that's an interesting conversation and would be curious to hear your thoughts.

Central banks are a necessary mechanism, as you point out, and need to do their job well. But the main questions in this debate are around fiscal policy, not monetary policy.

</comment></comment></comment></comment></comment></comment></comment><comment><USER14> Are we supposed to believe a report issued at the Sanders Institute Gathering represents an unbiased evaluation of Bernie Sanders' health plan?

</comment><comment><USER15> Would it be that hard of a stretch to convince people that a healthy population is more important and productive than how much you trust your neighbor's work ethic and role in a darwinism nightmare?

</comment><comment><USER16> It's pretty simple, through taxes. Most of the tax we would pay would be akin to the premiums we pay for private insurance... remember that we already pay medicaid and medicare taxes now.

<comment><USER17> The US pays more as a percentage of GDP for Medicaid/Medicare/Veterans healthcare than the UK spends on the entire NHS (which covers 100% of people).

<comment><USER18> This is often overlooked in the health care debate. If the US paid European prices for health care, the government could give everyone free healthcare without raising taxes at all.

<comment><USER9> I think they could lower taxes. [1]

1: Citation needed

</comment></comment></comment></comment><comment><USER19> Defund the military.</comment>


What it feels like to have poor communication skills in a meeting - <AUTHOR> http://hub.bs/2014/04/what-is-feels-like-to-have-poor-communication-skills-in-a-meeting/ <comment><USER2> I strongly disagree with the article. The engineer (in the video) shows good skills in communicating with the other people and takes their obviously silly requests seriously. At one point he has to explain that geometry itself is rendering the request impossible. Many problems could be resolved if businesspeople were forced to understand some technical aspects of what they are in control of, rather than forcing engineers to dumb-down complex technical solutions for people who don't really care what is behind it.

Being a software developer in an enterprise is often like being Top Gear's James May when he has to explain something to Jeremy.

</comment><comment><USER3> The video is funny because the requests are obviously logical impossibilities.

But what usually happens when these meetings go bad is that the client is just not very good at expressing what they really want, but try to use technical terms anyway. The engineer gets hung up reacting to and debating the literal possibility of what they heard, instead of treating it as an exercise in translating from an alien tongue.

Edit to add: This is where agile/rapid prototyping can help too. Imagine coming back to this client a couple days later with a red cross on a piece of paper and saying, "The 3rd line is pointing straight at you, so you just see the end--this point here in the middle. And you can't see the other lines because they've been deployed into the 4th, 5th, 6th, and 7th dimensions to maintain perpendicularity. Now let's test some business scenarios." It might turn out those other lines were not needed at all. Or some user testing might show that the color actually does not matter. Etc. (I love to play with bad metaphors.)

</comment><comment><USER4> "relishing in having squirreled away knowledge from your coworkers isn't productive or healthy."

Did we watch the same video? In what way did you interpret the character's behavior as trying to "squirrel away knowledge?"

<comment><USER5> Maybe he feels that the protagonist was hoarding the secrets of geometry and color, and that if only he had better communication skills everyone else in the room would suddenly realize the internal inconsistencies of their specification.

</comment></comment><comment><USER6> Yesterday's HN discussion of the original video: [https://news.ycombinator.com/item?id=7513182](https://news.ycombinator.com/item?id=7513182)

</comment><comment><USER7> Here's the video: [https://www.youtube.com/watch?v=BKorP55Aqvg](https://www.youtube.com/watch?v=BKorP55Aqvg)</comment>


Randomized Trial on Gender in Overwatch - <AUTHOR> http://danluu.com/overwatch-gender/ <comment><USER2> Previously: [https://news.ycombinator.com/item?id=19199715](https://news.ycombinator.com/item?id=19199715)

</comment><comment><USER3> It's somewhat pointless without a female voice though. I don't think most players will assume you are anything but male unless you speak...

<comment><USER4> That doesn't make it pointless. Specially since the results did not show equal treatment (which would be one thing that the assumption of being male until proven would explain)

<comment><USER5> Not pointless, but calling out misbehavior and giving education on the matter would be more helpful long term.

</comment></comment></comment><comment><USER6> In the past few weeks I've been a bit more conscious of this since I've been playing games with voice chat. In csgo the majority of women who used their mic were treated terribly. On the other hand, in valorant, which I've played a lot more of in the past weeks, I haven't noticed a single instance of extra toxicity because of gender. I'm not really sure why that would be as the communities are theoretically pretty much the same, but the biggest difference is that in Valorant I'm usually 3 to 5 stacking with friends whereas in csgo I was only 2 stacking. Regardless and without any numbers to back me up I feel like valorant is much friendlier to girls

</comment><comment><USER7> I took the time to read the full post and it does a good job mentioning flaws in its own methodology.

They played 339 games total. 58 games of competitive mode. 281 games of quick play mode.

Roughly half (184) as a female user and (155) as a male user.

Most games were played in 2018 when quickplay mode did not lock players into a 2-2-2 role queue to keep teams more even.

They did not use voice chat.

"My mechanics are pretty much as bad as it's possible to get."

The male account had a higher competitive rank (~2000 ish? placing in the middle tier of player skill) then the female account (~1500-2000?).

\---

With 2k+ hours in the game this study could go a lot further with better control groups, but is still interesting due to Overwatch's position as a very culturally diverse game that had been lauded for its ability to attract and maintain a large female playerbase in a genre that is notoriously masculine- dominated (competitive FPS games).

My top 3 controls I'd like to see are:

* Having a larger data set evenly distributed across major skill rankings (gold, plat, diamond, master, etc)

* Having a larger data set evenly distributed across characters (main-tank, off-tank, main-support, off-supprt, roles)

* Have each player engage in voice chat with a neutral tone

My anecdotal prediction based on my own experiences would yield:

* Women who talk in voice receive a flood of friend requests and sporadic sexual harassment (1/8 games?)

* Players of low impact heroes receive a larger set of criticisms across genders

* Both male and female participants inject toxicity into their own games during the study

* Certain ranks (silver, diamond) inject more toxicity then others

Finally, though these are my predictions and I do regularly play with a group of friends who are majority female, I have nowhere near a "full woman's perspective" on playing this game and my predictions could be way off across the various controls (or all controls).

EDIT: A soundboard with male and female voices would solve for the voice chat problem very well.

</comment><comment><USER8> Why don't these games just let users report abuse like sexism and racism and then permaban the abuser? Overwatch is apparently $20, how many people are going to keep paying $20 a pop so they can call one woman something horrible?

<comment><USER9> They do, and I found Blizzard's moderation to be better than most. This is especially true of hate speech. But as the linked article finds the bigger issue is that discriminated groups are disproportionately the targets of criticism. That's much harder to police and the end result, making the game less fun for those targeted, is the same.

<comment><USER8> I don't know what to do about the mansplaining or whatever that might happen more often to women, but the sexualized messages were bad enough IMHO to deserve a permaban, even if they spell it "dicc".</comment></comment></comment>


Easy Map-Reduce With Hadoop Streaming - <AUTHOR> http://www.igvita.com/2009/06/01/easy-map-reduce-with-hadoop-streaming/

<comment><USER2> I like the semantics of a pipe-oriented flow. Combined with a sandbox[1] and you could accept arbitrary code from customers/clients/whatever.

[1] <http://danwalsh.livejournal.com/28545.html></comment>


Droplr for iOS Is Now Free - <AUTHOR> http://www.thegeekscompanion.com/home/daily-find-droplr-for-ios-is-now-free.html <comment><USER2> Any reason to switch from Dropbox?

<comment><USER3> It's not really the same as Dropbox. Dropbox is all about file synchronization and Droplr is about file sharing. Drag a file, get a tiny link to the content.

You can get the same with Dropbox but with a lot more interactions, so it kinda breaks the work flow.</comment></comment>


Show HN: Explore EBNF Grammars Interactively - <AUTHOR> http://www.grammarling.com <comment><AUTHOR> Author here, this was a quick hack using ClojureScript and react to help myself play around with EBNF grammars by rendering them with HTML/CSS. All credit goes to the wonderful Instaparse library written by Mark Engelberg. Yes I'm aware the example grammar isn't perfect, but that was the point of making this :-)</comment>


Wolfram alpha thinks there are 1000 bytes in a kilobyte apparently - <AUTHOR> http://www.imgur.com/jvehe

<comment><USER2> Wolfram Alpha is right. The use of "kB" to refer to 1024 bytes is incorrect and results from historical issues involving hardware addressing and RAM.

I discuss this in some more detail on the tarsnap (beta testing) website in explaining why I charge $0.30 per GB-month of storage instead or $0.30 per GiB-month of storage: <https://beta.tarsnap.com/GB-why.html>

</comment><comment><USER3> I think I caught a discussion elsewhere about this; but Wolfram gets it right when using the SI notation:

<http://www05.wolframalpha.com/input/?i=1000000+MiB+in+GiB>

<comment><USER4> Hard drive makers also prefer the SI definition, as it makes the sizes seem larger.

</comment></comment><comment><USER4> When I first heard of 'Kibibytes' and 'KiB', I thought it was silly.

But each time there's confusion, the pedantry looks a little better.

And certainly when writing documentation and user interfaces, the KiB/MiB/GiB/TiB/PiB distinctions should be made clear.</comment>


Apple is probably going to rebrand OS X - <AUTHOR> http://9to5mac.com/2016/03/30/interface-builder-document-os-x-10-11-4-macos-rebranding/ <comment><USER2> If this happens I bet they did it for trademark purposed only.</comment>


My Keynote at the Salta Conference - <AUTHOR> https://medium.com/@richardeng/my-keynote-at-the-salta-conference-435dfaccc888 <comment><USER2> It's probably too late to change the title in HN, but you should have included "Smalltalk" somewhere. Perhaps use the title of the talk "My Keynote at the Salta Conference - The Marketing of Smalltalk"</comment>


Fast Servers - <AUTHOR> http://geocar.sdf1.org/fast-servers.html <comment><USER3> Okay, this is a really cool post, but I have a small bit of criticism - <USER2> code samples are _really hard_ to read. I'd recommend, at minimum, adding a bit more whitespace so you don't end up with lines like this:

        if(e[i].events&(EPOLLRDHUP|EPOLLHUP))close(e[i].data.fd);

Despite that minor criticism - pretty cool stuff!

<comment><USER4> I thought it was misformatting but wow look at his code [https://github.com/geocar/dash/blob/master/d.c](https://github.com/geocar/dash/blob/master/d.c)

<comment><USER5> I've been known to write things for other people, in other ways at times[1], [2], but I'll usually start out writing this way[3], then expand it out _simply_ to avoid that recoil that you just experienced.

I actually find working this way very helpful to finding bugs and noticing redundancies, and if you're curious about techniques that improve the programmer, this method is worth some study.

[1]: [https://github.com/geocar/mmap/blob/master/mmap.cpp](https://github.com/geocar/mmap/blob/master/mmap.cpp)

[2]: [https://github.com/geocar/cdp-tools/blob/master/cdp- listen.c](https://github.com/geocar/cdp-tools/blob/master/cdp-listen.c)

[3]: [https://github.com/geocar/con/blob/master/con.c](https://github.com/geocar/con/blob/master/con.c)

<comment><USER6> But what is that method? To my untrained eye it just looks obfuscated.

<comment><USER5> I am still working on a good explanation. Here's what I've come up with so far:

I have noticed every page I scroll causes a comprehension loss of around 90%, so in reading something that is 10 pagefuls long, I might only be able to reproduce a tiny part of the program.

I find not scrolling, and just moving my eyes, I rapidly absorb the program, and I find most bugs just by reading the code. This practice is absolutely impossible for me if I have to scroll very far and made difficult by scrolling at all.

A lot of J/K/Q/KDB programmers do this because it is similar to APL, but I don't have an APL background. I simply do not know how to do this except to write horizontally.

I learned a lot about this method by studying Arthur's code (example[1]). He frequently recommends Iverson's paper[2]. I just try to make every character count because it's still taking up space.

Maybe keeping that in mind will help you read each word carefully -- maybe even out loud, if it helps.

[1]: [http://www.nsl.com/papers/origins.htm](http://www.nsl.com/papers/origins.htm)

[2]: [http://www.jsoftware.com/papers/tot.htm](http://www.jsoftware.com/papers/tot.htm)

<comment><USER4> To me it looks machine generated and it would be hard for me to mentally keep track and tick off "okay I know what the lines above do" but if it works for you and the people you work with are fine with it then good for you and I don't mean that sarcastically.

The way I work and similar to most people I know but perhaps with less screen real estate.. I can fit a hundred vertical lines of one text buffer comfortably on my monitors (plural), and I can have about a dozen buffers up at the same time. If needed, that can be the same document scrolled to different areas. I also use a tool like cscope or for some languages an IDE to get additional context (type info, available operations), and that's the only way for me to quickly comprehend truly large bodies of code (kernels, etc). I don't think your strategy would work well for the projects I work on.

<comment><USER5> We will see.

One of the fastest databases in the world written this way (kdb), and I was able to make an operating system kernel this way (kparc) and now a dynamic web server, and so on.

Maybe it would help you to keep an open mind to know it took some time to learn how to read and write code this way?

Perhaps it would also help to know it has actually improved my ability to work on code that looks more like what you are used to.

One of the hardest things to do is to look at something so alien, and suppress the recoil and discomfort and really be critical:

Here is something you cannot read; something others can do that you cannot.

Don't you want to figure out how to do something that others can do?

Maybe you will find other limitations: its alien nature is certainly a limitation, but maybe you're right and there are others.

But in the meantime, it produces small fast and correct code quickly, and that's pretty amazing. Maybe there are other benefits as well.

We will see.

<comment><USER4> I guess it seems like I'm bashing you by expressing shock but I don't mean that. Seriously, more power to you for expressing yourself in less space than I can or desire to.

<comment><USER5> I don't think you're bashing me.

I'm telling you the shock is normal, and that this is something you can learn to do.

However the desire surprises me: If someone does something I cannot do, and it is beneficial, I want to learn it.

Here I point to smaller, faster, and more-correct programs, written in less time. Why would any programmer not want to be able to do _that_?

I never understood Paul's Blub essay either, though.

</comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER7> Can't completly understand the main message of what is proposed here.

Using multiple threads were one thread accepts connections and others process the connections is already quite standard (e.g. look on how Netty for Java works with a boss thread and worker threads).

However the pattern won't work with blocking IO like it's suggested in the referred page if your worker thread should handle multiple connections. Even if poll tells you the connection is readable there might not be enough data for a complete request - so you need a state machine for reading again. Or you block until you have read a complete request and thereby block other connections that should be served by the same thread(pool). And if you block on writing responses then one slow connection will block the processing of the others.

What also should be considered is that by far not all network protocols follow a pure request -> response model. If the server may send responses asynchronously (out of order) or if there is multicast/broadcast support in the protocol the requirements on software architecture look different.

</comment><comment><USER8> There is nothing fundamentally new described in the blog post, although pinning threads to core is almost never the default operation mode (though many popular servers expose an option for turning this one).

As someone else stated in another post, SO_REUSEPORT and accept4() is best, all things considered, way to accept connections across multiple threads. Again, most modern servers support this by default, if supported by the underlying operating system (e.g nginx).

By the way, Aerospike accepts new connections in a single thread and then directly adds the socket FD to one of the i/o threads (round-robbing selection scheme) directly using e.g epoll_ctl(fd, EPOLL_CTL_ADD, ..).

See [http://blog.tsunanet.net/2010/11/how-long-does-it-take-to- ma...](http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make- context.html) for costs of context switching, and performance improvement when pinning threads to cores (it's quite impressive). Also, note that according to the author, on average, a context switch is 2.5-3x more expensive when using virtualization.

You may also want to read [https://medium.com/software-development-2/high- performance-s...](https://medium.com/software-development-2/high-performance- services-using-coroutines-ac8e9f54d727#.ho0s7q28b) \-- it's been a long time since I wrote this, but it describes how one can deal with asynchronous I/O and other operations that may block a thread.

<comment><USER5> I'm glad Aerospike uses this technique.

Yes, it is not new. I've been using this method in one form or another (e.g. SIGIO/F_SETOWN) for more than a decade, however nginx (relatively modern?) _doesn 't_ use this technique and could really benefit from it on some workloads. I wrote about it after I casually mentioned it a roomful of quant programmers and found out they didn't know about it; I do not think most servers use this technique.

I've added a note about accept4(). When I have some time I intend to repeat my benchmarks with it to see how it does. Context switching is much cheaper than memory so I do not expect much.

You should publish benchmarks that are easy for other people to reproduce. I tried running Aerospike on my laptop and was unable to get above 25,000 writes/sec. I'm certain I'm doing something wrong, because the same hardware easily gets above 60,000 writes/sec on KDB per CPU.

<comment><USER8> I am not using AeroSpike nor am I affiliated with them. I just studied their code base (I study codebases as a hobby ). There is a _lot_ of room for improvement there IMO but that's true for the majority of codebases I went through :)

</comment></comment></comment><comment><USER9> This is not an ideal design, surprised it has this many upvotes.

Transferring the accepted connections this way involves an extra system call to epoll/kqueue to add the event into the particular thread and the accepting thread can become a bottleneck under high load.

A better design would be to share the listening socket across threads and have each thread accept at its own pace, at least this avoids the additional kqueue/epoll system call needed to add the new fd into the thread's poller, but it does cause lock contention in the OS which is still less expensive than a system call. What's even better is if you're on a newer linux version, or bsd, consider using SO_REUSEPORT which allow each thread to bind/accept on the same port and avoids the lock contention issue.

Also you should consider using accept4() to set the non-blocking flag during accept instead of the additional system call to set it to non-blocking.

<comment><USER5> One of the benefits of this design overlooked is that you can have several dedicated accepting-threads. The benefit is magnified when you have something like HTTP where the client speaks first.

Another benefit of this design overlooked is that individual cores may not _ever_ need to read memory -- the entire task can run in L1 or L2. If a single worker becomes too complicated this benefit is lost, and memory is much _much_ slower than cache.

SO_REUSEPORT is not panacea, and I do not agree that you should have threads accept _and_ handle requests, but I do think SO_REUSEPORT is useful for making upgrades easier. I have (historically) simply blocked outgoing ICMP port- unreachable messages for ports that I know are supposed to be running since that's more portable than SO_REUSEPORT.

accept4() is a good idea. I've added a note about that. Thank you.

</comment></comment><comment><USER10> Backpressure between threads and utilization could be hard here. Balance between the speed of the accept, request, and worker threads is something I'm curious about. In theory, you could create pools of each if you find that one set bottlenecks the other. Also, workload isolation is important--I'm curious how the author deals with (or avoids) transferring ownership of large amounts of memory and cache between cores without incurring significant transfer overhead.

<comment><USER5> Try not to transfer memory.

On small examples, I arrange memory access so that once the memory has been migrated, a lack of thrashing will be good enough. If I need a hot start, I can use another trick:

On Linux, you can create separate processes that share fds but not memory. On modern UNIX you could pass the epoll/kqueue fds around using sendmsg. This allows you to get everything ready before hitting bind() and listen().

</comment></comment><comment><USER11> This is pretty old, right? These days 'Fast Servers' refers to bare-metal network interface without a kernel which can achieve far higher throughput than passing it through a kernel/epoll.

<comment><USER12> Direct memory mapping from NIC to userspace with a userspace TCP/IP stack can significantly accelerate ultra low latency processing.

The effect basically disappears when you're looking at webpages that take 10-1000ms to generate.

<comment><USER11> Agreed, as soon as per-request processing becomes a large portion of the work it will dwarf these types of optimizations.

The article is talking specifically about " _simple one-page performant servers that easily get into the 100k requests /second territory_", which can see very large throughput increases with direct NIC access.

<comment><USER5> dash[1] is a _dynamic_ webserver that uses the logic described in the article (content logic is in Q/KDB).

I have considered writing a userspace TCP HTTP server like the one you suggest, but it would be a demonstration of how to write a state machine and not how to better use the facilities that the operating system provides for writing a server.

[1]: [https://github.com/geocar/dash](https://github.com/geocar/dash)

</comment></comment></comment></comment><comment><USER13> This pattern is called "I/O completion ports" or more generally "overlapped I/O" in Windows and has been there since the very first version of Windows NT.

<comment><USER14> I believe it was present in Windows NT from the start because it was present in DEC's VMS operating system, which Dave Cutler was also a key developer. It may date to before VMS for all I know. It's not at all new.

</comment></comment><comment><USER15> Very good pattern description, which demonstrates nicely that if basic/system assumptions are changing, new pattern need to embrace.

I'd love to see more patterns like that.

<comment><USER16> I think the pattern is the already the norm for a while, a.k.a async programming.

</comment></comment><comment><USER17> good job of explaining their paradigm, but i did not see any explanation as to why it is better than traditional epoll.

what advantage do you gain by separating accepting connections from handling request / response?

<comment><USER18> Consider the case of 1000 clients trying to establish an SSL connection all at once.

</comment></comment><comment><USER19> > Fast Servers

Fast in what sense? Throughput, or latency?

> One thread per core

Oh, I guess the answer to the previous question is "throughput".

<comment><USER11> Could you explain why one thread per core translated to throughput and not latency targeting?

Each core can only handle a fixed number of instructions per second regardless of number of threads assigned to that core. If a core receives 100 requests, it could handle them all sequentially with 1 thread, or utilize 2-100 threads to handle them.

When using 1 thread, the first request will be completed within the minimum amount of time the core is able to do the work. The second request will complete in the same amount of time after the first.

When using 2 threads, the core will carry out the work an in interleaved fashion between the 2 threads. Both requests will complete at the same time as the 2nd request completed in our 1 thread example above.

I'll try make it clearer - assume a request takes 5 ms:

      1 Thread
        Request 1: start processing at 0ms, complete at 5ms
        Request 2: start processing at 5ms, complete at 10ms

      2 Threads
        Request 1: start processing at 0ms, complete at 10ms
        Request 2: start processing at 0ms, complete at 10ms

As can be seen, the average latency is better with only 1 thread - avg 7.5ms latency when 2 requests arrive at the same time. 2 threads gives us avg 10ms latency.

Throughput should theoretically remain the same if you disregard context switching time and cache invalidation. In the presence of both, the single thread method should outperform in terms of throughput as well.

<comment><USER19> Suggestion: Try with 1 job of X ms, and N jobs of 1ms, and figure out for different N where the break-even point of X lies. That might give some more insight.

</comment></comment></comment><comment><USER20> "One worker per core" is too simplistic. Yes, as I wrote in a pretty well- known article a dozen years ago, it's a good starting point. Yes, it can avoid some context switching. On the other hand, when you have to account for threads doing background stuff it can be too many, leaving you with context thrashing between oversubscribed cores. When you account for threads blocking for reasons beyond your control (e.g. in libraries or due to page faults) it might be too _few_. The right number of worker threads is usually somewhere around the number of cores, but depends on your exact situation and can even vary over time.

Those who do not know the lessons of history...

</comment><comment><USER21> This is all about achieving a dataflow architecture by exploiting CPU cache hierarchy, right?

We're basically talking about going _from_ a design where 10k little "tasklet" state machines are each scheduled onto "scheduler" threads; where during its turn of the loop, each tasklet might run whatever possibly-"cold" logic it likes...

...and turning it _into_ a collection of cores that each have a thread for evaluating a particular state-machine state pinned, where each "tasklet" that gets scheduled onto a given core will always be doing the same logic, so that logic can stay "hot" in that core's cache—in other words, so that each core can function closer to a SIMD model.

Effectively, this is the same thing done in game programming when you lift everything that's about to do a certain calculation (i.e. is in a certain FSM state) up into a VRAM matrix and run a GPGPU kernel over it†. This kernel is your separate "core" processing everything in the same state.

Either way, it adds up to _dataflow architecture_ : the method of eliminating the overhead of context-switching and scheduling on general-purpose CPUs, by having specific components (like "I/O coprocessors" on mainframes, or (de)muxers in backbone switches) for each step of a pipeline, where that component can "stay hot" by doing exactly and only what it does in a synchronous manner.

The difference here is that, instead of throwing your own microcontrollers or ASICs at the problem, you're getting 80% of the same benefit from just using a regular CPU core but making it avoid executing any non-local jumps: which is to say, not just eliminating OS-level scheduling, but eliminating any sort of top-level per-event-loop switch that might jump to an arbitrary point in your program.

This is way more of a win for CPU programming than just what you'd expect by subtracting the nominal time an OS context-switch takes. Rewriting your logic to run as a collection of these "CPU kernels"—effectively, restricting your code the same way GPGPU kernels are restricted, and then just throwing it onto a CPU core—keeps any of the kernel's cache-lines from being evicted, and builds up (and never throws away) an excellent stream of branch-prediction metadata for the CPU to use.

The _interesting_ thing, to me, is that a compiler, or an interpreter JIT, could (theoretically) do this "kernel hoisting" for you. As long there was a facility in your language to make it clear to the compiler that a particular function _is_ an FSM state transition-function, then you can code regular event-loop/actor-modelled code, and the compiler can transform it into a collection of pinned-core kernels like this as an _optimization_.

The compiler can even take a hybrid approach, where you have some cores doing classical scheduling for all the "miscellaneous, IO-heavy" tasklets, and the rest of the cores being special schedulers that will only be passed a tasklet when it's ready to run in that scheduler's preferred state. With an advanced scheduler system (e.g. the Erlang VM's), the profiling JIT could even notice when your runtime workload has changed to now have 10k of the same transition- function running all the time, and generate and start up a CPU-kernel-thread for it (temporarily displacing one of its misc-work classical scheduler threads), descheduling it again if the workload shifts so that it's no longer a win.

Personally, I've been considering this approach with GPGPU kernels as the "special" schedulers, rather than CPU cores, but they're effectively equivalent in architecture, and perhaps in performance as well: while the GPU is faster because it gets to run your specified kernel in true SIMD parallel, your (non-NUMA) CPU cores get to pass your tasklets' state around "for free", which often balances out—ramming data into and out of VRAM is expensive, and the fact that you're buffering tasklets to run on the GPGPU as a group potentially introduces a high-latency sync-point for your tasklets. Soft- realtime guarantees might be more important than throughput.

\---

† A fun tangent for a third model: if your GPGPU kernel outputs a separate dataset for each new FSM state each of the data members was found to transition to, and you have _other_ GPGPU kernels for each of the other state- transition functions of your FSM waiting to take those datasets and run them, then effectively you can make your whole FSM live entirely on the GPU as a collection of kernel "cores" passing tasklets back and forth, the same way we're talking about CPU cores above.

While this architecture probably wins over both the entirely-CPU and CPU- passing-to-GPGPU models for pure-computational workloads (which is, after all, what GPGPUs are supposed to be for), I imagine it would fall over pretty fast if you wanted to do much IO.

Does anyone know if GPUs marketed specifically as GPGPUs, like the Tesla cards, have a means for low-latency access to regular virtual memory from within the GPGPU kernel? If they did, staying entirely on the GPGPU would definitely be the dominant strategy. At that point, it might even make sense to have, for example, a GPGPU Erlang VM, or entirely-in-GPGPU console emulators (imagine MAME's approach to emulated chips, but with each chip as a GPGPU kernel.)

If you can get that, then effectively what you've got at that point is less a GPU, and more a meta-FPGA co-processor with "elastic allocation" of gate- arrays to your VHDL files. System architecture would likely change _a lot_ if we ever got _that_ in regular desktop PCs.

<comment><USER22> Woah.

I think that many "servers" today aren't going to benefit though from the level of optimization that you're talking about. Network bandwidth is at least an order of magnitude slower than memory and PCI throughput. For all but the most heavyweight computational tasks (ie. gaming, finance, scientific computing, etc.) this kind of multiplexing optimization is very helpful. If you're needing to get that kind of performance, you would userspace map off the NIC.

With how fast modern processors (CPUs and GPUs) are, whats much more important nowadays is not stalling on the flow from the NIC. The solution of the original author seems to me like a very simple fix for the old naive paradigm of state machine switching off from a single thread.

I think you might be (impressively) too close to the metal, and guilty of premature optimization. For example, a simple database application would benefit much more from keeping the slow I/O bottlenecks flowing than from the compute multiplexing.

<comment><USER21> Ah, true; this whole thing makes very little sense for the general case. Most workloads aren't like this.

The real goal here, in my mind, was to allow people in those particular high- performance domains (gaming especially, though the other ones would probably benefit too) to code at a higher abstraction level.

In my ideal world, a physics engine, for example, would be implemented in code as actors sending messages—with one actor for each physical (e.g. collide- able) object. Not only is that really expensive; the naive approach wouldn't even work! (You need "tick" events spammed to every physics-actor once per frame, which is just absolutely ridiculous.) But then the compiler transparently takes that and _spits out_ something that isn't actor-modelled at all, but rather is a modern-day physics engine doing GPGPU SIMD to arrays of quaternions.

Or, in short: I want to code games in Elixir, without an impedance mismatch in the places where one of my actors' components turns out to need groupwise synchronous shared-memory evaluation rather than piecewise asynchronous reduction-scheduled evaluation. (That sounds like something that should be followed up with "and a pony!", but—given that the Erlang BEAM VM already has the infrastructure of "dirty" schedulers for CPU-bound tasks, and an LLVM IR step in its JIT which could be shunted over to a PTX-ISA target—this actually shouldn't even be that hard an extension to make.)

</comment></comment></comment><comment><USER23> check out [http://dpdk.org](http://dpdk.org). I just delivered a session on DPDK and SR-IOV. There's a whole set of libraries, classifications, and frameworks to tune/tweak linux systems on x86 in user space.

</comment><comment><USER24> It's hard to say from the article, but is the first example single threaded? If so, then yes, adding more threads is of course going to speed it up.

However, they don't each need their own queue; epoll supports being polled by >1 thread. In such a setup _any_ thread available can handle any request; in the author's setup, you're going to need to make sure any particular thread doesn't get too bogged down if the requests are not equal. (That pick function is important.) I'd be more curious how those two compared. (The author's is certainly slightly easier to write, I think.)

<comment><USER5> If you can get into cache and stay there, you can enjoy 100x or even 1000x speedup.

Having your CPU do a lot of different things is a good way to get out of cache :)

</comment></comment><comment><USER25> I'd love to see benchmark numbers comparing this approach to others.

<comment><USER5> My dash webserver uses this trick, and I've published[1] benchmarks comparing it to KDB's built-in webserver and NodeJS (which uses libev)

[1]: [https://github.com/geocar/dash#performance](https://github.com/geocar/dash#performance)

</comment></comment><comment><USER26> Why aren't servers using the proposed pattern already?

<comment><USER27> My web server, uses the same pattern. There's an article explaining it in details here: [http://tia.mat.br/posts/2014/10/06/life_of_a_http_request.ht...](http://tia.mat.br/posts/2014/10/06/life_of_a_http_request.html)

</comment></comment><comment><USER28> Has everyone forgotten the c10k site, which covers all this?

<comment><USER5> Are you sure this technique is documented on C10k[1]?

I think most people use a single epollfd/kqueue instead of one per thread.

[1]: [http://www.kegel.com/c10k.html](http://www.kegel.com/c10k.html)

<comment><USER28> The listed strategies are:

1\. Serve many clients with each thread, and use nonblocking I/O and level- triggered readiness notification. 2\. Serve many clients with each thread, and use nonblocking I/O and readiness change notification 3\. Serve many clients with each thread, and use asynchronous I/O and completion notification 4\. Serve one client with each server thread 5\. Build the server code into the kernel 6\. Bring the TCP stack into userspace

You may notice a lot of them are "with each thread".

<comment><USER5> The trick isn't "use a bunch of threads" but to have each cpu do a separate task (N1 threads for accept, N2 threads for read, N3 threads for write, N4 threads for close, etc) and using a separate keventfd/epollfd for each thread.

The tasks can still use blocking calls (or nonblocking, as they like), which makes it different than strategy 1 or 2. It shards by task which is different than 3, or 4. Completion-notification is not explicit. It is clearly different than 5 or 6.

I think you should read it carefully. Popular webservers like nginx and varnish do not implement this method, so I do not believe it is common, and there are a few neat features of this method:

1\. Tasks will usually fit into cache. If the kernel hotpaths to IP they usually won't fall out of cache either. This can produce 100x or even 1000x speed improvements for complex tasks.

2\. It may be easy to convert an existing program to this design than to replace everything with nonblocking IO, or to move into kernel space, or to attach to a userland TCP stack.

These things are important if you want to write faster servers.

<comment><USER28> What if you have to map accept, read, write & close (so four types of tasks) to a six cores? ;-)

Yes, nginx & varnish have different approaches. Their approaches tend to work better for their type of application.

One thread or process per core, with its own event loop, is indeed a very standard pattern. The process-per-core style approaches tend to shard per fd (e.g., nginx), while the thread-per-core style tend to either shard by IO request or don't shard at all (each thread has an independent poll of all outstanding IOs). Particularly if you use a continuations style paradigm, it makes it really easy to convert over existing code to the design.

In practice, you will typically have better cache locality with the fd than your position in the state machine (and the model you are describing isn't quite where you are in the state machine, but you can adjust it to fit). If your state machine is simple enough, your approach might get better _instruction_ cache hit rate, but you are basically guaranteeing that _data_ has to move between the processor caches in very rapid succession. In practice, not only are you forcing the fd's to be passed between processor caches, but there tends to be data locality with that fd. While it is easy to have the instruction cache replicated across all processors, the data mutates quite rapidly. Again, this stuff is covered in the discussions on the c10k site.

</comment></comment></comment></comment></comment><comment><USER23> check out dpdk.org</comment>


A Patent Lie: How Yahoo Weaponized My Work - Waxy.org - <AUTHOR> http://waxy.org/2012/03/a_patent_lie_how_yahoo_weaponized_my_work/ <comment><USER2> What does this article actually say? That Baio willfully signed meaningless or fraudulent documents and that he applied for patents that he new were without merit, for money. And now that the issue of these patents might become better known, he's preemptively writing a disingenuous CYA explaining how he's _shocked_ that a corporation might try to _profit_ from his collusion.

Recently Baio had to pay a settlement because he stole someone's intellectual property and used it for a commercial purpose. In this case he also wrote a whiny, disingenuous article [<http://waxy.org/2011/06/kind_of_screwed/>] trying to explain how he didn't really intend to do anything wrong. So he's abused the intellectual property system from both sides. Apparently, principles only come into play when it's time for explanations; at the point of deciding what to do, this man seems to consider only the path of least resistance between the cash and his wallet.

And his public relations campaign is working. There is no shortage of gullible hotheads [<http://lee-phillips.org/music/whoIsTheDick/>] rushing to his defense and to the excoriation of Baio's victims.</comment>


Ten Lessons I Wish I Had Been Taught - <AUTHOR> http://www.math.ohio-state.edu/~nevai/MYMATH/rota_ams_notices_01_97.html

<comment><USER2> "Every Mathematician Has Only a Few Tricks"

Now I'd like to see a summary of some of these tricks of mathematicians.</comment>


World Population Growth - <AUTHOR> https://ourworldindata.org/world-population-growth <comment><AUTHOR> Previous discussion about an earlier revision of this article, from 3 years ago: [https://news.ycombinator.com/item?id=12691669](https://news.ycombinator.com/item?id=12691669) (111 comments)</comment>


Apple II and Apple IIe emulators written in JavaScript and HTML5 - <AUTHOR> https://github.com/whscullin/apple2js <comment><USER2> For static site projects like this, I highly recommend setting up gh-pages or some other static site hosting. It's a lot of effort to expect people to clone the repo, install the dependencies, and build the project to try it out.

The no-hassle experience of running it is all the fun of building these for the web, after all!

<comment><USER3> If you do this it's worth noting that gh-pages, and Netlify's free tier, and probably others, cap egress bandwidth at 100GB/month. For a project like this one that's fine (it only downloads a few meg) but hitting HN and Reddit could easily burn through all that on a bigger project. If you care about that it's worth using something like Cloudflare as a frontside cache.

<comment><USER4> GitHub Pages only has a soft limit. As their documentation say:

> If your site exceeds these usage quotas, we may not be able to serve your > site, or you may receive a polite email from GitHub Support or GitHub > Premium Support suggesting strategies for reducing your site's impact on our > servers, including putting a third-party content distribution network (CDN) > in front of your site, making use of other GitHub features such as releases, > or moving to a different hosting service that might better fit your needs.

I expect one-time hitting front page of HN or Reddit is something they won't frown on too much, whereas constantly hitting that cap on an ongoing basis is going to raise many more eyebrows.

</comment></comment></comment><comment><USER5> That's a nice emulator. Right now, one of the problem emulators struggle with is cycle accuracy. A (very) few demomakers (French Touch, Deater) are actually pushing the boundaries on the Apple with cycle accurate timings for various video or sound effects and the emulators start showing their limits.

However, for common usage (i.e. playing old games), emulators are perfectly fine. AppleWin seems the most advanced (lots of supported hardware, lots of small fixes to support edge cases of cycle accuracy), followed by Mame and Apple2JS. And some other I probably forget...

Also, recently a new file format was introduced for better preserving the old floppy disk and their devious copy protection (WOZ). This will improve the emulators further (and already has as far as reading disk is concerned)

Specific to the Apple2 emulation scene (I guess) is the effort of a person named "4am" to clean crack all Apple software so that they can continue working in the emulators (and old Apple's).

<comment><USER6> What does clean crack mean?

<comment><USER7> No scene intros, shout outs on startup, or extra payloads. Just a crack that makes the software work without some sort of '3rd word on page 2 8th paragraph from the manual' or only the original disk works because sector 22 is wonky or specific data. That plus the woz format which is a sector for sector copy (including extra wonky sectors). I think the most interesting one is the pinball construction kit which they only figured out a year or two ago. That one had many layers. MAME is also a good emu for Apple stuff if you want to try it too. The early mac stuff is a bit shaky due to a particular part not being emulated 100% yet.

<comment><USER8> WOZ isn't a sector copy, it's a _raw magnetic flux_ copy with timing information added. It's extremely impressive stuff:

[https://wiki.reactivemicro.com/Applesauce](https://wiki.reactivemicro.com/Applesauce)

It also makes really pretty images:

[https://twitter.com/a2_4am/status/1022567636914393088](https://twitter.com/a2_4am/status/1022567636914393088)

<comment><USER7> Thank you for the correction, I knew that but for some reason my brain spit out sector copy. Sorry about that. It is similar to what they are doing with LD and tapping pretty much right off the laser pickup. Woz is more of a filtered format after they toss out all of the extra junk doing a flux copy picks up. The LD guys are doing something similar. The pics are cool too because you can see how the devs were laying out the tracks and sectors to get a bit more perf out of the drives. I would have linked myself but this place I work does not let me at most of the emu sites.

<comment><USER8> The funny layouts were also driven by copy protection methods. The methods took advantage of physical properties of the disk and read circuit that the processor couldn't see but a duplication system could.

The work by 4am and others was driven by the desire to preserve these works without needing to break the physical copy protection to do it.

<comment><USER7> The real annoying ones were the read the sectors in a block starting at 0 and going up you get one set of data. But if you run it backwards or do a deliberate seek you get a different set of data. Because of the interface or drive used or the firmware on that drive like you said. Starforce also used a variant of that. The super annoying ones are the ones that played with the ECC bits too or like the PS1 having a special wobble track. The laserdisc ones I am a bit excited for. They are getting some really nice images out of them vs copying it off the board in some random place or worse out of the svideo/RCA connector. Unlike the apple stuff they are having to resort to multi image copies to get an average of 'good' because of scratches or poor SNR out of some pickups. The apple ones can filter it to a point as you know you are supposed to get 8 bit chars out of it. With LD not so much though. Seeing the diff copy protections is kind of cool too like the ones where they put a special sector out of reach for normal firmware but they would re-write it on the fly and force the drive to read it. Think there were a few of those on the c64.

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> Slightly off topic question—how hard is it to write an Apple II emulator compared to an NES emulator? Specifically, if I've already written an NES emulator, assuming I can reuse most of the 6502 core, what are the minimum set of support chips I need to implement?

<comment><USER10> I don't think you'll know till you do it. The apple II is older than the NES, so not as sophisticated, so easier. But the designer (WOZ) was really good at pushing the existing hardware to the limit. I would suspect you'd want to target the newer //e and //c machine (64 & 128KB ram and 80 col cards with lower case)

Graphics alone are strange especially the high res mode. (I used to program an apple //e in middle school..)

[https://en.wikipedia.org/wiki/Apple_II_graphics](https://en.wikipedia.org/wiki/Apple_II_graphics)

but the apple 2 reference manuals are online (even if the scan isn't the best).

[https://archive.org/details/Apple_IIe_Technical_Reference_Ma...](https://archive.org/details/Apple_IIe_Technical_Reference_Manual/mode/2up)

and

[https://archive.org/details/Apple_IIe_Reference_Manual/mode/...](https://archive.org/details/Apple_IIe_Reference_Manual/mode/2up)

</comment></comment><comment><USER11> PR#6

no, really, you old Apple users know what I mean. That's what you would type to get the thing to load DOS.

<comment><USER10> PR#3 got you into 80 column mode. I thought the PR# was to activate a card in a slot number.. but I'm not sure.

[https://archive.org/details/iie-80-column-text- card/page/n29...](https://archive.org/details/iie-80-column-text- card/page/n29/mode/2up)

Apple2 Manuals where quite excellent back in the day. The internet archive has a bunch. Search friendly machine names the are not (Apple ii , apple//e, apple][ , apple //c.....)

<comment><USER12> In Unix terms PR# redirects the standard output to the hardware in the indicated slot and IN# redirects the standard input. From then on the BASIC commands PRINT and INPUT will access that hardware instead of the screen and keyboard respectively.

In practice the hardware can actually do anything it wants when you PR#, like booting from an attached floppy.

</comment></comment></comment><comment><USER13> I was just reading the Apple IIGS Wikipedia page when I found this:

> The use of a 2.8 MHz clock was a deliberate marketing decision to limit the > IIGS's performance to a level lower than that of the Macintosh, a decision > that had a critical effect on the IIGS's success; the original 65C816 > processor used in the IIGS was certified to run at up to 4 MHz. > Additionally, as early as 1987, faster versions of the 65C816 processor were > readily available, with certified speeds of between 5 and 14 MHz. Apple, > however, refused to make use of the faster microprocessors (which had a > negligible difference in cost, if any) and intentionally kept the machine > locked down to 2.8 MHz throughout its entire production run.

It seems like Apple's consumer-unfriendly business tactics are of all times ... :(

[https://en.wikipedia.org/wiki/Apple_IIGS](https://en.wikipedia.org/wiki/Apple_IIGS)

<comment><USER14> > which had a negligible difference in cost, if any

I don't have the contemporaneous pricing handy, but as someone who routinely perused semiconductor price sheets in the '80s, I can say this is suspect. Higher clock speeds -> lower yield -> higher price is not a new phenomenon.

</comment></comment><comment><USER15> For the full Apple II experience, you need to load the Star TreK game from cassette tape.

</comment><comment><USER16> What are Apple ][ and Apple //e? Pretty impossible to google search these so maybe readme could have some links or short descriptions

<comment><USER5> Two models of the Apple 2 series. Apple ][ (read Apple 2) was the first, followed by ][+ then //e (read 2e).

Apple was the first computer of Steve Jobs (you know, the guy who made the iPhone, the eBook, etc.). Note that Steve Jobs was a kind of visionary but the guy who actually built the Apple was Steve Wozniak.

The Apple was popular because it was affordable and, for its time rather powerful. That was possible because Steve Wozniak (and others) figured out how to build a computer in the cheapest (and most clever way).

As many HN readers, I learned programming when I was very young, on an Apple 2.

[https://en.wikipedia.org/wiki/Apple_II](https://en.wikipedia.org/wiki/Apple_II)

<comment><USER17> It's worth adding that the Apple II was really _the_ _first_ home computer, soon followed by others from Commodore and Radio Shack. There were other microcomputers, but they weren't aimed at a casual home market. The Apple II was the first personal computer that came "ready to use"... you just needed to connect a screen (which could be a regular Television of the time), plug it in, turn it on, and start programming it in Basic! There was no storage device included, but the Basic interpreter was in ROM, and gave you a prompt (kind of like a REPL) when you turned on the computer.

<comment><USER12> Commodore Pet: introduced in January 1977 at the Consumer Electronics Show in Chicago. What was shown had many differences from what eventually shipped, but Commodore started accepting orders. They only shipped 500 machines by the end of the year and it is hard to find out when the first ones actually went out.

Apple II: introduced on April 17, 1977 at the West Coast Computer Faire. It went on sale on June 5.

TRS-80: introduced on August 3, 1977 at a press conference at the Warwick Hotel in New York and was available for sale.

Radio Shack/Tandy and Commodore were big companies. They were later joined by Atari, Texas Instruments and eventually IBM.

The other players in the personal computing market back then were self financed (MITS, IMSAI, Ohio Scientific, Processor Technology, Cromenco, Northstar, Southwest Technical Products Corporation, Altos and so many others).

Apple stood apart as a venture capital backed startup. We later got Compaq and others but by that time none of the self financed companies were around anymore.

Apple is remembered as the number one in personal computing until the IBM PC came along. In terms of revenue that is true, but in terms of units shipped the much cheaper TRS-80 and the Pet dominated the late 1970s.

</comment></comment></comment></comment><comment><USER18> Wow , great job. Karateka! Carmen Sandiago!

</comment><comment><USER19> Pretty neat that it supports the Koalapad. Worked well in Safari though it didn't track my system's mouse pointer perfectly.

I am amused that the POWER light works as a power button. Early Apple 2s had a plastic dome over the light which people mistook for a power switch, and most of them are broken as a result.

</comment><comment><USER20> you can use these js emulators to play the just released v1.0 of Myst for Apple II

[http://www.deater.net/weave/vmwprod/mist/](http://www.deater.net/weave/vmwprod/mist/)

</comment><comment><USER21> It's a node app that uses python libraries. Interesting.

</comment><comment><USER22> I thank the project owner for not being Fabrice Bellard</comment>


What I didn't understand was how much it would cost to live - <AUTHOR> https://luke.substack.com/p/what-i-didnt-understand-was-how-much <comment><USER2> The math in the viral Tik Tok doesn't add up at all.

She claims to have paid $120,000 on an $80,000 loan with 7% interest over 10 years, with a remaining balance of $76,000.

Worst case: If she had missed every single payment for 10 straight years with 7% compound interest and then paid that $120K lump sum, her loan balance would be $37K.

If she spread those $120K payments out over 10 years, she would have paid the loan off already.

There is no scenario in which she pays $120K and still has a balance of $76K, unless her interest rate was much, much higher than quoted. Any student loan with a rate of 7% or higher should be refinanced to a lower rate anyway.

It boggles the mind that people are writing so much about this without bothering to fact check it with basic math.

<comment><USER3> I think this quote from her sums up the problem:

         "I had no concept of money."

Followed by this exchange:

        "So how much do you pay a month all together for loans?"

        "Just under $1,000"

Which is probably where the 120k number came from. Ten years times 1k per month. But that is for plural loans, and we are never told the total balance of the plural loans, which is why the numbers do not add up.

<comment><USER2> She said her starting balance was $80K.

Paying $1000 per month would have paid off the entire balance before the claimed ten year period. The numbers don't work at all.

I think it's more likely that she's exaggerating for effect in order to go viral. She's attempting to raise $30K to publish a zine, according to the interview.

The author of the linked article is also trying to profit from the story by selling a subscription sub stack with these stories.

These misinformation campaigns feel like a new version of Fox News or scary e-mail forwards from grandma, except these are targeted at younger generations.

The worst part is that exaggeration isn't even necessary. They could simply highlight the rising costs of education using normal, honest examples without burning their credibility in attempts to go viral.

<comment><USER4> _The numbers don't work at all._

She wouldn't have stopped spending, negating much (most?) of her payments. There is very likely _a lot_ of missing information in the article. The figures aren't important _per se_ , they're likely just for illustration purposes.

She doesn't have to prove her point, she's just giving us her insights into the unexpectedly high costs of living.

We've all been there, done that. As in "Right! Who's going to win this month's lottery to get my outstanding debts paid?"</comment></comment></comment></comment>


Myths of the private prison industry - <AUTHOR> https://www.muckrock.com/news/archives/2015/oct/19/5-myths-private-prison-industry/ <comment><USER2> I really don't think prisons should be run by private corporations. I was already kind of leery about it, but the whole "kids for cash" scandal in Pennsylvania was the last straw. There's no way I can be convinced that we can ever trust a for-profit corporation to manage a prison. There are just too many opportunities for corruption.

<comment><USER3>
      They speak roughly once a week in a 15-minute phone call,
      and speak for another 25 minutes on a video chat. Jones
      says she'd travel to Texas to visit her son in person,
      but Hays County Jail, where he is locked up, banned
      visitations in November 2013. That happened shortly after
      the county jail entered into a contract with Securus.

      Since then, all family communication with inmates at Hays
      County goes through Securus, which charges Jones about
      $10 for a phone call and about $8 for a video visit.

[http://atavist.ibtimes.com/fcc-prison-telecom- industry](http://atavist.ibtimes.com/fcc-prison-telecom-industry)

<comment><USER4> See also [http://arstechnica.com/business/2015/10/inmate-calling- compa...](http://arstechnica.com/business/2015/10/inmate-calling-companies- sock-prisoners-families-with-endless-fees/)

Apparently a large amount of those fees are paid back to the prisons via "commissions", so it's basically governments auctioning off the right to take advantage of prisoners and their families.

<comment><USER5> It's essentially the same thing that has happened across many other areas of the economy - it's impractical to own slaves, so they're rented instead.

</comment></comment></comment></comment><comment><USER6> I know someone who stayed in a GEO prison. Based on everything I heard about it, I have to imagine that there's some mid-level accountant who knows exactly, down to the penny, how much money they make per inmate per day.

One example: when you're given a spork with your first meal, you might think that was the spork for just that meal, and toss it out with your meal tray. Wrong move. That was your prison-issue spork. Enjoy eating with your hands for the remainder of your incarceration.

<comment><USER7> That gives me an idea: prison vouchers.

Give each prisoner a voucher for a certain amount and let them choose where they want to serve out their sentence. Prisons will compete to offer tolerably humane conditions to inmates while still keeping under budget. (Prison escapes will be punished by huge fines so there's no incentive to cheap out on security.)

Flaws with this system: do prisons have to take a given inmate? If not, there will be troublesome inmates nobody is willing to imprison. If so, there will be a lot of incentives to try to get rid of these troublesome prisoners as soon as they arrive. Also, there's potential for cosy arrangements between gangs and prison operators to direct business towards them in exchange for favourable treatment.

<comment><USER8> You're not supposed to like prison. It's a punishment for serious misdeeds. If your suggestion was implemented, the result would be despicable. Prisons would be competing to have the most plush accommodations. The guy who was raping little kids in his van shouldn't serve his time in a nice hotel.

<comment><USER9> > The guy who was raping little kids in his van shouldn't serve his time in a > nice hotel.

He shouldn't _live_ , period: he should go straight from the jail where he was waiting trial, to the gallows. Prison should be for those who are bad enough to remove from society for a time, but not bad enough to execute; and since they will be returned to society, we should try to make sure that when they re-enter it they do so as productive, mentally-well members of society, rather than as beaten, brutalised future recidivists.

<comment><USER10> It's a matter of personal opinion, but I don't think anyone has the right to give out a death sentence. Yes, even to a child rapist. As a society we are so rich we can easily keep those people in prison for life, and spare ourselves the moral implications of actually killing people.

<comment><USER9> > As a society we are so rich we can easily keep those people in prison for > life, and spare ourselves the moral implications of actually killing people.

But not the moral implications of keeping someone caged like an animal for the remainder of his life. What's worse: to die in a week, or to spend decades in prison?

<comment><USER10> What's worse - finding out an innocent man spent 20 years in prison before being exonerated, or that he was killed? I know it's an extreme minority if cases - but there really is no _reason_ to kill people. We are perfectly capable of keeping people locked for life, and that's what we should do for the worst offenders. Is it horrible? Of course. But the alternative is much worse.

</comment></comment></comment></comment></comment></comment></comment><comment><USER11> > American correctional standards have been a sort of standard for policing > and punishment abroad

I don't see much support for that statement, fortunately. There may be countries for which this is true but for the vast majority of countries in the developed world this is not the case.

<comment><USER12> Not only that, but some country's citizens would be appalled if their prison system started mimicking the American system.

</comment></comment><comment><USER13> While I'm not sympathetic to prison operators or the mass-incarceration system in general, this is a weak article with little substance. Declaring an assertion to be myth requires a substantial investment in disproving it. Indeed, there is not a single fact presented in opposition to what is perhaps the most important myth #1. It is possible (or damned well ought to be, and if it isn't, then that's a cause of action by itself) to account for exactly what the government and inmates are paying. Someone who makes a concerted effort to figure out what that is would be a top-notch investigative reporter. Someone who writes "Does anyone actually have proof of this? Seriously, is anyone sure that this happens?" is either ranting or a hack. When you write an article asserting that a political opponent's views are myths, you take on the burden of proof. Simply asserting (without even a reference) that no one has proven the opposite doesn't cut it, even if that's true.

There are similar problems with the other "myths", such as attempting to rebut the notion that private prison operations have limited influence by showing a graph of private prison populations (one that, I might add, doesn't exactly bolster the case). So what? If 8% (or 20% or X%) of prisoners are in private prisons, how does that affect their influence on incarceration as a policy? If that rate is different in various states, can you connect the differences with the kind of policy influence you expect to find? That's legwork. That's investigative reporting.

Anyone who would like to see significant prison reform deserves, and needs, much better than this. If this were truly a reflection of the prison reform movement's best arguments, it's small wonder it's not having much success.

<comment><USER14> I agree hundred percent. A very bad piece that does not clarify or enlighten.

</comment></comment><comment><USER15> Pretty clickbaity.

It's just '5 things wrong with the private prison industry'

All of them are pretty well known possible issues.

I certainly don't know anyone who thinks the 'myth' is true, some people at best might be 'I don't know' or 'I'm pretty sure it's complicated.'

</comment><comment><USER16> For more: [https://www.muckrock.com/project/the-private-prison- project-...](https://www.muckrock.com/project/the-private-prison-project-8/)</comment>


Free Open-Source WooCommerce Stripe Gateway - <AUTHOR> https://github.com/seanvoss/striper Hey,<p>Quick Weekend Project, thought it might save some people $79, http://www.woothemes.com/products/stripe/ , a little rough at this point but very functional. <comment><AUTHOR> Quick Weekend Project, thought some people would appreciated an alternative to the paid "offical" version especially since WooCommerce itself is open source [http://www.woothemes.com/products/stripe/](http://www.woothemes.com/products/stripe/).

Still a little rough at this point, but very functional.</comment>


JavaScript's Future seems very bright - <AUTHOR>

Lets slow it down a bit:<p>> ASM.js will soon make V8 _much_ faster<p>> ES6 Generators will replace and solve JS's "callback hell"<p>> Node.js's versatility is increasing as TypeScript, ES6 improve and V8 improves (by between 2x and 6x with asm.js according to a Hacker News user)<p>> TypeScript, AtScript and ES6 comes with a lot of versatile improvements in it's syntax for JS<p>anyone disagree? Correct me if I am wrong about any of the points. <comment><USER2> Lets not forget that the usage of javascript correlates with need to target the omnipresence of browser and not for merits of javascripts idioms or design pattern paradigms.

Javascript is a great hacker language. All the improvements as stated above will extend the capacity of js to quickly hack up mvp apps. With that said I think the argument can be made that javascript was never designed from the ground up to support this new omnipresent realtime persistent application platform.

For me the question remains to be seen answered if a server that was designed the ground up to be a server such as netty offers a more stable solution then node.js

I think some might say that ES6 is like putting lip stick on a pig therefore patching up JS to keep evolving as more expressive language.

Every time I run NPM install I wonder what kinds of incidental complexities I am I getting myself into. Then dred if I have learn yet another build system. Every time I run NPM I think of an old Jim Breuer joke [1] -- NPM is the "tequila" in the JS party of complexity. ASM.js is amazing, but are we getting a little too drunk on our technologies. ASM.js just might be amazing koolaid when it comes to the sobering decision to build something from "the feet up" to serve on purpose and serve it well. JS can be the jack of all trades and master of none and that can be a bad thing. One thing is for sure JS is really fun, but I would not go making a stock market exchange out a javascript codebase.

Speed is not the only performance metric out there. Think stability is often overlooked for having more power over more control. The Influenza in JS world is not spaghetti code but the more harder to grok house of cards library dependencies. This is just my amateur opinion on observations as go further down the rabbit hole of my learning to code journey.

TL;DR JS is a great hacker language but drink responsible when it comes to importing incidental complexity of additional libraries.

[1] Jim Breuer Just For Laughs [http://www.youtube.com/watch?v=z8dvpsVEJEQ](http://www.youtube.com/watch?v=z8dvpsVEJEQ) [2] "The Mess We're In" by Joe Armstrong [http://www.youtube.com/watch?v=lKXe3HUG2l4](http://www.youtube.com/watch?v=lKXe3HUG2l4)

</comment><comment><USER3> Really, the only reason Javascripts future looks very bright is because it has a monopoly - it's the only language that runs in the browser.

Javascript is a great language for what it is, and ES6 fixes a lot of the warts - but it's still a rather mediocre language compared to many of the other options out there.

It's a _great_ quick-n-dirty language for hacking things together, but it's less ideal for more significant projects. (You certainly can maintain large projects in Javascript, but there are much better languages for this task).

> ASM.js will soon make V8 _much_ faster

ASM.js is not Javascript, and it won't make Javascript run any faster. It's a compile target that happens to resemble a syntactically valid subset of Javascript for backwards compatibility purposes.

ASM.js can only really be used as a compile target for unmanaged languages, and acts as a bytecode that compiles down to pure assembly. It's not something that any Javascript developer would write by hand.</comment>


Beginning Game Programming for Teens with Python - <AUTHOR> http://www.raywenderlich.com/24252/beginning-game-programming-for-teens-with-python

<comment><USER2> Very cool! Reminds me of the games I was programming as a teen. Pygame seems like a pretty straight forward framework to easily start seeing things move on the screen which is really important to keep people motivated.

</comment><comment><USER3> Written by a 12 year old.

I think I was just about getting onto the internet when I was 12.

<comment><USER4> I didn't even have computer at that age. #thirdworldproblems

</comment></comment><comment><USER5> It's awesome that you're already making tutorials. Keep it up!

</comment><comment><USER6> Funny---I did literally exactly this in my senior year of high school with some friends. Pygame is so easy, it's amazing what you can do.

I think what we build should still work!

[https://github.com/keevie/Awesomer-Game](https://github.com/keevie/Awesomer- Game)

</comment><comment><USER7> It's a bit confusing that near the beginning it says that on a Mac Python is already installed (yay!), but as soon as you get to the meat where PyGame is installed, it basically says you'll need to re-install Python if you're on a Mac. So the "already installed" bit isn't all that useful, or did I misread?

<comment><USER8> I think what he's trying to say is that the Mac already has a preinstalled version of python which would allow you to get started and programming right away, however if you want to install pygame you would need to install a newer version of python which is more complete.</comment></comment>


Facebook Upgrades Photos: Look Out, Flickr - <AUTHOR> http://mash.to/2MCoX

<comment><USER2> Shout-out to pcardune, who came over from Divvyshot and did a lot of the hi- res stuff at Facebook. Other members of the photos team who were integral to this launch & are HN lurkers: beau, nroman, justinmitchell, makinde.

For the record: we didn't build the product with the goal of competing with Flickr.

<comment><USER3> I didn't see the hi-res stuff yet, but I consider the photo sharing and presenting to be very good at Facebook. If you guys could manage to compete with Flickr, that would be even greater.

</comment></comment><comment><USER4> I wouldn't take that as a Flickr competition. Flickr is more about delivering photo experience to the masses, a great platform for promoting and discovering pictures about a certaing subject, etc. Facebook is more about sharing with your social cirle. Currently there isn't any tool able to compete with Flickr in terms of exploring content.

<comment><USER5> Flickr is pretty horrible as a photo site. It's full of garbage, the options of browsing quality content are very limited.

Try to get the highest rated photos of the last week/month/year, for example.

<comment><USER6>
      Try to get the highest rated photos of the last week/month/year, for example.

I don't really know anyone that uses flickr this way, or at least i should say that flickr is not explicitly about quantitatively accessing massive photosets.

Highest rated photos, though? I don't think taste is a numerical metric.

 _edit: superfluous asterisks_

</comment></comment></comment><comment><USER7> Nice work Sam Odio and Paul Carduner (my former YC batch friends at Divvyshot).

</comment><comment><USER8> I think both cater to a different set of people/photos. I upload only those photos to Facebook which have a 'social' element - Birthdays, weekend trips with friends etc. But Flickr is more for photos which I click as a hobby and as a photo backup service.

<comment><AUTHOR> Also on flickr there are a lot of pros using it to maintain their portfolios, but definitely I think Facebook photos are one of the reasons of its success.

</comment></comment><comment><USER9> Finally facebook is making use of Divyashot it bought few months ago.

</comment><comment><USER10> Like others, I use Facebook for photos I want to share with friends and Flickr as a portfolio. Having said that, I think Facebook has a much better interface (why does Flickr still insist my photos need a title?) and having this option is good.

It would be nice to see Facebook improve the quality of standard photos too. They're generally noisy as hell and have rubbish compression artifacts. Compare Facebook: <http://bit.ly/bT1bjA> and Flickr: <http://bit.ly/c0a0FO>

</comment><comment><USER11> Looks good, Sam :)

</comment><comment><USER12> Sure, Flickr is one of the services Facebook seeks to replace. Basically, at this point Facebook is a big mashup of email, IM/chat, Flickr, Twitter and a blog.

</comment><comment><USER13> Can I export my photos yet? No? Still not a photo competitor, much less a Flickr competitor.

<comment><USER14> Facebook's API (both the new Graph API, and the old REST one) supports this (it allows access to the URLs, and the terms do not prohibit this). I have personally written an application that allows the downloading of photos.

I think it would be nice if this was supported in a more straightforward fashion (e.g. a large "Download" link on every album), but I think it would be better for Facebook to concentrate on storing photos in their original size, or at least better educating people that their photos are being downsized upon storage.

<comment><USER13> Aaand less than seven days later, they allow bulk downloads of your pictures, amongst your other data. Huh.

</comment></comment></comment><comment><USER15> Speaking of which, I was sad to notice that www.divvyshot.com just forwards to FB.</comment>