News for hackers. Stuff that matters.
Re:COBOL programmers answer call by gumby on Friday April 10, 2020 @07:13PM (#22838333)
> For instance, it allows programmers to quickly create user interfaces by declaratively describing them, in a so called SCREEN SECTION.

By the way if it seems odd to have I/O like this in your language:* this reflects the architecture of mainframes; because the CPU was so important, I/O was managed by external devices (typically themselves a cabinet of electronics, at a time when the CPU took up two or three cabinets itself). You'd write essentially a small program describing what IO you wanted and then let the IO channel controller be busy dealing with minutiae like dealing with the tape drive motor or input from terminals.

So the language would set up data to be slapped to a terminal (this would have been a decade or more after COBOL was written, once terminals with screens were available), which the channel controller would send to the appropriate terminal. It would then deal with input and once all was ready, tell the CPU that it had a bunch of input ready.

Terminals like the 3270 were even half duplex so would process the input and then send it off as a block, to make the channel controllers more efficient!

In the ARPAnet of the 1970s, the ITS PDP-10s and -20s took this further with a protocol called SUPDUP (super duper) which allowed this kind of processing to be done on a remote machine when logging in over the net (as we would do today with ssh). So you could log into a remote machine and run EMACS, and while you were editing a remote file with a remote editor all the screen updating would be done by your local computer! Even the CADR lisp machines supported this protocol!

* At the time not doing IO through the language itself was considered oddball. I seem to recall a line in the original K&R where they described C's I/O and made an aside, '("What, I have to call a function to do I/O?")'

Re:COBOL programmers answer call by rbanffy on Friday April 10, 2020 @08:33PM (#22838759)
It's quite clever, actually. Offloading specialized work to autonomous subsystems allows the CPU to run your code better than it would if the CPU also had to deal with reading from disk or assembling packets for the network. A modern mainframe has tons of such systems and that's what allows them to process volumes of transactions that PC-based servers of the same price range can't.

In fact, our PCs are like that because they had to be cheap and the cheapest way is to burden the CPU with all work.

Re:COBOL programmers answer call by gumby on Friday April 10, 2020 @08:52PM (#22838850)
Actually I’d disagree a bit with your last sentence. Handling io interrupts in the kernel was a property of cheap machines like minicomputers that you could buy for a few hundred $k or less. You typically couldn’t afford extra channel controllers on cheap machines like that. Hence Unix’s I/O architecture was driven by the constraints of the PDP-7. Multics has a standard io controller architecture.

PCs of course had the same issue — down to the cpu controlling the speed of disk rotation! But a modern PC has an I/O system more complex than the mainframes of old, with network interfaces that do checksum processing, handling retransmission and packet reassembly etc, just DMAing the result. Disk drives, whether spinning or SSD have a simple, block interface unrelated to what the storage device is doing, etc. I think this is all as it should be, though I personally consider the Unix IO model grossly antiquated.

Re:COBOL programmers answer call by DonHopkins on Saturday April 11, 2020 @05:01AM (#22840542)
If /dev/zero is an infinite source of zeros, then why doesn't the minor device number specify which byte to use? Then you could make character special file /dev/seven that was an infinite source of beeps! There have been so many times I needed that.
Re:COBOL programmers answer call by rbanffy on Saturday April 11, 2020 @07:07AM (#22841049)
Great idea! Also, for when you need some paper, you can pipe /dev/twelve to your printer.

We should propose a kernel patch for this next April.

Extra credit if we get it rolled into POSIX.

Re:COBOL programmers answer call by gumby on Saturday April 11, 2020 @12:26PM (#22842467)
Star Wars is more advanced and had this. How do you think R2D2 wasn’t cut from that film? He had an advanced case of Tourette’s so everything had to be beeped out.

Imagine if they’d run out of beeps during filming!

Re:COBOL programmers answer call by zozbot234 on Friday April 10, 2020 @09:20PM (#22839000)
These days, the "autonomous subsystem" is a microcontroller at the other end of a USB, SATA or PCI bus. Modern network cards also need to perform most of their packet-assembly operations on device and not in the kernel, or they would never reach their advertised max bandwidth.
Re:COBOL programmers answer call by rbanffy on Saturday April 11, 2020 @04:48AM (#22840498)
Those controllers are still designed prioritizing cost over performance most of the time.
Re:COBOL programmers answer call by gumby on Saturday April 11, 2020 @12:28PM (#22842476)
Well it’s system cost — the controllers take the high frequency interrupts, not the cpu.

As for BOM...a few years ago we designed a big serial board (industrial control) and found it was much cheaper to buy AVR cpus and use just the onboard UARTs than to buy UART chips.

Re:COBOL programmers answer call by macintux on Friday April 10, 2020 @08:26PM (#22838743)
Almost 25 years ago I took a TCP/IP class in Chicago that turned out to be a waste of my time, because it primarily dealt with clients like ftp, telnet, etc that I was already quite familiar with.

However, the rest of the students were mainframe guys, so it was an interesting few days. My (Solaris, Linux) world seemed incomprehensible to them, and vice versa, but it was nice to get a glimpse into how the other half lived. Finding experienced computer people who’d never used ftp was quite surprising.

Re:COBOL programmers answer call by BiteCode_dev on Saturday April 11, 2020 @02:00AM (#22839906)
Separating the IO from the rest of the program is always a good practice, that we keep rediscovering.

E.G:

- UI in React are trying to be just rendering functions with one input and one output. Even more so with hooks.

- in python, there is a new trend of providing "Sans I/O" (https://sans-io.readthedocs.io/), and async/await are not just keywords, but a generic protocol created to delegate I/O to something from outside your code.

It's interesting to see that on very old systems, even the hardware was organized that way.

Re:COBOL programmers answer call by derefr on Friday April 10, 2020 @11:28PM (#22839455)
Oddly, that reminds me a lot of early game consoles! You'd just set up some sprite registers, or send some commands to music sequencer hardware, and then those would go on and persistently do things on their own while the CPU got on with the "business logic" of running a game.

It's funny how it was the systems in the middle (minicomputers, like the PDP-11 where C originated) that did everything on the CPU, whereas the systems on the high end (mainframes) and low end (microcomputers) both split the work out, for different reasons: mainframes pushed IO out to independent coprocessors for multitenant IOPS parallelism (can't make any progress if the CPU gets an IO interrupt every cycle); while early microcomputers pushed IO out to independent coprocessors to retain the "feeling" of real-time responsivity in the face of an extremely weak CPU!

Re:COBOL programmers answer call by gumby on Saturday April 11, 2020 @01:26AM (#22839792)
I never thought of a sprite chip this way but your message makes me think I should have. A sprite chip was a kind of coprocessor like an external floating point unit or a GPU.
Re:COBOL programmers answer call by a1369209993 on Saturday April 11, 2020 @04:18AM (#22840387)
A sprite chip literally is a GPU [Graphics Processing Unit], just for 2d graphics (sprites,tiles,color palettes,etc) rather than 3d (vertex,triangles,fragment shading,etc).
Re:COBOL programmers answer call by derefr on Saturday April 11, 2020 @11:33AM (#22842189)
Mind you, a PPU is specifically, in most cases, more like an iGPU (integrated GPU, like Intel's on-CPU graphics.) Most of the PPU chip designs tended to share a memory (both physically and in address-space terms) with the CPU, such that the CPU would write directly to that memory, and then the PPU would read back from that memory. (This was when the PPU had memory at all; often they were pixel-at-a-time affairs, doing just-in-time sprite-tile lookups from the ROM pointed to by their sprite-attribute registers.)

Most things we call "coprocessors", on the other hand, were a bit different: they had their own on-board or isolated-bus memory, which only they could read/write to, and so the CPU would interact with them with "commands" put on a dedicated command bus for that coprocessor. Most sound chips (down to the simplest Programmable Interval Timer, but up to fancy chips like the SNES's SPC700) were like this; as were storage controllers like memory cards and the PSX's CD drive.

Re:COBOL programmers answer call by gumby on Saturday April 11, 2020 @12:31PM (#22842491)
Literally true.

I was thinking of the GPUs we had in those days which were often a couple of VME cards or even a small cardcage, but you’re right: that physical distinction isn’t really relevant.

Re:COBOL programmers answer call by goatinaboat on Saturday April 11, 2020 @02:43AM (#22840045)
In the Amiga it was called the Copper which was an abbreviation of co-processor.
Re:COBOL programmers answer call by DonHopkins on Saturday April 11, 2020 @04:47AM (#22840493)
SUPDUP and EMACS supported "line saving", so Emacs could send a control code to tell a SUPDUP terminal to save lines of text in off-screen buffers, and restore them to the screen, so EMACS only had to send each line one time, and the SUPDUP terminal could quickly repaint the screen as you scrolled up and down through a buffer.

Here's my Apple ][ FORTH implementation of SUPDUP with line saving (%TDSAV, %TDRES), which saved lines in the expansion ram card.

https://donhopkins.com/home/archive/forth/supdup.f

Re:COBOL programmers answer call by ffhhj on Friday April 10, 2020 @08:52PM (#22838844)
Now in HTML5 you have to learn 3 languages to do that.
Re:COBOL programmers answer call by dmix on Saturday April 11, 2020 @01:34AM (#22839810)
HTML and CSS are more markup languages than actual languages. You can work at varying degrees of abstraction.

There are thousands of template sites being used today with JS plugins the developer probably wouldn’t know how to write. But the minimal interface layers are sufficient to get them to work.

Stuff like Select2 and bootstraps collection of plugins cover a broad range of interactivity most people need on the internet.

Re:COBOL programmers answer call by zitterbewegung on Friday April 10, 2020 @08:03PM (#22838631)
What you are describing sounds like the inverse of TRAMP in modern GNU emacs.
Re:COBOL programmers answer call by gumby on Friday April 10, 2020 @08:44PM (#22838806)
In a way. We had that too, with a networked filesystem in the 1970s so you could simply open a remote file in ITS EMACS (or any other program). It was handled by the O/S, or rather a user space program like today’s FUSE.
Re:COBOL programmers answer call by larsbrinkhoff on Tuesday April 14, 2020 @05:38AM (#22864123)
But the bulk of the remote file system code was in user space.
Re:COBOL programmers answer call by rbanffy on Friday April 10, 2020 @08:07PM (#22838644)
Or an HTML form.
Re:COBOL programmers answer call by gumby on Friday April 10, 2020 @08:41PM (#22838795)
SUPDUP was far more dynamic than an HTML form (read RFCs 734 and 749).

html forms are more like the half duplex terminals of the 70s/80s.

Re:COBOL programmers answer call by m463 on Saturday April 11, 2020 @01:45AM (#22839848)
I remember someone complaining about unix machine in comparison to mainframes:

"It generates an interrupt every time you press a key!"

Re:COBOL programmers answer call by DonHopkins on Saturday April 11, 2020 @05:09AM (#22840580)
At UMD, Chris Torek hacked ^T support to the 4.2 BSD tty driver, inspired by TOPS-10/TWENEX's interrupt character that displayed the system load, current running job, etc.

But the first version didn't have any de-bouncing, and would process each and every ^T it got immediately (each of which had a lot of overhead), so on a hardwired terminal you could hold the keys down and it would autorepeat really fast, bringing the entire system to its knees, while you could even watch the load go up and up and up!

And of course whenever the system got slow, everybody would naturally start typing ^T at once to see what was going on, making it even worse.

That was a Heisenbug, where the act of measuring affects what's being measured, with an exacerbating positive feedback loop. He fixed the problem by rate-limiting it to once a second.

https://en.wikipedia.org/wiki/Heisenbug

https://en.wikipedia.org/wiki/Positive_feedback

Re:COBOL programmers answer call by goatinaboat on Saturday April 11, 2020 @02:46AM (#22840049)
VMS systems on LAT networks only received a packet/interrupt per line from the terminal, that’s how they were able to support many times more users than Unix contemporaries.
Re:COBOL programmers answer call by gumby on Saturday April 11, 2020 @03:23AM (#22840187)
Unix can be configured this way —- it used to be the default, with # as the rubout character and @ the line delete character. It’s still in the tty driver and can be useful when programming from a teletype (tty)
Re:COBOL programmers answer call by goatinaboat on Saturday April 11, 2020 @03:49AM (#22840277)
I learnt something today - thanks. I’ve never seen a Unix system configured like that, in over 25 years of doing this!
Re:COBOL programmers answer call by gumby on Saturday April 11, 2020 @12:35PM (#22842515)
That system was inherited from Multics, but the limited number of interactive computers in those days were primarily used from printing terminals which couldn’t actually erase a character so all of them had some such facility.
Re:COBOL programmers answer call by m463 on Saturday April 11, 2020 @08:50AM (#22841402)
thank goodness. I remember it was common that the login screen on a terminal would be configured for # as backspace while backspace would actually DO a backspace but be entered into the buffer.

I suspect it was a remnant of hardcopy terminals

Re:COBOL programmers answer call by msla on Saturday April 11, 2020 @12:42AM (#22839679)
> Terminals like the 3270 were even half duplex so would process the input and then send it off as a block, to make the channel controllers more efficient!

The block mode terminals (like the 3270) were/are kinda like HTML forms: The mainframe sends a form to the terminal, and the terminal has enough local smarts to know how forms work, that only some regions of the form are writable, and how to send a response back one form at a time, as opposed to the character-at-a-time terminals which Unix and VMS and ITS were built around. There's a lack of flexibility, but it allows mainframes to service tons of interactive users, for a certain definition of interactive.

The Blit terminal was the next step beyond block mode terminals, in some sense: Blits could be character-cell terminals with fundamentally the same model as the VT100, but they could also accept software in binary form and run interactive graphical programs locally. Think WASM, only with machine code instead of architecture-independent bytecode.

https://en.wikipedia.org/wiki/Blit_(computer_terminal)

> When initially switched on, the Blit looked like an ordinary textual "dumb" terminal, although taller than usual. However, after logging into a Unix host (connected to the terminal through a serial port), the host could (via special escape sequences) load software to be executed by the processor of the terminal. This software could make use of the terminal's full graphics capabilities and attached peripherals such as a computer mouse. Normally, users would load the window systems mpx (or its successor mux), which replaced the terminal's user interface by a mouse-driven windowing interface, with multiple terminal windows all multiplexed over the single available serial-line connection to the host.

> Each window initially ran a simple terminal emulator, which could be replaced by a downloaded interactive graphical application, for example a more advanced terminal emulator, an editor, or a clock application. The resulting properties were similar to those of a modern Unix windowing system; however, to avoid having user interaction slowed by the serial connection, the interactive interface and the host application ran on separate systems—an early implementation of distributed computing.

That was 8th and 9th Edition Research Unix; it was an influence on Plan 9, which took the distributed GUI computer system concept and ran with it.

> So you could log into a remote machine and run EMACS, and while you were editing a remote file with a remote editor all the screen updating would be done by your local computer!

Also, ITS had the neat feature of detaching job trees: You could login, get your own HACTRN (the hacked-up debugger ITS used as a shell), run a few other programs which would then be children of that HACTRN job, and detach the whole tree and logout. When you logged back in, you could re-attach the tree and carry on like nothing happened. It's kinda like screen or tmux.

Re:COBOL programmers answer call by DonHopkins on Saturday April 11, 2020 @05:24AM (#22840639)
>Also, ITS had the neat feature of detaching job trees: You could login, get your own HACTRN (the hacked-up debugger ITS used as a shell), run a few other programs which would then be children of that HACTRN job, and detach the whole tree and logout. When you logged back in, you could re-attach the tree and carry on like nothing happened. It's kinda like screen or tmux.

You could also detach any particular job sub-tree, and other users could reattach it. Useful for passing a live ZORK or LISP or EMACS back and forth between different logged-in users. "Here, can you fix this please?"

There was also a :SNARF command for picking a sub-job out of a detached tree (good for snarfing just your EMACS from your old HACTRN/DDT tree left after you disconnected, and attaching it to your current DDT).

https://github.com/PDP-10/its/blob/master/src/sysen1/ddt.154...

It helped that ITS had no security whatsoever! But it had some very obscure commands, like $$^R (literally: two escapes followed by a control-R).

There was an obscure symbol that went with it called "DPSTOK" ("DePoSiT OK", presumably) that, if you set it to -1, allowed you to type $$^R to mess with other people's jobs, dynamically patch their code, etc. (The DDT top level shell had a built-in assembler/debugger, and anyone could read anybody else's job's memory, but you needed to use $$^R to enable writing).

Since ITS epitomized "security through obscurity", the magic symbol DPSTOK was never supposed to be spoken of or written down, except in the source code. But if you found and read the source code, then you passed the test, and deserved to know!

There was a trick if you wanted to set DPSTOK in your login script (which everyone could read), or if somebody was OS output spying on you (which people did all the time), and you wanted to change their prompt or patch some PDP-10 instructions into their job without them learning how to do it back to you.

The trick was to take advantage of the fact that DPSTOK happened to come right after BYERUN. So you could set BYERUN/-1, which everybody does (to run "BYE" to show a joke or funny quote when you log out), then type a line feed to go to the next address without mentioning it name, then set that to -1 anonymously.

So knowing the name and incantation of the secret symbol implied you'd actually read the DDT source code, which meant you had high moral principles, and were qualified to hate unix, which didn't let you do cool stuff like that. ;)

https://github.com/larsbrinkhoff/its-archives/blob/master/em...

    From: "Stephen E. Robbins" <[email protected]>
    Date: Thu, 21 Dec 89 13:25:56 EST
    To: CENT%[email protected]
    Subject: Where unix-haters-request is

       Date: Wed, 20 Dec 89 22:13:42 EST
       From: "Pandora B. Berman" <CENT%[email protected]>

       ....Candidates for entry into this august body must either prove their
       worth by a short rant on their pet piece of unix brain death, or produce
       witnesses of known authority to attest to their adherence to our high
       moral principles..

    Does knowing about :DDTSYM DPSTOK/-1 followed by $$^R qualify as attesting
    to adherence of high moral principles?

    - Stephen
Here are the symbols in the source:

https://github.com/PDP-10/its/blob/master/src/sysen1/ddt.154...

    BYERUN: 0 ;-1 => RUN :BYE AT LOGOUT TIME.

    DPSTOK: 0 ;-1 => $$^R OK on non-SYS jobs
Here's the $$^R handling code that slyly prints out " OP? " to pretend it didn't understand you. (In case anybody's watching!)

https://github.com/PDP-10/its/blob/master/src/sysen1/ddt.154...

    N2ACR: SKIPN SYSSW ;$$^R
          jrst n2acr0 ;  Not the system?
        SETOM SYSDPS
        jrst n2acr9

    n2acr0: skipn dpstok ;Feature enabled?
          jrst n2acr9 ;  nope
        skipe intbit(U) ;Is it foreign?
          jrst n2acr9 ;  no, either SYS (special) or our own (OK anyway!)
        movei d,%URDPS
        iorm d,urandm(u)  ;turn on winnage
    n2acr9: 7NRTYP [ASCIZ/ OP? /]