# Tag Info

Accepted

### How to respond to the two-handed approach to swapping

Don't overcomplicate things. Your first instinct, that the computer only has one hand, was the correct one. This is a regular problem that new teachers have, and it sometimes takes a few years of ...
• 33.9k

### How to respond to the two-handed approach to swapping

Re-evaluate what you think is "right", because you aren't but isn't right in computer science This is simply incorrect. Your student can create two variables called ...
• 1,072

### How to respond to the two-handed approach to swapping

Your problem is that you tried to let your student "program" without establishing a language. Thus they were free to write their own "language" in which you can do two things at ...
• 1,523

### When should concurrency and parallel multi-processing concepts be introduced?

If we don't introduce parallel/concurrent thinking early, our students can develop a sequential mindset that makes it hard for them to make the shift later. The rest of this is in the context of a ...
• 1,011
Accepted

### Why is the critical-section problem always presented with code in infinite loops?

One reason infinite loops are used could be so the problem can't be solved by letting one thread complete the code before the other thread starts it. With infinite loops, no thread ever completes the ...
• 7,650

### How to respond to the two-handed approach to swapping

This question reminds me of when a student failed to understand why a third variable was needed to exchange the value of two variables (i.e. to swap A and B, C=A, A=B, B=C). I managed to illustrate ...
• 151

### How to respond to the two-handed approach to swapping

They took both their hands, picked up the second and fourth pencils (each in one hand), and swapped them! That works in reality... but isn't right in computer science. It depends on your paradigm. ...

### When should concurrency and parallel multi-processing concepts be introduced?

We're introducing some aspects of parallel processing quite early on in Scratch. Each sprite has its own script which appears to execute in parallel with those of the others. Scratch has a broadcast ...
• 1,266

### Why is the critical-section problem always presented with code in infinite loops?

"processes that run and enter critical sections ... where the code is not in an infinite loop" Processes are generally components of a reactive system (like an OS) that are designed to be non-...
• 111

### Could you recommend books on concurrent programming?

Concurrent programming is easy, synchronisation is hard. Have a look at this video for an alternative to synchronisation: https://www.youtube.com/watch?v=2yXtZ8x7TXw When you have to synchronize Use ...
• 10.8k

### Could you recommend books on concurrent programming?

Since the OP asked about functional programming, so I would highly recommend you to read "Learning Concurrent Programming in Scala" by Aleksandar Prokopec, (2014). All the examples for this book are ...

### How to respond to the two-handed approach to swapping

I do the swap example pretending to have two largish (2-hands-to-lift) boxes side-by-side on a desk (with only enough room for two boxes). After we lift the first we have to look for a place to put it,...

### How to respond to the two-handed approach to swapping

In thinking about this, and especially the answer of Graham, I think that what we really do in the standard three step process is a two handed swap without thinking of it. So, it is a failure of the ...
• 36.4k

### How to respond to the two-handed approach to swapping

Analogies & metaphors are imperfect, so let's share the expectation that they are just illustrative. Rules of what is possible (and not) are very important, and we can compare the rules of pencils ...
• 333

### How to respond to the two-handed approach to swapping

Graham pointed out that the assumtions of the question are wrong. And Peter Cordes elaborated a bit in the comments. Considering a target VLIW (Very Long Instruction Word) architecture can help ...
• 948

### How to respond to the two-handed approach to swapping

Ben's answer is great, but allow me to suggest that you don't need to "respond" to the two-handed approach at all: just say when you're explaining the problem in the first place that they ...
• 529

### Could you recommend books on concurrent programming?

The Well Grounded Java Developer has an excellent section on concurrency. The author claims that very few developers correctly implement concurrency. As ctrl-alt-delor put it: concurrency is easy; ...
• 272

### Could you recommend books on concurrent programming?

I have no recommendations for the theory part but since you are asking for implementation advice as well, here we go. If you are looking to use C sharp (you haven't specified a specific language of ...
• 1,884

### When should concurrency and parallel multi-processing concepts be introduced?

I do not see much value in teaching more than an appreciation of threads and locking, until you have covered less primitive techniques for parallelism. These techniques allow parallelism that scales ...
• 10.8k