Wednesday, January 28, 2009

The cutting edge of VM design

The Java Virtual Machine generally stands out as the state-of-the-art, loaded with all sorts of crazy optimization tricks it would make your head spin. For this reason many languages (including brand new languages) are targeting it as their runtime, as opposed to writing their own virtual machine which I guess some people still like to do. However, I think the route the JVM has taken is one which will gradually wane in popularity as programmers begin to face a future with dozens if not hundreds of CPU cores at their disposal.

Designers of virtual machines will begin to undergo a realization which is already upon the designers of computer processors: focus less on doing one thing quickly and focus more on being good at doing many things at once. This is why I do not believe the state of the art in virtual machine lies in things like the JVM. Rather, I see the Erlang virtual machine as being the state of the art. Java simply was not designed for this future:

Image stolen from Ulf Wiger who took it from Joe Armstrong who borrowed it from Erik Hagersten

At first glance it may be difficult to appreciate what makes the Erlang VM interesting. Soft realtime garbage collection is nice but the JVM has hard realtime garbage collection. Erlang's JIT is comparatively slow at things like numerical computing and can't inline across modules the way HotSpot can inline methods across classes. It's a notoriously difficult beast for inexperienced system administrators who may see it start gobbling up CPU and RAM for no apparent reason, and the only way to probe what's doing is to get onto its shell and enter a bunch of commands in an esoteric functional language, horrors!

However, these problems are relatively minor when you look at what's on the roadmap for the Erlang VM. In the beginning of his book Programming Erlang, the language's creator, Joe Armstrong, lays out the dream of what his concurrency model hopes to achieve: your program runs N times faster on N CPUs. Erlang has more or less achieved this through the use of distribution. However, distributed computing is hard: suddenly you must consider the cost of sending messages across the network, dealing with latency, network outages, crashing servers, etc. While Erlang/OTP provides a great framework for distributed computing, many of the concerns of distributed computing become irrelevant when you're dealing with a single machine with vast numbers of CPU cores.

The Erlang virtual machine now supports an SMP scheduler which runs a hardware thread for each CPU core. This lets the VM distribute processes, its concurrency primitive, across multiple CPUs at once with none of the impacts distributed computing has to the programmer. It's a comparatively simple affair: make as many processes as you want and the scheduler will load balance them accordingly.

However, while this all seems nice and rosy the SMP scheduler is full of bottlenecks. It works quite well for two or four CPU cores, but as you add more and more you see diminishing returns. The same goes for the JVM, but while they're stuck with their fundamental design constraints, the Erlang concurrency model allows its VM designers considerably more freedom for optimization.

A recent presentation by super famous Erlang guy Ulf Wiger lays out the future of multicore programming with Erlang. The presentation goes through the present scalability weaknesses of the Erlang VM and how they plan on addressing them. You can take Ulf's word for it, or if you're lazy you can just keep reading and I'll try to break it down for you.

So, here's what it is: (sorry for ripping these images out of your presentation, Ulf! They rule!)

This image had a big Ericsson logo on it. Did I do bad by ripping it off? Oh well, if someone complains I'll make my own awesome version.

This is how the Erlang SMP scheduler works today. There are lots of schedulers, each running in a native thread, which all pull from a common run queue. Can you see the bottleneck? Look at all those arrows pointing to the same place! So what's the solution? Divide and conquer:

By giving each scheduler thread its own run queue, the only centralized ickyness becomes the logic needed to load balance processes across various schedulers. This whole thing is beginning to look a lot like how an operating system's kernel works, isn't it? Well great, so how did that all work out in terms of SMP scalability?

Uhoh, the diagonal line I was expecting appears to be a bit flaccid

The red line shows the present SMP scheduler with a single run queue, and the blue line shows the next generation SMP scheduler which will be released in the next version of Erlang. As you can see, adding multiple run queues improved the scheduler's performance, but clearly there is still a bottleneck as you add CPU cores. The graphs show the program actually slowing down with increasing number of cores. So what's the problem?

Aack, a bunch of arrows pointing at the same place again!

Erlang's memory allocator is presently a locking contention point and is limiting the SMP scheduler's scalability across increasing numbers of CPU cores. I can only assume from Ulf throwing this into his presentation that this is the next bottleneck the Erlang/OTP team at Ericsson intends to address after they've released the new SMP scheduler.

