Os Chapter 01
Os Chapter 01
An OS performs as an intermediary between the user and the hardware, functioning as a virtual
computer that makes the use of the hardware more convenient and/or efficient.
◦ Describe the general organization of a computer system and the role of interrupts.
◦ Describe the components in a modern multiprocessor computer system.
◦ Illustrate the transition from user mode to kernel mode.
◦ Discuss how operating systems are used in various computing environments.
◦ Provide examples of free and open-source operating systems.
◦ 1.1.1 User View - For many personal devices, the main goal of the OS is to make the computer
easy to use.
◦ 1.1.2 System View - the computer relies on the OS to allocate, manage, and control the
resources, such as CPU time, forms of memory, and I/O devices.
◦ 1.1.3 Defining Operating Systems
▪ Operating systems first emerged as a form of automation, taking over tasks that had
previously been performed by the user, the operator, of the computer.
▪ We may think of an OS as a collection of automatic functions that make using the
hardware easier, safer, and more efficient.
▪ Usually when computer science professionals refer to the operating system, they mean
1 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
◦ Figure 1.2 in the text shows the typical components of a personal computer: a bus, CPUs,
primary memory, device controllers, and peripherals. An operating system is responsible for
operating the peripherals by sending instructions to device controllers. Different device
controllers have to be operated with their own special commands, so usually an OS has a
separate section of code called a device driver, for interacting with each different kind of device
controller.
◦ 1.2.1 Interrupts
◦ The OS tells devices what to do by sending commands through the bus to registers in the device
controllers, but how do the devices communicate with the OS??
◦ INTERRUPTS is by far the most common method.
▪ 1.2.1.1 Overview
▪ Hardware can trigger an interrupt at any time by putting a signal on the bus that is
received by the CPU.
▪ For example device controllers interrupt the CPU when they need attention from the
operating system.
2 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
▪ When the CPU receives an interrupt, it saves some information about whatever is
currently executing in the CPU, and then jumps into a part of the OS, called an
interrupt handler.
▪ The interrupt handler performs whatever actions are required to respond to the
device.
▪ The operating system is able to use saved information to resume the execution of
whatever task was interrupted.
▪ 1.2.1.2 Implementation
▪ After executing each instruction, the CPU senses the part of the bus that carries
interrupt signals, the interrupt-request line.
▪ The details of the interrupt architecture may be quite complex, employing such
features as an interrupt vector, interrupt chaining, interrupt priority levels, interrupt
preemption, and interrupt masking.
3 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
4 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
5 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
6 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
▪ Multiprocessors can run more than one sequence of instructions simultaneously. More
work can be done faster than on a uni-processor.
▪ It's a challenge for operating systems to derive the maximum benefits from a
multiprocessor, to keep all the cores doing useful work as often as possible.
▪ Multiprocessors can be more or less tightly coupled depending on how much of the
hardware resources (clock, cache, memory, component connections) they share in
common.
Figure 1.9: A dual-core design with two cores on the same chip
▪ Non-uniform memory access (NUMA) architectures tend to be easier to scale up with very
large numbers of cores, and so they are of increasing importance.
7 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
◦ Usually computer hardware is designed to automatically run a program in the ROM when the
machine is turned on. This is the bootstrap program. Some typical things it does are:
▪ Initialize the hardware,
▪ Find the operating system on disk or on a network,
▪ Copy the OS to the primary memory, and
▪ Execute the OS
◦ Many operating systems, at boot time, will start up a group of continuously running system
programs, often called daemons, to provide services.
◦ An operating system that has nothing to do will sleep or wait until a request for service arrives
(an interrupt).
◦ Interrupts can be generated by hardware or software. A software interrupt is often called a trap or
exception.
◦ 1.4.1 Multiprogramming and Multitasking
8 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
▪ The mode bit is supposed to be 0 whenever the OS is executing, and it's supposed to be 1
whenever a user process is executing. How is this assured? Well, the hardware
automatically sets the mode bit to 0 when someone turns on the computer. Therefore the
booting system always starts in kernel mode. The operating system always changes the
mode bit to 1 just before executing a user process. Therefore user processes always start up
(or resume) in user mode. Whenever there is an interrupt, the hardware automatically sets
the value of the mode bit to 0. Therefore the OS always resumes executing in kernel mode.
Finally changing the value of the mode bit is a privileged instruction, so a user process is
not able to change it from 1 to 0.
▪ Processes need to make requests for the services of the OS. For example, a processes may
request the OS to perform I/O, or to allocate some memory for a data structure. These
requests are system calls. Processes typically make system calls by executing an
instruction that causes a trap. The routine that responds to the trap then performs the
9 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
10 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
▪ Some of the caching that goes on in computers is controlled by the operating system, and
some is not.
▪ Chapter 10 covers some cache-replacement algorithms.
◦ 1.5.6 I/O System Management
▪ Chapter 12 discusses the I/O subsystem, including such things as memory management, a
general device-driver interface, and drivers for specific devices.
• 1.7 Virtualization
11 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
Figure 1.16: A computer running (a) a single operating system and (b) three virtual
machines
◦ A distributed system is a group of computers that are connected by a network in a way that
allows users to get services from all the individual computers.
◦ Some distributed systems are very transparent, which means that to use the system you only
have to be aware of the one machine in front of you. You don't have to be aware of the other
machines, or the network.
◦ Chapter 19 has information about distributed systems.
12 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
◦ 1.9.2 Trees
▪ A bitmap is just a string of bits used to keep track of resource availability. To check on the
i-th resource, examine the i-th bit. If it's 0, the resource is available. If it's 1, the resource is
not available.
13 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
▪ In computer networks, programs called clients connect to programs called servers and the
clients ask the servers to do something for them. This is how a lot of things get done on
computer networks.
▪ For example, a client on a PC can ask a server on a super computer to do a calculation that
would take too long if it was done on the PC. That is an example where the service is
computation.
▪ Networks also use the client-server paradigm for file service. A client running on a
machine with a small amount of space for files can keep most of its files on a remote
machine and get help from a server on the remote machine whenever it needs to read from,
or write to, one of the files.
◦ 1.10.4 Peer-to-Peer Computing
◦ If you start with client-server computing, but let clients be servers sometimes, and vice-versa,
then you get the idea of peer-to-peer computing.
14 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
◦ Successful applications include the file-sharing technologies of Napster and Gnutella, as well as
the voice-over-IP technology of Skype.
◦ 1.10.5 Cloud Computing
◦ When software is open-source, it means that anyone is allowed to obtain a copy of the source
code. Free software is open-source software to which additional rights are added, such as low or
no cost, permission to redistribute, possibly after modification.
◦ Often communities of users and developers associated with open source and free software spring
up. They help debug and make useful modifications to the software.
15 of 16 16-09-2021, 17:54
10th ed. chapter 01 https://www.cs.csustan.edu/~john/Classes/CS3750/Notes/Chap01/01_Int...
◦ Reading and experimenting with free and open source operating systems can be a good way to
learn about operating systems.
◦ 1.11.1 History
▪ In about the period 1950-1975, free and open source software was very common.
▪ By 1980, it was much less common. Companies had decided to try to protect their profits
by drastically limiting access to source code, and giving most customers just compiled
code.
◦ 1.11.2 Free Operating Systems
▪ In the mid 1980s, notably led by Richard Stallman, the idea was put forward that software
should be "free," not necessarily in the sense of "the price is 0," but in the sense of the
word "freedom."
▪ The four principles of this kind of free software are that users are entitled to:
1. freely run the program,
2. study and change the source code, and give or sell copies either
3. with, or
4. without changes.
▪ Stallman published a GNU Manifesto that argued all software should be "free." He also
formed a foundation called the Free Software Foundation (FSF).
▪ Nowadays "free" software can be routinely released through the GNU General Public
License (GPL).
◦ 1.11.3 GNU/Linux
▪ GNU/Linux is a free operating system released under the (GPL).
▪ The development of the software was greatly influenced by Richard Stallman and Linus
Torvalds. However there were many other contributors.
▪ There are references to Linux throughout the text, and chapter 20 is about Linux.
◦ 1.11.4 BSD UNIX
▪ BSD Unix - The flavor of unix developed at UC Berkeley - was tied to AT&T unix for
some time & required a license, but now is free of AT&T code, and is open source.
▪ There are many descendants of BSD Unix, including the Darwin kernel component code
used in the Mac OS X.
◦ 1.11.5 Solaris
▪ Solaris - originally the OS of Sun Microsystems was based on Berkeley unix. Sun
migrated to the AT&T based Solaris in the 1990s, and eventually open-sourced most of the
code it developed.
◦ 1.11. 6 Open-Source Systems as Learning Tools
▪ Open-sourcing is encouraging lots of creative projects.
▪ Computer enthusiasts of all levels can participate in the study and development of shared
software.
16 of 16 16-09-2021, 17:54