Page 5: The Software Domain: Operating Systems

Unit 6, Lab 1, Page 5

On this page, you’ll learn about the software that directly manages the computer’s hardware, the operating system.

Your computer came with an operating system (OS) installed. Operating systems are the underlying programs that your apps interact with to communicate with the computer. For computers with keyboards, it’s probably Linux, macOS, or Windows. For phones and tablets, it’s probably Android or iOS.

Roughly speaking, the operating system handles the basic tasks that your applications depend on, including:

In a computer, there are many applications and operating system tasks all wanting to run at once. Every operating system has a kernel that manages when all these processes run.

The Kernel

The kernel deals directly with hardware (keyboard, mouse, microphone, camera, hard drives, memory, printer, speakers, screen, etc.). So the kernel is generally written in a low level language so it can control that hardware. It handles several important tasks:

  • Scheduling. The kernel has access to the time clock that’s built into the hardware and lets each program run for a small amount of time (typically about 1/10 second) and then switches to the next program in line.
  • Security. Those many application programs may have bugs or malicious code. The kernel, which has access to the memory where programs and data are stored, ensures that each program is assigned a separate location in memory and doesn’t interfere with other programs. The kernel also controls which data files a program can use based on file protection settings that users or applications specify for each file.
  • Input and output. Many devices can be attached to your computer. The kernel knows how the computer’s hardware reads or writes to each device. Only the kernel is allowed direct access to these devices, and it carries out authorized transfers of information for the applications.

These days, OS kernels are remarkably similar. Of the five systems listed earlier (Linux, macOS, Windows, Android, and iOS), four of them (all but Windows) are based on variants of a single kernel, called Unix.

Read more about Unix.

(“Unix” is a trademark, currently owned by The Open Group, and not all of the variants discussed here are authorized to use that name, but they all provide essentially the same program interface.) Unix was created around 1970 by Ken Thompson and Dennis Ritchie at AT&T Bell Laboratories.

Prior to Unix, almost everyone thought that an operating system had to be developed for a particular computer architecture, and had to be written in the machine language of that computer, the very low-level instructions that the hardware understands directly. The first version of Unix was also written in the machine language of a particular computer, the Digital Equipment Corporation PDP-7. But the Unix developers knew that the PDP-7 wasn’t the only computer in the world, and better ones would come along, so they wanted to make Unix portable, meaning that it could be brought to a new computer architecture without a complete rewrite. So in 1972 Dennis Ritchie invented the C programming language for that purpose. C is similar to other languages available at the time, but with one added feature: a C programmer can read or write any individual byte of the program’s memory by knowing its address, a number that distinguishes it from other bytes. (You can see that this feature is quite the opposite from high level abstraction. It is useful only to a programmer who’s thinking in detail about what’s where in the computer’s memory.) Unix was then rewritten in C.

Because of its portability, Unix spread quickly to many computer architectures. Researchers at Berkeley developed a version, based on the AT&T version, with virtual memory, the ability to run a program that’s only partly in the computer’s main memory, with the rest kept on a disk. This Berkeley version is an ancestor of Apple’s operating systems, macOS (since macOS 10.0) and iOS. (An Apple computer doesn’t behave anything like a Unix computer, but the differences are almost all in application-level programs, not in the kernel.) Android, Google’s operating system for cell phones and tablets, is based on Linux, a complete rewrite of Unix originally written by Linus Torvalds, who was, at the time, a computer science student in Finland.

The application-level programs that were part of the original Unix package have, in most systems, been replaced with rewritten programs from the Free Software Foundation’s GNU (an acronym for Gnu’s Not Unix) package.

  1. Explore the programs running on your computer right now.

    1. Find out how to list all the programs that are running right now on your computer, and collect such a program list in a text file.
    2. Count how many of them are programs you asked the computer to run.
    3. Of the rest, can you figure out from the names what they do?
    4. Which ones are part of the operating system (not the OS kernel)?
    5. See if you can figure out the purpose of some oddly-named ones by doing a web search.