The moderate gains of the new SMP scheduler may not seem like something to be excited about, especially since the improvements in the benchmark weren't all that spectacular. So why am I excited? Because one by one the developers of the Erlang virtual machine are removing scalability bottlenecks and increasing the VM's performance. Due to Erlang's underlying concurrency model, the optimization potentials remain huge. And as the number of CPU cores available on a single chip continues to increase (this benchmark was run on a 64-core CPU) these sorts of optimizations will become increasingly necessary to leverage a CPU's full capabilities.

Architectures like the JVM aren't completely doomed in the multicore future. Approaches like software transactional memory can be used on the JVM (particularly with a language like Clojure) in ways that are better suited to certain types of concurrency problems than Erlang's shared-nothing process approach.

But overall, I find Erlang's approach to concurrency as one which makes things easier on the programmer while foisting more of the underlying complexity onto the VM itself. I think Erlang's approach to concurrency will generally make more sense to programmers than STM, especially if it has the right kind of face on it, which is what I hope to achieve with my language Reia, which targets the Erlang VM. And most of all, I see great potential for VM optimizations to improve the scalability on multicore CPUs, and hope one day the SMP scheduler is able to achieve Joe Armstrong's dream of your program running N times faster on N CPUs. Whatever approach the Erlang VM eventually settles upon will be studied for years to come.

256 comments:

«Oldest   ‹Older   201 – 256 of 256
토토 said...

토토 Greetings! Your blog is very interesting! Please check my website I have a recommendation for you


온라인카지노 사이트 said...

온라인카지노사이트 Hi to all, the contents present at this site are actually amazing for people experience, well, keep up the nice work fellows.Feel free to visit my blog post..

온라인카지노 사이트 said...

온라인카지노사이트 Outstanding post, you have pointed out some great points, I besides think this is a very good website.Also visit my site;

UNKNOWN said...

Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks 출장마사지

UNKNOWN said...

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and 구글상위노출

Anonymous said...

Hello its my first time to commenting anywhere, when i read this article i thought i could also create comment due to this good 먹튀검증

UFABET1688 said...

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. เว็บแทงบอล

SAFE SITES18 said...

You have done a great job. I will definitely dig it and personally recommend to my friends. I am confident they will be benefited from this site. 바카라사이트닷컴

SAFE SITES18 said...


Yeah! This is very interesting post. I look forward for seeking more on your website. 토토사이트

Anonymous said...

Very nice article. I enjoyed reading your post. very nice share. I want to twit this to my followers.
Thanks 토토

Anonymous said...

You made some good points there. I did a Google search about the topic and found most people
will believe your blog 토토사이트

SAFE SITES18 said...

Thank you for your post, I look for such article along time, today I find it finally. 토토

oncasinosite 카지노사이트 said...

I wanted to thank you for this excellent read!! I definitely loved every little bit of it.Cheers for the info!!!! & This is the perfect blog for anyone who wants to know about this topic. Feel free to visit my website; 토토사이트

Unknown said...

I figure this article can be enhanced a tad. There are a couple of things that are dangerous here, and if you somehow managed to change these things, this article could wind up a standout amongst your best ones. I have a few thoughts with respect to how you can change these things. 메이저놀이터


baccaratsite.info said...

Thanks for the nice blog. It was very useful for me. I m happy I found this blog. Thank you for sharing with us,I too always learn something new from your post. 바카라사이트인포

casinosite.one said...

Thankful to you for your post, I scan for such article along time, today I find it finally. 카지노사이트

Unknown said...

How to Treat 메이저추천 Dealers, According to 메이저추천 Dealers

SAFE SITES18 said...

I’m really happy to find this site and did enjoy reading useful blog posted here. The ideas of the author was awesome, thanks for the share. 토토

SAFE SITES18 said...

You were great and everyone received so much from your experience and knowledge. Absolutely amazing, thank you for sharing your knowledge. 파워볼

slotxo said...

Magnificent web site. Plenty of helpful information here. I’m sending it to a few pals ans additionally sharing in delicious. And of course, thank you for your effort! แอพสล็อต ได้เงินจริง

คาสิโนออนไลน์2020 said...


