ELI5: Explain Like I'm 5

Test and test-and-set

Okay, imagine you have a toy and your friend wants to play with it, too. But you don't want her to take it away without asking you first. So, she has to "test" to see if it's okay to take the toy. She might ask you, "Can I play with your toy?" or "Is it okay if I borrow your toy?" If you say yes, then she can take it, but if you say no, then she can't.

Now let's say you have a special toy that only one person should play with at a time, like a yo-yo. You want to make sure that only you or your friend can play with it, and that neither of you can use it at the same time. So, you need something called "test-and-set". This means that before your friend tests the toy, you "set" it to be unavailable. Then, when she tests it, she finds out that it's not available for her to play with. She has to wait until you're done playing with it and set it to be available again before she can test-and-set it for herself.

Basically, test-and-set is a way to control access to something so that only one person can use it at a time. It's like taking turns, but you use a special system to make sure no one tries to take their turn when they're not supposed to.