Friday, January 9, 2009

Reia and object-aware concurrency

Concurrency is perhaps the foremost issue today's programmers must learn to cope with. CPU designers have exhausted the level of optimization they can provide to programmers working with a single thread of execution, and more modern designs take transistors which would've ordinarily gone to improve sequential performance and have instead thrown it at more cores. Intel demoed a CPU with 80 cores, yet one third of the transistors seen in a Core 2 Duo. This is the future of processors: more cores that do less. CPU designers are going to devote fewer transistors to each individual core while trying to pack more and more cores onto a single chip. Some crazy people are predicting that the number of CPU cores we see on a single chip is going to grow exponentially. I don't know about that, but it's a reasonable enough guess as any at this point, and it seems like it's where the trends are going.

This is posing a big problem for programmers. Now that all of these cores are available, how do you write programs that can make use of them all? The typical way most programmers are used to dealing with this problem is with threads. Threads let you spread your program's execution across multiple CPU cores, which is great! But threads are error-prone. The synchronization is as hard to get right as manual memory management. Pay attention and use good strategies and it's manageable. Put it in the hands of mediocre programmers and things can quickly fall apart. And once they do it can be incredibly hard to debug.

But it gets worse. Let's assume you've managed to use threads correctly in your program. Great! How well can it scale across an increasing number of CPU cores? The synchronization model employed by most programs uses a locking mechanism to synchronize state. To get a threaded program to scale well, locks must be scrutinized, benchmarked, and made increasingly granular in order for threaded programs to scale well. While this is all well and doable, granular locking is complicated, and the reality is most programs trying to pull it off aren't going to do it right, and for that reason many programmers may avoid it entirely.

So how well will programmers be able to leverage these new multicore CPUs? That question remains up in the air. Threaded approaches are difficult at best, and often hard to scale across an increasing number of CPU cores, especially when complex data structures are involved. For that reason some perceive that programmers are in a sort of crisis in regard to how they will leverage an increasing number of CPU cores.

Some solutions to this problem have emerged. One that gets a lot of attention is software transactional memory. This is a model which looks at memory in a manner similar to a database, using transactions to control concurrent access to shared state. Unfortunately this model has failed to achieve widespread popularity. Theories abound as to what exactly the problem is, generally surrounding its difficulty to apply to real-world problems. So far, this approach to concurrency remains in the collective unconscious as a theoretical one which is rarely applied.

Another approach which has received a considerable amount of hype in certain communities is "Erlang style-concurrency." Erlang is a programming language originally developed for telephony applications which uses lots of small processes that each do one thing and do it well, and talk to each other over message queues. Some liken this to the Unix philosophy: "Write programs that do one thing and do it well. Write programs to work together." However the actual approach of using processes which communicate with messages is known as the Actor model which grew out of Smalltalk.

Erlang processes have lots of nice properties which make concurrency easy. Like OS processes they run simultaneously and the Erlang runtime can distribute them across all available CPU cores with no additional work on the programmer's part. They are pre-emptable: if a process is doing something computationally intensive then after a certain number of "reductions" (e.g. function calls) the Erlang scheduler will pre-empt it and let another process to run. Erlang processes don't share state and can be garbage collected independent of one another. This means there's no "stop the world" condition with the garbage collector. But also, by not sharing state synchronization gets much easier. Now you don't have to synchronize access to shared state, instead you need to synchronize the way your program behaves, which is a far easier problem.

Last year I began working on an Actor model implementation for Ruby called Revactor. It had many of the features seen in Erlang: concurrent "processes" with message boxes and the ability to selectively receive messages from them. However, two things deferred me from continuing to work on Revactor: first, it was slow. Its messaging speed between two processes was nearly two orders of magnitude slower than Erlang, as was the process creation speed. Second, and probably the larger issue, was how much overlap I felt existed between Actors and objects. Actors did many of the same things objects did, but actors and objects did not play well together.

After seeing how much slower Actors in Ruby worked compared to Erlang, I decided to try a different approach entirely. If Actors couldn't come to Ruby, perhaps I could try bringing Ruby to Erlang. In early 2008 I started tinkering with a Ruby-like language on top of Erlang called Reia. Reia brings with it an object model which works on top of the Erlang process and messaging model. Like other object models objects in Reia communicate with messages, but rather than being some metaphorical construct, Reia objects quite literally communicate with messages.

