Remix.run Logo
A brief history of threads and threading(eclecticlight.co)
79 points by emschwartz 17 hours ago | 21 comments
tankenmate 16 hours ago | parent | next [-]

When I saw the subject line I thought maybe we'd get an interesting article about OS/360 or something, but then found an article about Macs; interesting but not expected.

Animats 15 hours ago | parent [-]

Right.

As far as I know, the first operating system to have threads was UNIVAC 1108 EXEC 8, first released in 1966.[1] They were called "activities". A program launched with one activity, and could start others with a FORK call. There were locks, with hardware support for an atomic Test and Set instruction. Activities had priorities, and there was a good scheduler. Threads exited with an EXIT call, and when the last thread exited, so did the program. No main thread. There were timed waits, explicit waits for an event, and even async I/O with callbacks. Multiprocessors were supported. In 1966.

It's still in use, as OS/2200. [2]

[1] https://ia803206.us.archive.org/11/items/bitsavers_univac110...

[2] https://www.unisys.com/siteassets/collateral/pi-sheet/pi-060...

TZubiri 12 hours ago | parent [-]

That sounds like a process, processes are scheduled by the operating system. Threads are not, they are scheduled by an application.

Animats 10 hours ago | parent | next [-]

No, activities (threads) were totally scheduled by the operating system. This was not cooperative multitasking. All those activities are in the same address space.

Here's Dijkstra's P and V, implemented for EXEC 8 by John Walker, who later wrote AutoCAD. These are user space primitives built on top of the OS primitives ACT$ and DACT$. This is part of an application called FANG, an overdesigned utility for doing various copies with as much parallelism as possible.

I once modified a Pascal compiler for that system to support multi-threading. I could get about a hundred activities going.

The main difference from threads today is that there's no concept of a stack. There can be a heap allocator, and you can save state, but the whole concept of a stack is absent.

Animats 8 hours ago | parent [-]

Ref: https://www.fourmilab.ch/documents/univac/fang/hsource/sched...

Veserv 12 hours ago | parent | prev | next [-]

No, you are not using the standard definition of a thread [1]. What you are calling a thread would normally be called a userspace thread, green thread, fiber, stackful coroutine, etc. Note the specific qualifiers distinguishing them from the overarching concept of a thread which can be broadly classified as a scheduled instruction stream.

edit: Just to be clear, "thread" is itself also just one of many names for the general concept. Task, Activity, Actor, etc. may be used, but they might also refer to something completely different. It is really a question of checking that the properties of the named thing match the properties of the standard definition of a "thread".

[1] https://en.wikipedia.org/wiki/Thread_(computing)

TZubiri 4 hours ago | parent [-]

you are right, I guess the main difference is whether the process or thread has its own memory or not, if it does it's a process, if it shares memory, it's a thread.

anyfoo 12 hours ago | parent | prev [-]

Processes aren’t scheduled by the OS, threads are. But many processes only consist of one thread, so there’s only one thing to schedule. Processes are commonly a collection of threads with a single shared address space among them.

cryptonector 9 hours ago | parent [-]

Processes were scheduled by the OS back when there were only processes (e.g., in Unix). Today processes are collections of one or more threads (or zero if e.g. a zombie) that are scheduled by the OS.

foofoo12 3 hours ago | parent | prev | next [-]

I though it was about machining threads on screws. If you did too and found it exciting, you'll find this book exciting too:

Exactly: How Precision Engineers Created the Modern World

https://www.amazon.co.uk/Exactly-Precision-Engineers-Created...

pechay 3 hours ago | parent | prev | next [-]

It's worth pointing out the Commodore Amiga had proper pre-emptive multitasking on a single M68000 all the way back in July '85

kergonath 5 hours ago | parent | prev | next [-]

> Its first Macs with dual processors came in PowerPC 7400 (G4) chips in Power Mac G4 desktop systems

AFAIK the first multiprocessor Power Mac was the 9500/180MP, with two 604e.

dboreham 4 hours ago | parent [-]

Plus, threading has pretty much nothing to do with SMP.

dboreham 4 hours ago | parent | prev | next [-]

Quick note that this article is not a general history of threading. It's only about Apple operating systems, which are about the most backward thing you could pick to look at threading. NT or VMS or even Solaris would make a better choice.

Yoric 4 hours ago | parent [-]

I had a friend exploring expanding the Solaris kernel to provide M:N scheduling to applications, back in the late 90s. I guess kind of a predecessor to Grand Central Dispatch on macOS?

felixgallo an hour ago | parent [-]

Solaris had a variety of M:N options in the early-to-mid 90s, including libthread and pthreads, all of which were precursors to GCD as you say.

srean 8 hours ago | parent | prev | next [-]

There was a green threads library that came out off Apache Web server redesign exploration. Few days ago I was trying to recall the name and find the repo but couldn't.

Does anyone remember?

mikejulietbravo 12 hours ago | parent | prev | next [-]

was just glad this wasn't about twitter :)

contingencies 13 hours ago | parent | prev [-]

I was hoping for something more like https://baer.tools/en/blog/a-brief-history-of-the-thread-fro...

codethief 12 hours ago | parent [-]

As a non-native English speaker it took me quite a while to figure out what kind of thread they are talking about. :)

dented42 11 hours ago | parent [-]

As a native English speaker it likewise took me quite a while to figure out Andy kind of thread they are talking about. ;)