2- Introduction to Operating Systems

10 November 2023

12 Viewed 12

If you are taking an undergraduate operating systems course, you should already have some idea of what a computer program does when it runs. If not, this book (and the corresponding course) is going to be difficult so you should probably stop reading this book, or run to the near- est bookstore and quickly consume the necessary background material before continuing (both Patt & Patel (PPC3] and Bryant & O'Hallaron[BOH10] are pretty great books). So what happens when a program runs?

Well, a running program does one very simple thing: it executes in- structions. Many millions (and these days, even billions) of times ev ery second, the processor fetches an instruction from memory, decodes it (Le.. figures out which instruction this is), and executes it (ie., it does the thing that it is supposed to do, like add two numbers together, access memory, check a condition, jump to a function, and so forth). After it is done with this instruction, the processor moves on to the next instruction, and so on, and so on, until the program finally completes'[1] 

Thus, we have just described the basics of the Von Neumann model of computing [2] . Sounds simple, right? But in this class, we will be leaming that while a program runs, a lot of other wild things are going on with the primary goal of making the system easy to use.

There is a body of software, in fact, that is responsible for making it easy to run programs (even allowing you to seemingly run many at the same time), allowing programs to share memory, enabling programs to interact with devices, and other fun stuff like that. That body of software

[1] Of course, modem processors do many bizarre and frightening things underneath the hood to malar programmuster, guling multiple intructions, and even i ing and completing them out of order! But that is not our concem here we am just concerned with the sample model most programs assume that instructions seemingly execute one at a main an orderly and sequential fashion

[2] Von Neum was me of the only pics of computing systems. He also did pioneer ing work on game theory and atomic humb and played in the NBA or yours. OK, me those things isn't true



One central question we will answer in this book is quite simple: how does the operating system virtualize resources? This is the crux of our problem. Why the OS does this is not the main question, as the answer should be obvious: it makes the system easier to use. Thus, we focus on the how what mechanisms and policies are implemented by the OS to attain virtualization How does the OS do so efficiently? What hardware support is needed?)

We will use the "crux of the problem", in shaded boxes such as this one, as a way to call out specific problems we are trying to solve in building an operating system. Thus, within a note on a particular topic, you may find one or more cruces (yes, this is the proper plural) which highlight the problem. The details within the chapter, of course, present the solution, or at least the basic parameters of a solution.

is called the operating system (OS)[3]  , as it is in charge of making sure the system operates correctly and efficiently in an easy-to-use manner.

The primary way the OS does this is through a general technique that we call virtualization. That is, the OS takes a physical resource (such as the processor, or memory, or a disk) and transforms it into a more gen- eral, powerful, and easy-to-use virtual form of itself. Thus, we sometimes refer to the operating system as a virtual machine.

Of course, in order to allow users to tell the OS what to do and thus make use of the features of the virtual machine (such as running a pro- gram, or allocating memory, or accessing a file), the OS also provides some interfaces (APIs) that you can call. A typical OS, in fact, exports a few hundred system calls that are available to applications. Because the OS provides these calls to run programs, access memory and devices, and other related actions, we also sometimes say that the OS provides a

standard library to applications. Finally, because virtualization allows many programs to run (thus shar- ing the CPU), and many programs to concurrently access their own in- structions and data (thus sharing memory), and many programs to access devices (thus sharing disks and so forth), the OS is sometimes known as a resource manager. Each of the CPU, memory, and disk is a resource of the system; it is thus the operating system's role to manage those resources, doing so efficiently or fairly or indeed with many other possible guals in mind. To understand the role of the OS a little bit better, let's take a look at some examples.

[3] Another early name for the OS was the supervisor or even the master control program. Apparently, the latter sunbed a little verzaken (that man Tram for details) anal thus, thanktully "operating system caught on instead.

More Books by Remzi H. Arpaci-Dusseau, Andrea Arpaci-Dusseau's

Operating Systems: Three Easy Pieces
"Operating Systems: Three Easy Pieces" is a textbook co-authored by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau. The book is designed to introduce fundamental concepts in operating systems in a clear and accessible manner. It's noteworthy for being freely available online, making it a widely used resource in computer science education. Key features of the book include: Structure and Topics: The book is divided into three main parts, covering virtualization, concurrency, and persistence. Each part addresses essential aspects of operating systems, from the basics to more advanced concepts. Accessibility: The authors aim to make complex topics easy to understand for readers. The book is known for its clear explanations, examples, and practical approach to teaching operating systems concepts. Online Availability: The authors have chosen to provide the book for free online, making it accessible to a wide audience. This decision has contributed to its popularity as a resource for students and educators. Use in Education: "Operating Systems: Three Easy Pieces" is often used as a textbook in operating systems courses at various academic institutions. Its availability online has made it a convenient resource for instructors and students alike. The book covers a range of topics, including virtualization, process management, file systems, and more. It is designed to be used in conjunction with hands-on exercises and programming assignments to reinforce the theoretical concepts discussed in the text.