Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 13, 2022 08:38 am GMT

The Radcliffe Concurrency Model

TL;DR The Radcliffe Concurrency Model is a way of understanding how a computer resource, or person responds to an interruption, which will help us understand multitasking in programming, and in life.

The Radcliffe Model of Concurrency

Interruptions are a fact of life. Nobody has the luxury of being able to single-task on each thing they start until its sweet completion. No life is more like this:

  • Kid: "Dad, I want a grilled cheese, please."
  • Dad: starts making a grilled cheese sandwich...
  • Kid: "Dad, can I have chicken nuggets?"

When we ask what we would do as the dad, we are considering which one of our Concurrency Strategies should we use? We'll list these out shortly. But first - notice that although everyone makes these strategy choices - nobody can quickly list what all the choices are! It's like we haven't studied this problem space well enough to pin down the options.

So we'll list the options-but first we'll see how much we need them, and how widely they apply, for developers and humans alike :)

Interruptions Affect Computers, UX and People

Computers too must decide what to do when they are busy and get a new request. A chain of coffeehouses has a Dropbox into which each coffehouse uploads its daily transactions as a CSV file. The server is now processing a file of 500 transactions, and a new, different file from the same coffeehouse gets dropped there. What should the server do?

In User Interface / UX these strategies must be chosen and used everywhere! A user begins one download while already downloading another. Or a Ring notification sound is triggered but another just started. Or a like button is clicked twice, or two like buttons in close succession. Or a remote control is slow to respond and you press the button again. What should the app do?

Front-end development, back-end development, and every person you know depends upon selecting good Concurrency Strategies. Then, why don't we know what they are? Is there a listable set? There is, and the Radcliffe Model of Concurrency makes them available for our understanding, so that we can choose the correct one for each UX, or life situation.

(Also a JavaScript library makes them available to program with directly)

Knowing Our Options is Empowering

Before they were called The Radcliffe Model, the Concurrency Strategies, aka modes, were cheekily called: The 5 Kinds of Busy. For the situation of the Dad making dinner, then given another request, the dad could:

  1. Start satisfying the 2nd request right away, eventually making both. Maybe they're really hungry.
  2. Say - I'll make that for you after I finish what I'm doing. You don't have room to do both.
  3. Stop the first request, make the 2nd instead. You understand order 2 to replace order 1.

The other two are funny when applied to people, but still relevant sometimes!

  1. Ignore the 2nd request. Basically the "Not Now" response.
  2. Turn off the stove. "I cant keep changing what I make for you, now come back when you know what you want!" (This has never happened in the Radcliffe household! )

So, out of necessity, the Radcliffe Model was born!

Shared Vocabulary Empowers

If you do something alot, it pays to have concise words to describe it. Some languages have many words for rain or snow or love. Animators speak of an "ease-in" animation, instead of the Bezier curve - this helps their ideas be understood. The team becomes aware of something they can trivially ask for in the future.

Animators say ease-in, not 0.42 0 1 1

What I find is that async programs, and the humans that make them do not currently reflect the awareness of thse modes as a choice.

Instead, we use a strategy by default, or by what's easiest given the features of our programming tools. This doesn't give us the power of all of the choices.

The Radcliffe Model of Concurrency

The modes in the Radcliffe Model, in English are:

  • Immediate
  • Queueing
  • Replacing
  • Blocking
  • Toggling

The Radcliffe Model of Concurrency

I recognize these might not be the names you'd call these - you may have used serial and parallel, for either of the top 2 modes. Fine! But the value is not in what they are called, but the fact that they are known as an entire set.

Sometimes, trying to do all that's requested of you, as Immediate and Queueing modes do - is not the best UX, or kitchen management. The Blocking mode may smartly reduce concurrency by favoring a prior request, just as an elevator that is already requested, so does nothing on subsequent calls to the same floor. The Replacing mode is seen in how one video playing replaces another when we browse a social site. And Toggling is what a one-button power switch does - more on that later.

The reason to learn this model is that getting a computer program, UX, or human behavior to be correct is often done simply by choosing the best mode from the list!

I'll save an elaboration and derivation of each mode for another article. The graphic arranges them spatially to show how they relate, and at the end of the article are some trading-card-style images you can even print as a reference! (And play Oblique Strategies with them if you like)

Yes, Toggling is a Real Thing!

Some of you inquire why Toggling is in this list. Since it's actually a failure to do anything concurrent. Yet still - sometimes it is the called-for response to an interruption.

Think about the DropBox of nightly files what if more than one file per night is unexpected? To avoid double-processing or ambiguities, the processing may be shut down the moment an ambiguity appeared. So, toggled by the 2nd file!

Again, modes' derivations and history will be discussed in another article, but once Toggling joined the family in 2019, it was clear that the family was incomplete without it. Just like our beloved Betta fish that rounded the Radcliffe family out to 5, three years ago.

Go Forth and Be Concurrent!

The Radcliffe Model of Concurrency is licensed under the Attribution-Share-alike license. It is free to share, and incorporate into other materials, provided you attribute the author and adhere to the BY-SA terms.

These modes are accessible in JavaScript/TypeScript through the libraries, for use in browser or service apps today, with many examples covering familiar use cases.

Folks with translation skills - would you propose your languages' names for the modes in the comments?

Thanks, I'd love to hear how you've found this model to apply to you!

Dean Radcliffe (@DeanDevDad)

RxFx Strategy Cards


Original Link: https://dev.to/deanius/the-radcliffe-concurrency-model-3ll8

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To