พวกเราจะแบ่งเงินรางวัลทั้งผอง 60/40 โดยแบ่งสิงโตให้กับผู้เล่น ฉันรู้สึกว่ามันเป็นเหตุการณ์ที่ไม่สมควรพลาดส่วนตัวสำหรับเรารวมทั้งรู้สึกตื่นเต้นกับการเดินทาง

โต๊ะโป๊กเกอร์ Pai Gow

ในวันที่หนึ่งและก็สอง สิ่งต่างๆเป็นไปด้วยดีส่วนตัวเราแต่ละคน แล้วก็ฉันก็เฉลี่ยราว 11 ตัวต่อชั่วโมงกับราษฎรในแคว้นแล้วก็ฝูงนกสโนว์เบิร์ดอีกปริมาณหนึ่ง

อย่างไรก็ดี สิ่งต่างๆเริ่มขึ้นในวันที่สามเมื่อฉันได้รับชวนให้ร่วมเกมเงินสดส่วนตัว เกมดังกล่าวมาแล้วข้างต้นจัดขึ้นตรงเวลาสองคืน แล้วก็ผู้เล่นสามารถซื้อเข้าหรือจ่ายเงินสดได้ตามอยากได้

สหายของฉันกำลังตามล่าเพื่อชิงชัยและก็ถูกกักบริเวณไว้กับกรมทหารที่เอาจริงเอาจังของการแข่งขันชิงชัย ด้วยเหตุดังกล่าวฉันก็เลยอยู่ในภารกิจผู้เดียวเพื่ออุตสาหะรักษาสตรีคที่ฉันอยู่ข้างในห้องโป๊กเกอร์

IMIBET
imi win
imi9win
IMIWIN

alone said...

https://google.ge/url?q=https%3A%2F%2Fsite789.com

alone said...

https://toolbarqueries.google.mv/url?q=https%3A%2F%2Fsite789.com

คาสิโนออนไลน์2020 said...

เกมสล็อตออนไลน์ยอดนิยมสูงที่สุดของบริษัทนี้เป็น Buffalo King รวมทั้ง Wolf Gold เกมยอดฮิตพวกนี้มี 25 เพย์ไลน์แล้วก็ด่านโบนัสที่ต่างกัน แล้วก็เสนอขั้นตอนการชนะที่นานัปการ คุณยังจะได้เจอกับคุณลักษณะต่างๆได้แก่ ไวด์ที่ทับกัน การรีสปิน และก็วงล้อที่ลุกในสล็อตของ Pragmatic คุณยังสามารถรับ 5,000x เงินที่ใช้ในการเดิมพันของคุณ! สล็อตพวกนี้เหมาะกับผู้เล่นที่อยากได้ทดลองคาสิโนออนไลน์ใหม่โดยไม่จำเป็นต้องใช้เงินจำนวนไม่ใช่น้อย
ทางเข้าts911
ts911

คาสิโนออนไลน์2020 said...


RTP ของสมบัติของดาวินชีคืออะไร
RTP ของสมบัติของ Da Vinci คือ 96% ตามหลักการทั่วไป RTP ขั้นต่ำสำหรับเครื่องสล็อตที่คาสิโนออนไลน์คือ 94%
ผู้จัดจำหน่ายเครื่องสล็อตคืออะไร? สมบัติของดาวินชี
สล็อตแมชชีนแต่ละเครื่องผลิตโดยซัพพลายเออร์ สำหรับสมบัติของดาวินชี ซัพพลายเออร์คือ : Pragmatic Play

ts911
ทางเข้าts911

Unknown said...

슬롯커뮤니티

ufabet888 said...

เข้าสู่ระบบยูฟ่า 2022 Passed through to play every game. Through our website, safe, direct website, ready to serve you fully today, Thai slots are easy to play, accept a variety of languages, who wants pgslot, the best new game camp from around the world.

MEGA888 said...

slotx We are online slots site provider Slot X, the most fragile direct web superslot79, including fragile slot games, Superslot camp for all games, customers can choose to play unlimited.

toto graph said...

I was very pleased to find this web-site.I wished to thanks for your time for this wonderful learn!! I positively having fun with every little bit of it and I’ve you bookmarked to check out new stuff you weblog post. 그래프사이트

คาสิโนออนไลน์2020 said...