This approach marks a rapid departure from most other object oriented languages. Most object oriented languages have a concurrency primitive like threads which are completely divorced from objects. Threads give you no guarantees about how state is managed or synchronized, and threads have no knowledge of method invocation. In Reia, all objects are concurrent and synchronize around the method dispatch protocol. You can think of each object as being its own thread, except each object's state is independent of all of the others, so there's no need for semaphores or mutexes or critical sections. All synchronization is handled through message dispatch itself, and thanks to the shared-nothing process architecture you only need to worry about synchronizing behavior, not state.

Furthermore, Reia gives you deep hooks into the method dispatch process, allowing objects to asynchronously respond to method calls, to invoke methods asynchronously, or to asynchronously get the response of a method call. This small grab bag of asynchronous tricks allows you to quickly and easily begin adding concurrency into your programs while still preserving the traditional method dispatch approach seen in object oriented languages.

Will this object-aware approach to concurrency and synchronization actually gain traction with programmers? It's hard to say, however it's clear that the other approaches aren't doing so well either. With the number of cores available to programmers skyrocketing, I think it's clear solutions are needed. Only time will tell which ones are actually successful.

140 comments:

  1. I don't understand one thing. When you use processes for objects implementation, how you garbage collect those. When one object can have some another object as attribute there are two processes, thus when I send inner object reference as PID to somewhere, store in ets or whatever. Then destroy outer object. How you make decide to destroy inner object? Or you don't garbage collect at all or what you decide to do?

    ReplyDelete
  2. You might want to check where the actor model came from; it certainly didn't grow out of Smalltalk as there's evidence for it's existence well before Smalltalk :).

    ReplyDelete
  3. Nice This Article is very Good and helpful to everypeople

    ReplyDelete
  4. Great Information about Reia and object-aware concurrency.This Post is very useful to every people

    ReplyDelete
  5. Your Post is very helpful to every people and great information

    ReplyDelete
  6. very nice information about this article ,Also Read ,Here

    ReplyDelete
  7. Quite an informative blog. Best Download Obb data for free now to get an application running in your android phone, Now it's easy to download and also secure for your no crack and spam. Just try downloading it and running it to your android phone and play whatever games you like free without any hassle.

    ReplyDelete
  8. Nice This post is very useful to every person,Thank You

    ReplyDelete
  9. Thank You For Sharing your article .This post is really amazing and helpful my Team

    ReplyDelete
  10. ที่พักเกาะล้าน ที่พักเกาะล้าน เกาะสวยน้ำใสใกล้กรุงเทพแห่งนี้ คือ ที่เที่ยวยอดฮิตของนักท่องเที่ยวจากทั่วทุกสารทิศ
    และแน่นอนว่าบนเกาะล้านแห่งนี้นั้นยังมี ที่พักเกาะล้าน สวยๆ ไว้ให้บริการอีกมากมาย treetep.com


    สมัครใช้งาน Gmail
    บ้านโมเดิร์น
    บ้านและการตกแต่ง
    เครื่องชงกาแฟสด

    ReplyDelete
  11. Nice blog, visit for the best Mutual Fund advice about the best mutual fund companies in delhi, India by Mutual Fund Wala.
    Mutual Fund Agent

    ReplyDelete
  12. norton.com/setup - If you are not using an antivirus on your system, then you are undoubtedly more prone to get malicious programs infected on your PC. Norton provides world’s best antivirus programs that can prevent harmful malware and viruses from infecting your system. Majority of the virus a user receives is from careless online activities. Browsing online and going through social media without any protection is a sure way to get malware on your system. With features like real-time protection, online web security, and email blocking Norton provides the ultimate protection to your system. You can avail the esteemed protection of Norton antivirus on norton.com/setup. Visit the site to download, install, and activate your Norton setup.Readers Bay

    ReplyDelete
  13. Amazing blog, thanks for sharing with us. Get the best Food Truck Branding and Vinyl Signage Printing Services in Delhi, India at Kalakutir Pvt Ltd.
    Vinyl Signage Printing Services

    ReplyDelete
  14. نقل عفش من الدمام الى جدة نقل عفش من الدمام الى جدة
    شحن عفش من جدة الى الاردن شحن عفش من جدة الى الاردن
    نقل عفش من الدمام الى الاحساء نقل عفش من الدمام الى الاحساء


    شحن عفش من الدمام لمصر شحن عفش من الدمام لمصر

    ReplyDelete
  15. เล่นจริงแจกจริงต้องสล็อต xo เท่านั้น สนุกได้ทุกวันกับสล็อตออนไลน์ ลองเลย

    https://www.slot4u.com/slotxo

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Your article is amazingly richly made. This is unprecedented edifying substance from my viewpoint. You in like manner offer various honorable expressions with persuading, one regarding a caring substance.
    SAP training in Kolkata
    Best SAP training in Kolkata
    SAP training institute in Kolkata

    ReplyDelete
  18. Your article is incredibly lavishly made. This is uncommon enlightening substance from my perspective.
    SAP training in Mumbai
    Best SAP training in Mumbai
    SAP training institute Mumbai

    ReplyDelete
  19. You in like way offer different fair articulations with convincing, one in regards to a mindful substance.
    SAP training in Mumbai
    Data Science training in Mumbai
    Best data science training in Mumbai

    ReplyDelete
  20. Top 10 Lists – One Place To Find Best Information In Form Of Top 10, It Also Includes Good Knowledge Information And You Can Download Pc Games Too.
    Top 10 Lists
    Social Bookmarking Sites List
    Rabbit Alternatives
    Image Submission Sites
    Video Submission Sites

    https://top10listss.com/
    https://top10listss.com/social-bookmarking-sites-list/
    https://top10listss.com/rabbit-alternatives/
    https://top10listss.com/image-submission-sites/
    https://top10listss.com/video-submission-sites/

    Social Bookmarking Sites List
    Rabbit Alternatives
    Image Submission Sites
    Video Submission Sites

    ReplyDelete
  21. I really love your article and thanks for sharing these resources.
    Best 27 Inch PC Monitor

    ReplyDelete
  22. Hi,

    Freelance IP Network Engineer
    IP networks must function in a stable and reliable manner, and that is where IP network engineers intervene. They can maintain the network, as well as supervise the work, such as updating and modifying the IP network, since it needs to grow and expand over time. They can help with problem solving and handle changes in the network as new services and additional tasks are required.The global reach offered by FieldEngineer.com allows you to find the right engineers and professionals where you need them. We know that companies often need to perform work in different locations and that is possible thanks to our platform.

    ReplyDelete
  23. height increase exercise at any age by doing these simple exercises and workout. Become taller in 1 week. Jumping jack exercise at home to increase height.

    ReplyDelete
  24. I think it is very helpful. And thought that it could be applied as well pgslot
    I think it is very helpful. And thought that it could be applied as well joker gameing
    I think it is very helpful. And thought that it could be applied as well pgslot
    I think it is very helpful. And thought that it could be applied as well sexygame
    I think it is very helpful. And thought that it could be applied as well amp poker

    ReplyDelete
  25. Get free bonus 100%
    New online slots game Online slot betting
    This game is very good pg game slot ดูเพิ่มเติม

    ReplyDelete
  26. Thanks for sharing such great information with us. Your Post is beneficial superslot

    ReplyDelete
  27. quite informative and helpfull content regarding the devices .



    office.com/setup

    ReplyDelete
  28. "Novelty" is the quality of being new, or following from that, of being striking, original, or unusual. Novelty is the state or quality of being new, exciting, unusual, or unique.
    office.com/setup

    ReplyDelete
  29. Canon ijsetup is an independent platform where you can download and install Canon printer drivers for setting up an inkjet printer on PC, Mac and smartphones as well.
    canon.com/ijsetup

    | http //canon.com/ijsetup

    ReplyDelete
  30. McAfee antivirus on any device. Once you visit the retail store like Walmart and Best buy, they issue you a retail card that holds McAfee 25 digit activation code in its backside mcafe.com/activate , macfee.com/activate

    Microsoft 365 or Office on your computer. If you are using any other Microsoft service such as OneDrive, Outlook.com, Skype, or Xbox Live, it means you already have an account that you can use for any Microsoft activity.
    Microsoft365.com/setup

    ReplyDelete
  31. This comment has been removed by the author.

    ReplyDelete
  32. Thank you so much for sharing all this wonderful information !!!! It is so appreciated!! You have good humor in your blogs. So much helpful and easy to read!
    Visit to know about Software Testing course in Pune

    ReplyDelete
  33. This applicationis considered for video calling across the globe. Be it with friends or family or with your colleagues, this application makes it possible to connect and do
    video chat or conferencing, wherever you are. Skype Login canon.com/ijsetup | cannon/ijsetup | Cox webmail Login

    ReplyDelete

  34. With over 64+ Million Users, Norton is already on the list of best antivirus security that helps you manage your digital life anywhere. If you have a Norton product key. norton.com/setup and download Norton setup. Going through 123.hp.com/laserjet provides wired and wireless, both Hp printer software download options, hence if you have hp wireless printer, connect it with below steps;

    ReplyDelete
  35. This comment has been removed by the author.

    ReplyDelete
  36. สนุกกันได้ทุกที่หารายได้ได้ทุกเวลาต้อง PGสล็อต ค่ายดีมีคุณภาพมีเงินทุนรองรับตอบสนองทุกความต้องการของลูกค้ากดเข้ามาเป็นสมาชิกเราวันนี้รับฟรีโบนัสสูงสุดหนึ่งร้อยเปอร์เซ็นต์ สนุกหรรษาไปกับเกมมากมายได้แล้วที่นี่ครบจบภายในเว็บเดียว

    ReplyDelete
  37. https://ofoghnews.ir/344928/%D8%AE%D8%B1%DB%8C%D8%AF-%D9%85%D9%88%D8%A8%D8%A7%DB%8C%D9%84-%D8%AF%D8%B1-%DA%86%D9%86%D8%AF-%DA%AF%D8%A7%D9%85-%D8%B3%D8%A7%D8%AF%D9%87-%D9%88-%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1%D8%AF%DB%8C/Also, for more and better information about the types of phones to buy mobile phones, mobile parts, as well as specifications related to their hardware and software systems, you can get help from the practical articles on the company's site.

    ReplyDelete
  38. Top jurisdictions for founding an IT and software development company
    As more and more legal systems open up to foreign trade, companies can gain access to a large pool of resources abroad. They can build relationships with foreign partners and move their production abroad or simply export their products to new markets. IT and software development companies are also trying to profit from relocating production to foreign jurisdictions.

    In general, the main advantage of relocating software development abroad is the lower costs compared to the home country. For example, the cost of developing the exact same software in India is 50% less than in the US. The savings generally result from lower labor costs, but moving IT and software production abroad can also give the company access to a wider pool of workers with higher skills and knowledge. This could explain why 50% of America's Fortune 500 companies use offshore IT and software development. Let's look at some of the jurisdictions where opening a software development business might be more beneficial compared to others and discuss why.

    http://www.confiduss.com/en/info/blog/article/top-it-company-jurisdictions/

    ReplyDelete
  39. This is something I actually have to try and do a lot of analysis into, thanks for the post.

    토토
    바카라사이트
    파워볼
    카지노사이트

    ReplyDelete
  40. There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Visit here for more information:

    스포츠토토
    토토
    안전놀이터
    토토사이트

    ReplyDelete
  41. Thanks in support of sharing such a nice thinking, article is pleasant, thats why i have read it entirely

    사설토토
    카지노
    파워볼
    온라인카지노

    ReplyDelete
  42. It is almost impossible for someone to be a social and happy person, but not know the range of games. Maybe if we had lived a few years ago, I would have said that everyone is familiar with this type of game, or at least one manch, chess or backgammon game can be found in their homes, but now the situation is different and some are somehow with these games. They have become strangers that if we ask them what the game board is, they can not give a correct answer to our question.
    http://nesfnesf.ir/reportage/54-%D8%A8%D8%B1%D8%AF%DA%AF%DB%8C%D9%85

    ReplyDelete
  43. Hello Author, you have written nice article and shared with great information. Thanks for giving such a wonderful world class information.
    Jobs in Visakhapatnam
    Jobs in Bhopal
    Jobs in Pune
    Jobs in Mumbai
    Jobs in Chennai
    Jobs in Kolkata

    ReplyDelete
  44. I simply want to tell you that I am just beginner to blogs and certainly enjoyed you’re web page. 슬롯머신

    ReplyDelete
  45. As crypto trading is increasing mainstream nowadays, there are several methods that you can follow to prevent your Cryptocurrency from cybercrimes. Several popular platforms like Coinbase pro allow their users to trade a variety of digital assets on a secure, insurance-backed platform. But sometimes, you may experience issues while creating your Coinbase pro sign up account. Here, in this article, we have mentioned quick steps that you can follow to create your Coinbase Pro account.

    coinbase.com login
    coinbase wallet
    crypto.com login

    ReplyDelete
  46. https://cutt.ly/SI5vchJ Doctors are working with various specialties that if the type of disease is compliant with the doctor's expertise. The process of diagnosis, control and treatment of the disease is very fast. Usually, referring to the domestic specialist is very important, but when and for what kind of illnesses should see this specialist.

    ReplyDelete

  47. This blog is very informative the stuff you provide I really enjoyed reading. 토토사이트

    ReplyDelete
  48. I am very happy to discover your post as it will become on top in my collection of favorite blogs. 바카라사이트닷컴

    ReplyDelete
  49. Impressive Thanks for the post! Carry on, don’t stop! Thanks for any other great article. 파워볼사이트닷컴

    ReplyDelete
  50. I am interested in this area if you are a great site but know some community forums. I think it should be a good opportunity to get feedback from others who are experienced. 토토

    ReplyDelete
  51. There have been some unbelievable players who have graced the game over the years and some have left their mark on the sport by using a signature move. 파워볼게임

    ReplyDelete
  52. This comment has been removed by the author.

    ReplyDelete
  53. Your website Is nice and informative. Please continue such kind of good effort. 바카라사이트윈

    ReplyDelete
  54. "Unlimited Novelty is a literary adventure that pushes boundaries and captivates the imagination. With each turn of the page, a new and exciting world emerges, keeping readers hooked. A refreshing escape from the ordinary, offering an endless array of creative surprises. Prepare to be amazed by the boundless creativity within its pages."
    Abogado de tráfico Southampton VA




    ReplyDelete
  55. Reia, a programming language, incorporates object-aware concurrency, enhancing parallel processing. With a focus on objects, Reia facilitates seamless coordination and communication between concurrent processes. This unique feature optimizes resource utilization and simplifies complex programming tasks, making Reia an efficient choice for applications requiring concurrent and parallel execution. "Your comment is like a burst of confetti, adding joy to our blog. Each word is a brushstroke on the canvas of conversation, creating a vibrant tapestry of ideas. We eagerly await your next insight, as your contributions light up our digital world. Thanks for being our comment superstar!" violation of a protective order virginia

    ReplyDelete

  56. Our Sales Tax Reporting Service simplifies tax compliance for businesses of all sizes. We handle everything from accurate calculation to timely filing, ensuring you stay compliant with all state and local tax regulations. Our advanced software integrates seamlessly with your sales system, automatically updating tax rates and generating detailed reports.

    With our service, you can reduce errors, save time, and avoid costly penalties. Trust our expert team to manage your sales tax obligations, so you can focus on growing your business. Stay compliant effortlessly with our reliable Sales tax reporting service.

    ReplyDelete
  57. It is a genuine licensed website with international standards. Every slot game has a high RTP. Fast deposits and withdrawals, fast transactions, number 1 in Thailand.! ✨ ⭐️




    สล็อต
    สล็อต เครดิตฟรี
    สล็อตออนไลน์
    สล็อต 66
    สล็อต เว็บตรง





    ReplyDelete

  58. Unlimited Novelty offers a fantastic array of unique and creative products that spark joy and imagination. Their commitment to quality and fun makes it a go-to destination for anyone looking to add a touch of whimsy to their life. immigration lawyer elizabeth nj

    ReplyDelete
  59. The trial system covers all games. Members can use it for free. No need to have a username, it's easy to use. You don't need to register first to play to your fullest potential. Try playing slots for free, available 24 hours a day, all games complete.✨✨
    and. Click to apply.✨✨


    สล็อต
    สล็อต เครดิตฟรี
    สล็อตออนไลน์
    สล็อต 66
    สล็อต เว็บตรง


    ReplyDelete