Operating Systems: Crash Course Computer Science #18 — Transcript
Full transcript
- 0:03This episode is supported by Hover.
- 0:06Hi, I'm Carrie Anne, and welcome to Crash Course Computer Science!
- 0:09Computers in the 1940s and early 50s ran one program at a time.
- 0:12A programmer would write one at their desk, for example, on punch cards.
- 0:15Then, they’d carry it to a room containing a room-sized computer, and hand it to a dedicated
- 0:19computer operator.
- 0:20That person would then feed the program into the computer when it was next available.
- 0:24The computer would run it, spit out some output, and halt.
- 0:27This very manual process worked OK back when computers were slow, and running a program
- 0:31often took hours, days or even weeks.
- 0:33But, as we discussed last episode, computers became faster... and faster... and faster
- 0:38– exponentially so!
- 0:39Pretty soon, having humans run around and inserting programs into readers was taking
- 0:43longer than running the actual programs themselves.
- 0:46We needed a way for computers to operate themselves, and so, operating systems were born.
- 0:50INTRO
- 0:59Operating systems, or OS’es for short, are just programs.
- 1:03But, special privileges on the hardware let them run and manage other programs.
- 1:07They’re typically the first one to start when a computer is turned on, and all subsequent
- 1:10programs are launched by the OS.
- 1:12They got their start in the 1950s, as computers became more widespread and more powerful.
- 1:16The very first OSes augmented the mundane, manual task of loading programs by hand.
- 1:21Instead of being given one program at a time, computers could be given batches.
- 1:25When the computer was done with one, it would automatically and near-instantly start the next.
- 1:30There was no downtime while someone scurried around an office to find the next program
- 1:33to run.
- 1:34This was called batch processing.
- 1:36While computers got faster, they also got cheaper.
- 1:38So, they were popping up all over the world, especially in universities and government
- 1:42offices.
- 1:43Soon, people started sharing software.
- 1:45But there was a problem…
- 1:46In the era of one-off computers, like the Harvard Mark 1 or ENIAC, programmers only
- 1:51had to write code for that one single machine.
- 1:53The processor, punch card readers, and printers were known and unchanging.
- 1:58But as computers became more widespread, their configurations were not always identical,
- 2:02like computers might have the same CPU, but not the same printer.
- 2:05This was a huge pain for programmers.
- 2:07Not only did they have to worry about writing their program, but also how to interface with
- 2:11each and every model of printer, and all devices connected to a computer, what are called peripherals.
- 2:16Interfacing with early peripherals was very low level, requiring programmers to know intimate
- 2:20hardware details about each device.
- 2:23On top of that, programmers rarely had access to every model of a peripheral to test their code on.
- 2:27So, they had to write code as best they could, often just by reading manuals, and hope it
- 2:32worked when shared.
- 2:33Things weren’t exactly plug-and-play back then… more plug-and-pray.
- 2:36This was clearly terrible, so to make it easier for programmers, Operating Systems stepped
- 2:40in as intermediaries between software programs and hardware peripherals.
- 2:45More specifically, they provided a software abstraction, through APIs, called device drivers.
- 2:50These allow programmers to talk to common input and output hardware, or I/O for short,
- 2:54using standardized mechanisms.
- 2:56For example, programmers could call a function like “print highscore”, and the OS would
- 3:00do the heavy lifting to get it onto paper.
- 3:02By the end of the 1950s, computers had gotten so fast, they were often idle waiting for
- 3:06slow mechanical things, like printers and punch card readers.
- 3:09While programs were blocked on I/O, the expensive processor was just chillin’... not like
- 3:13a villain… you know, just relaxing.
- 3:15In the late 50’s, the University of Manchester, in the UK, started work on a supercomputer
- 3:19called Atlas, one of the first in the world.
- 3:21They knew it was going to be wicked fast, so they needed a way to make maximal use of
- 3:25the expensive machine.
- 3:26Their solution was a program called the Atlas Supervisor, finished in 1962.
- 3:31This operating system not only loaded programs automatically, like earlier batch systems,
- 3:35but could also run several at the same time on its single CPU.
- 3:39It did this through clever scheduling.
- 3:40Let’s say we have a game program running on Atlas, and we call the function “print
- 3:44highscore” which instructs Atlas to print the value of a variable named “highscore”
- 3:48onto paper to show our friends that we’re the ultimate champion of virtual tiddlywinks.
- 3:52That function call is going to take a while, the equivalent of thousands of clock cycles,
- 3:57because mechanical printers are slow in comparison to electronic CPUs.
- 4:01So instead of waiting for the I/O to finish, Atlas instead puts our program to sleep, then
- 4:05selects and runs another program that’s waiting and ready to run.
- 4:08Eventually, the printer will report back to Atlas that it finished printing the value
- 4:12of “highscore”.
- 4:13Atlas then marks our program as ready to go, and at some point, it will be scheduled to
- 4:16run again on the CPU, and continue onto the next line of code following the print statement.
- 4:21In this way, Atlas could have one program running calculations on the CPU, while another
- 4:25was printing out data, and yet another reading in data from a punch tape.
- 4:29Atlas’ engineers doubled down on this idea, and outfitted their computer with 4 paper
- 4:34tape readers, 4 paper tape punches, and up to 8 magnetic tape drives.
- 4:38This allowed many programs to be in progress all at once, sharing time on a single CPU.
- 4:43This ability, enabled by the Operating System, is called multitasking.
- 4:46There’s one big catch to having many programs running simultaneously on a single computer, though.
- 4:51Each one is going to need some memory, and we can’t lose that program’s data when
- 4:55we switch to another program.
- 4:56The solution is to allocate each program its own block of memory.
- 4:59So, for example, let’s say a computer has 10,000 memory locations in total.
- 5:04Program A might get allocated memory addresses 0 through 999, and Program B might get 1000
- 5:10through 1999, and so on.
- 5:13If a program asks for more memory, the operating system decides if it can grant that request,
- 5:17and if so, what memory block to allocate next.
- 5:20This flexibility is great, but introduces a quirk.
- 5:23It means that Program A could end up being allocated non-sequential blocks of memory,
- 5:27in say addresses 0 through 999, and 2000 through 2999.
- 5:33And this is just a simple example - a real program might be allocated dozens of blocks
- 5:37scattered all over memory.
- 5:38As you might imagine, this would get really confusing for programmers to keep track of.
- 5:42Maybe there’s a long list of sales data in memory that a program has to total up at
- 5:46the end of the day, but this list is stored across a bunch of different blocks of memory.
- 5:50To hide this complexity, Operating Systems virtualize memory locations.
- 5:54With Virtual Memory, programs can assume their memory always starts at address 0, keeping
- 5:58things simple and consistent.
- 6:00However, the actual, physical location in computer memory is hidden and abstracted by
- 6:04the operating system.
- 6:06Just a new level of abstraction.
- 6:13Let’s take our example Program B, which has been allocated a block of memory from
- 6:17address 1000 to 1999.
- 6:21As far as Program B can tell, this appears to be a block from 0 to 999.
- 6:25The OS and CPU handle the virtual-to-physical memory remapping automatically.
- 6:29So, if Program B requests memory location 42, it really ends up reading address 1042.
- 6:36This virtualization of memory addresses is even more useful for Program A, which in our
- 6:40example, has been allocated two blocks of memory that are separated from one another.
- 6:44This too is invisible to Program A.
- 6:46As far as it can tell, it’s been allocated a continuous block of 2000 addresses.
- 6:51When Program A reads memory address 999, that does coincidentally map to physical memory
- 6:57address 999.
- 6:59But if Program A reads the very next value in memory, at address 1000, that gets mapped
- 7:03behind the scenes to physical memory address 2000.
- 7:06This mechanism allows programs to have flexible memory sizes, called dynamic memory allocation,
- 7:11that appear to be continuous to them.
- 7:13It simplifies everything and offers tremendous flexibility to the Operating System in running
- 7:18multiple programs simultaneously.
- 7:20Another upside of allocating each program its own memory, is that they’re better isolated
- 7:23from one another.
- 7:24So, if a buggy program goes awry, and starts writing gobbledygook, it can only trash its
- 7:28own memory, not that of other programs.
- 7:31This feature is called Memory Protection.
- 7:33This is also really useful in protecting against malicious software, like viruses.
- 7:37For example, we generally don’t want other programs to have the ability to read or modify
- 7:41the memory of, let say, our email, with that kind of access, malware could send emails
- 7:45on your behalf and maybe steal personal information.
- 7:48Not good!
- 7:49Atlas had both virtual and protected memory.
- 7:51It was the first computer and OS to support these features!
- 7:54By the 1970s, computers were sufficiently fast and cheap.
- 7:58Institutions like a university could buy a computer and let students use it.
- 8:02It was not only fast enough to run several programs at once, but also give several users
- 8:06simultaneous, interactive access.
- 8:09This was done through a terminal, which is a keyboard and screen that connects to a big
- 8:13computer, but doesn’t contain any processing power itself.
- 8:16A refrigerator-sized computer might have 50 terminals connected to it, allowing up to
- 8:2150 users.
- 8:22Now operating systems had to handle not just multiple programs, but also multiple users.
- 8:27So that no one person could gobble up all of a computer's resources, operating systems
- 8:30were developed that offered time-sharing.
- 8:32With time-sharing each individual user was only allowed to utilize a small fraction of
- 8:37the computer’s processor, memory, and so on.
- 8:39Because computers are so fast, even getting just 1/50th of its resources was enough for
- 8:44individuals to complete many tasks.
- 8:45The most influential of early time-sharing Operating Systems was Multics, or Multiplexed
- 8:50Information and Computing Service, released in 1969.
- 8:54Multics was the first major operating system designed to be secure from the outset.
- 8:58Developers didn’t want mischievous users accessing data they shouldn't, like students
- 9:02attempting to access the final exam on their professor’s account.
- 9:05Features like this meant Multics was really complicated for its time, using around 1 Megabit
- 9:10of memory, which was a lot back then!
- 9:12That might be half of a computer's memory, just to run the OS!
- 9:15Dennis Ritchie, one of the researchers working on Multics, once said:
- 9:18“One of the obvious things that went wrong with Multics as a commercial success was just
- 9:23that it was sort of over-engineered in a sense.
- 9:25There was just too much in it.”
- 9:26T his lead Dennis, and another Multics researcher,
- 9:28Ken Thompson, to strike out on their own and build a new, lean operating system… called Unix.
- 9:33They wanted to separate the OS into two parts:
- 9:36First was the core functionality of the OS, things like memory management, multitasking,
- 9:40and dealing with I/O, which is called the kernel.
- 9:43The second part was a wide array of useful tools that came bundled with, but not part
- 9:47of the kernel, things like programs and libraries.
- 9:49Building a compact, lean kernel meant intentionally leaving some functionality out.
- 9:53Tom Van Vleck, another Multics developer, recalled:
- 9:55“I remarked to Dennis that easily half the code I was writing in Multics was error recovery
- 10:00code."
- 10:01He said, "We left all that stuff out of Unix.
- 10:03If there's an error, we have this routine called panic, and when it is called, the machine
- 10:07crashes, and you holler down the hall, 'Hey, reboot it.'"”
- 10:11You might have heard of kernel panics, This is where the term came from.
- 10:14It’s literally when the kernel crashes, has no recourse to recover, and so calls a
- 10:18function called “panic”.
- 10:19Originally, all it did was print the word “panic” and then enter
- 10:22an infinite loop.
- 10:24This simplicity meant that Unix could be run on cheaper and more diverse hardware, making
- 10:28it popular inside Bell Labs, where Dennis and Ken worked.
- 10:31As more developers started using Unix to build and run their own programs, the number of
- 10:34contributed tools grew.
- 10:36Soon after its release in 1971, it gained compilers for different programming languages
- 10:41and even a word processor, quickly making it one of the most popular OSes of the 1970s
- 10:45and 80s.
- 10:46At the same time, by the early 1980s, the cost of a basic computer had fallen to the
- 10:50point where individual people could afford one, called a personal or home computer.
- 10:55These were much simpler than the big mainframes found at universities, corporations, and governments.
- 10:59So, their operating systems had to be equally simple.
- 11:02For example, Microsoft’s Disk Operating System, or MS-DOS, was just 160 kilobytes,
- 11:07allowing it to fit, as the name suggests, onto a single disk.
- 11:10First released in 1981, it became the most popular OS for early home computers, even
- 11:15though it lacked multitasking and protected memory.
- 11:18This meant that programs could, and would, regularly crash the system.
- 11:22While annoying, it was an acceptable tradeoff, as users could just turn their own computers
- 11:26off and on again!
- 11:27Even early versions of Windows, first released by Microsoft in 1985 and which dominated the
- 11:32OS scene throughout the 1990s, lacked strong memory protection.
- 11:35When programs misbehaved, you could get the blue screen of death, a sign that a program
- 11:40had crashed so badly that it took down the whole operating system.
- 11:43Luckily, newer versions of Windows have better protections and usually don't crash that often.
- 11:48Today, computers run modern operating systems, like Mac OS X, Windows 10, Linux, iOS and
- 11:53Android.
- 11:54Even though the computers we own are most often used by just a single person, you! their
- 11:58OSes all have multitasking and virtual and protected memory.
- 12:02So, they can run many programs at once: you can watch YouTube in your web browser, edit
- 12:06a photo in Photoshop, play music in Spotify and sync Dropbox all at the same time.
- 12:12This wouldn’t be possible without those decades of research and development on Operating
- 12:16Systems, and of course the proper memory to store those programs.
- 12:19Which we’ll get to next week.
- 12:21I’d like to thank Hover for sponsoring this episode.
- 12:24Hover is a service that helps you buy and manage domain names.
- 12:27Hover has over 400 domain extensions to end your domain with - including .com and .net.
- 12:32You can also get unique domains that are more professional than a generic address.
- 12:35Here at Crash Course, we'd get the domain name “mongols.fans” but I think you know
- 12:40that already.
- 12:41Once you have your domain, you can set up your custom email to forward to your existing
- 12:44email address -- including Outlook or Gmail or whatever you already use.
- 12:48With Hover, you can get a custom domain and email address for 10% off.
- 12:52Go to Hover.com/crashcourse today to create your custom domain and help support our show!
About this transcript
This page contains the full transcript of Operating Systems: Crash Course Computer Science #18 by CrashCourse, generated from the public captions YouTube serves with the video. The transcript has 2,489 words across 222 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.