เลือกเยอะแยะแม้กระนั้นซื้อไหม?แมนยูสนกองกลางวิลล่าข้างหลังพ่อ,เฟล็ทเชอร์ปลาบปลื้มฟอร์ม
เลือกมากแต่ว่าซื้อไหม?แมนยูสนกองกลางวิลล่าข้างหลังพ่อ,เฟล็ทเชอร์ปลาบปลื้มฟอร์ม
สื่อดังในเมืองผู้ดี ตีข่าวสาร แมนเชสเตอร์ ยูไนเต็ด ล็อกวัตถุประสงค์จะยื่นข้อเสนอคว้าตัว จอห์น แม็ครับประทานน์ กองกลางเลือดวิสกี้ของ แอสตัน วิลล่า มาเสริมกองทัพข้างหลังจบฤดูนี้ โดยว่ากันว่าเซอร์อเล็กซ์ เฟอร์กูสัน แล้วก็ ดาร์เรน เฟล็ทเชอร์ ชอบใจฝีเท้าของหน้าแข้งรายนี้เป็นอย่างมาก
แมนเชสเตอร์ ยูไนเต็ด กำลังตรึกตรองทุ่มเงินเพื่อคว้าตัว จอห์น แม็ครับประทานน์ มิดฟิลด์ฟอร์มแรงของ แอสตัน วิลล่า มาเสริมแข็งในตอนตลาดซื้อขายแลกเปลี่ยนนักฟุตบอลซัมเมอร์นี้ จากการเปิดเผยของ "เดอะ เทเลกราฟ" สื่อดังในอังกฤษ

ts911
ทางเข้าts911

คาสิโนออนไลน์2020 said...

ดาวน์โหลดสล็อต xo บนโทรศัพท์เคลื่อนที่
ดาวน์โหลดสล็อต xo เล่นสล็อตบนโทรศัพท์มือถือ
ขั้นตอนดาวน์โหลดสล็อต xo เล่นเกมผ่านมือถือผ่านแอปพลิเคชัน
สำหรับคนที่ใช้งานผ่านระบบปฏิบัติการ IOS ผ่านอุปกรณ์ถือ iPhone แล้วก็ iPad ต้องสแกน QR Code ผ่านทางหน้าเว็บไซต์ ให้คลิ๊กไปที่ Download IOS ต่อจากนั้นให้ไปที่ ตั้งค่า (Settings) ที่อยู่ในวัสดุถือ กระทำการตั้งค่าระบบ General เพื่อจัดตั้งแอปพลิเคชันพอดีเครื่อง เมื่อตัวแอปฯถูกจัดตั้งแล้ว ให้จำการเครื่องไม้เครื่องมือ โดยไปที่ Device Management แล้วก็กดอนุญาต เพียงเท่านี้เท่านี้ก็เสร็จเรียบร้อยสิ้นขั้นตอน ดาวน์โหลดสล็อต xo
ts911
ทางเข้าts911

policezuza123 said...

betflixเครดิตฟรี โบนัสพิเศษ ได้ตลอด 24 ชั่วโมง ไม่ว่าจะเป็นสมาชิกเก่า หรือ สมาชิกใหม่ ก็สามารถรับโบนัสได้ กับทางเว็บเราได้ทันที เพียงแค่คุณทำการสมัครสมาชิกเล่นเกม BETFLIXVIP168

คาสิโนออนไลน์2020 said...

บน แม้ปรารถนาชนะจำเป็นจะต้องที่ผลรางวัลจะออกมาอยู่ตั้งแต่ลำดับที่ 1 – 40 แค่นั้น
เสมอ การวางเดิมพันแบบทายผลแบบตรงตัวที่จำต้องมีลำดับที่อยู่ในชุดนั้นตั้งแต่ลำดับที่ 1 – 40
ด้านล่าง การวางเดิมพันแบบทายผลที่ด้านในชุดต้องมีเลขลำดับตั้งแต่ 41 – 80
ชุดคี่รวมทั้งคู่
สำหรับการออกรางวัลหากว่ามีเลขที่เป็นแบบ คี่/คู่ อย่างใดอย่างหนึ่งและก็จะต้องมีมากยิ่งกว่า 10 ลำดับที่ โดยจะเรียกเป็นชุดๆว่า ชุดคี่/ชุดคู่ ตามบอร์ดการออกรางวัล โดยจะมีอัตราการจ่ายที่เสมอกันแม้ชนะก็จะได้รับตั้งแต่ 1:3.7 อย่างยิ่งจริงๆ ยิ่งช่องทางการออกรางวัลที่ถูกน้อยมากเยอะแค่ไหน เงินรางวัลจะเยอะขึ้นเรื่อยๆเพียงแค่นั้น ด้วยเหตุนั้นพวกเราจะเสนอแนะกรรมวิธีการเล่นให้ได้เงินรางวัลแบบง่ายๆในด้านด้านล่างสุดของเว็บนี้
IMI WIN
imiet
imiwin

