I wonder which was the first operating system that had context switch and what are famous examples of OS that didn't have context switch?

  • 9
    Define context switch. Any system that supports interrupts does context switching, and on a conceptual level, using WordStar for an hour and another hour Multiplan on a CP/M machine is a context switch as well. Even a pocket calculator that has "M+" and "RM" keys supports context switching on a conceptual level. As it is now, there cannot be a definitive answer to this question.
    – tofro
    Aug 1 '17 at 11:48
  • 2
    Even a device as simple as an Abacus supports the concept of context switching.
    – tofro
    Aug 1 '17 at 11:56
  • 1
    An Abacus was able to do that, as mentioned above
    – tofro
    Aug 1 '17 at 20:21
  • 1
    @tofro How do you do context switching with an abacus? Take a photo of it?
    – JeremyP
    Sep 4 '17 at 8:46
  • 2
    @JeremyP For example. Or just use another set of rows, leaving the ones you just have worked with alone for a while.
    – tofro
    Sep 4 '17 at 8:54

The first operating system to implement context switches as we understand them today was the Atlas supervisor. Quoting T. Kilburn, R. B. Payne and D. J. Howarth’s 1961 paper on The Atlas Supervisor (printed in AFIPS Computer Conference 20 and in Per Brinch Hansen’s Classic Operating Systems):

While one program is halted, awaiting completion of a magnetic tape transfer for instance, the co-ordinator routine switches control to the next program in the object program list which is free to proceed. In order to maintain full protection, it is necessary to preserve and recover the contents of working registers common to all programs such as the B-lines, accumulator, and control registers, and to protect blocks in use in core store.

The idea itself was first described by Christopher Strachey in his 1959 paper, Time sharing in large, fast computers; the main purpose was to allow computers to switch tasks when one task was blocked waiting on I/O. Interactive task-switching followed shortly; the first demonstration of that was CTSS in 1962 (this is what ended up being known as time-sharing; Strachey’s concept is referred to as multi-programming). In fact John McCarthy floated the idea of time-sharing in an unpublished memo dated January 1, 1959, so both concepts were contemporaneous.

Strictly speaking any operating system which supports hardware interrupts has to support some form of context switching, even if it is strictly single-tasking (like MS-DOS). So the only operating systems which didn’t have any form of context switching were the few batch processing operating systems in the late ’50s such as BKS on the Philco-2000.

Context switching arguably pre-dates operating systems, or rather, there were computers without operating systems designed as such which nevertheless supported context switches: the X—1, built at the Mathematical Centre in Amsterdam, supported interrupt-driven I/O, and it was demonstrated with a small coordination program used to switch between two running programs, one CPU-limited, the other I/O-limited.

Another outcome of the interruption facility is that it is quite easy to run two programs at the same time. This was rather a strange sight when we tried it the first time, and we were very astonished to find that the system worked.

  • 1
    +1 for the Atlas. My supervisor at University cut his academic teeth on the Atlas. In fact, the Atlas is usually the answer for these "what was the first computer to..." questions.
    – JeremyP
    Aug 1 '17 at 8:46
  • @JeremyP yup, and it’s been mentioned here before, see What was the first operating system to feature a separate kernel? ;-). Aug 1 '17 at 9:14
  • 1
    An interrupt handler only needs to save what the interrupt handler will trample on, so can be a good deal simpler than a full context switch. Nov 6 '19 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.