Thanks, Rich! I looked at the 7094 instruction set manual online, but didn't see anything like an exchange/swap instruction. I looked at an online GE645 instruction set manual, but didn't find anything there. Exchange/swap were considered back then for two reasons: 1. memory & registers were extremely expensive, so a single instruction exchange/swap would save both data/register memory and instruction memory. 2. main memory was made from ferrite cores, so reading was *destructive*. Since you had to write *something* back to memory anyway, you might as well write something *else* just as easily as writing back what you just read. (The PDP-8 curiously did this backwards: its "DCA" (Deposit and Clear Accumulator) stored the accumulator and set it to zero, but the "LDA" (LoaD Accumulator) instruction did *not* clear the memory location from which it was loaded! It would be interesting to know if there were any computers who "utilized" this *destructive read* "feature" of core memory.) I do recall that some computers back then had the ability to exchange a memory location with the *program counter*! This enabled fast Fortran I subroutining (no stack; no recursion; no service) and "co-routining". Perhaps the PDP-6/10 did this sort of thing as well. At 03:59 PM 3/13/2018, rcs@xmission.com wrote:
The PDP6 had EXCH A,M which swapped an Accumulator with a Memory location. The manual is dated 1964.
At that time, EXCH as an atomic instruction was believed useful for certain safely-interruptible algorithms --- futzing with linked lists &c.
Maybe check out an old IBM 7094 manual?
Rich ---- Quoting Michael Greenwald <mbgreen@seas.upenn.edu>:
On 2018-03-08 08:10, Henry Baker wrote:
I'm curious as to the origin of the exch/swap instruction in computer instruction sets.
Does anyone know the first computer having such an instruction?
I'm not interested in the modern "compare-and-swap" type of instruction, which seems to have originated with Maurice Herlihy, but the original, non-conditional type.
I don't think Maurice originated the instruction; I am pretty sure some versions of it predated him by decades (IBM 370). He was just the one who pointed out and proved that it was universal (in the context of non-blocking synchronization), as was the pair LL SC.
But I have no answer to your main question, sorry.
Yes, early computer scientists (before they were called that!) loved these instructions because they allowed for clever algorithms like a stackless GC algorithm.