Hahaha said...

oncasino

Roselyn said...

Interesting content, a a lot of useful details and information that lighten me ups! Keep it for more. Check with our General Contractor Spokane

totosafeland said...

I blog frequently and I truly thank you for your information. This article has really peaked my interest.
I will take a note of your site and keep my web site info 먹튀검증사이트

totosafeland said...

I hope you can read my post and let me know what to modify. My writing is in I would like you to visit my blog. check my web site 메이저사이트

Roselyn said...

Great! amazing blog. I am glad I drop by here I got a lot of information and it is very helpful. Looking for professional tree removal in Orange country? Then checkout our Tree Removal Orange County.

bgbg said...

Lovely article. what is even more impressive is the writing skill set! Be that as it may please view https://buy.guru for best washing machine and microwaves
best washing machine

Roselyn said...

Very interesting information! Perfect just what I was searching for! Find out more about Furnace Repair Spokane.

토토 사설토토 토토사이트 안전놀이터 뱃사공 said...

This blog is very useful to me. I can see new problems in your article. 사설토토 도메인 추천

Carla said...

More than 20 experienced denture specialists - Check for more info

Please also include, Look at this website

addyaina422 said...

토토커뮤니티 메이저놀이터 목록 추천해드리며 보증업체 이용 시 100% 검증된 메이저놀이터 및 안전놀이터인 것을 보장해 드리며 토토커뮤니티 안전사이트 메이저안전놀이터 사설토토 토토사이트 보증 사이트 입니다.

addyaina422 said...

메이저안전놀이터 토토사이트추천 추천해드리며 보증업체 이용 시 100% 검증된 메이저놀이터 및 안전놀이터인 것을 보장해 드리며 메이저안전놀이터 토토사이트 안전사이트 토토커뮤니티 사설토토 보증 사이트 입니다.

Nice Poster said...

ufabet เว็บนี้ดีมากปั่นสล็อตแตกรัวๆ แถมยังมีทั้ง บาคาร่า เสือมังกร แทงบอลออนไลน์ และก็อื่นๆ อีกเลือกเล่นกันตามสบายเลย

คนดวงดี said...

pgslot168z

Essien said...


A wonderful article! So much of creative thoughts and perfect execution. Looking forward to more such articles. Thanks a lot for sharing. fed poly nasarawa post utme form deadline

nishant said...

Thank you for writing this post: Please check my blog: Seoximor my website: legaltax.

77tunes said...

Nice information
How to send Money using jaiz bank transfer code

mbuotidem said...

Thank you for the great information. check dominican university cut off mark for computer science

Sherman Woodson said...

I'm fond of your posts. They contain interesting information and meaningful messages. I like them and read new posts when they are released. I wish you can write and upload more articles. Thanks for sharing them.

If you are searching for the best and reliable contractors you can visit us at Concrete Contractors Near Me.

Jim Park said...

I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing!

Get additional information about Concrete Pool Deck Columbia MD

Essien said...

I have found a smart and educative blog web now. Nice and beautiful post. Looking forward to new update. Thanks for the interesting idea.- yobe state university pre-degree admission requirements

gbelegbo said...

Got here by accident, but it is nice.
how to reprint jamb slip with my phone number

Sruthi Karan said...

good work and i want more info about this post..
abogados de bancarrota en virginia beach

shelby said...

Thank you for consistently delivering thought-provoking and well-researched content. Your blog is exceptional.Abogado de Violencia Doméstica New Jersey

«Oldest ‹Older   201 – 256 of 256   Newer› Newest»