0% found this document useful (0 votes)
14 views78 pages

1. Introduction OS Concept 10E (1)

Uploaded by

ameeraroslan550
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views78 pages

1. Introduction OS Concept 10E (1)

Uploaded by

ameeraroslan550
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

1.

1 What operating systems do

Introduction

©zyBooks 10/20/22 18:14 1496583


Overview Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

An operating system acts as an intermediary between the user of a computer and


the computer hardware. The purpose of an operating system is to provide an
environment in which a user can execute programs in a convenient and efficient
manner.

An operating system is software that manages the computer hardware. The


hardware must provide appropriate mechanisms to ensure the correct operation of
the computer system and to prevent programs from interfering with the proper
operation of the system.

Internally, operating systems vary greatly in their makeup, since they are organized
along many different lines. The design of a new operating system is a major task,
and it is important that the goals of the system be well defined before the design
begins.

Because an operating system is large and complex, it must be created piece by


piece. Each of these pieces should be a well-delineated portion of the system, with
carefully defined inputs, outputs, and functions.

An operating system is software that manages a computer's hardware. It also provides a basis for
application programs and acts as an intermediary between the computer user and the computer
hardware. An amazing aspect of operating systems is how they vary in accomplishing these tasks
in a wide variety of computing environments. Operating systems are everywhere, from cars and
home appliances that include "Internet of Things" devices, to smart phones, personal computers,
enterprise computers, and cloud computing environments.

In order to explore the role of an operating system in a modern computing environment, it is


©zyBooks 10/20/22 18:14 1496583
important first to understand the organization and architecture of computer hardware.
Noraisyah This
Abdl Aziz
AbdlAzizOSCOct2022
includes the CPU, memory, and I/O devices, as well as storage. A fundamental responsibility of an
operating system is to allocate these resources to programs.
Because an operating system is large and complex, it must be created piece by piece. Each of
these pieces should be a well-delineated portion of the system, with carefully defined inputs,
outputs, and functions. In this chapter, we provide a general overview of the major components of
a contemporary computer system as well as the functions provided by the operating system.
Additionally, we cover several topics to help set the stage for the remainder of the text: data
structures used in operating systems, computing environments, and open-source and free
operating systems.

Chapter objectives

©zyBooks 10/20/22 18:14 1496583


Describe the general organization of a computer system and the role Abdl
Noraisyah of Aziz
interrupts. AbdlAzizOSCOct2022
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.

Section glossary

operating system: A program that manages a computer's hardware, provides a


basis for application programs, and acts as an intermediary between the computer
user and the computer hardware.

What operating systems do


We begin our discussion by looking at the operating system's role in the overall computer system.
A computer system can be divided roughly into four components: the hardware, the operating
system, the application programs, and a user (Figure 1.1.1).

Figure 1.1.1: Abstract view of the components of a computer system.


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

The hardware—the central processing unit (CPU), the memory, and the input/output (I/O) devices—
provides the basic computing resources for the system. The application programs—such as word
processors, spreadsheets, compilers, and web browsers—define the ways in which these
resources are used to solve users' computing problems. The operating system controls the
hardware and coordinates its use among the various application programs for the various users.

We can also view a computer system as consisting of hardware, software, and data. The operating
system provides the means for proper use of these resources in the operation of the computer
system. An operating system is similar to a government. Like a government, it performs no useful
function by itself. It simply provides an environment within which other programs can do useful
work.
To understand more fully the operating system's role, we next explore operating systems from two
viewpoints: that of the user and that of the system.

User view

The user's view of the computer varies according to the interface being used. Many computer
users sit with a laptop or in front of a PC consisting of a monitor, keyboard, and mouse. Such a
system is designed for one user to monopolize its resources. The goal is to maximize the work (or
play) that the user is performing. In this case, the operating system is designed mostly for ease of
use, with some attention paid to performance and security and none paid to resource utilization—
how various hardware and software resources are shared. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
Increasingly, many users interact with mobile devices such as smartphones and tablets—devices
AbdlAzizOSCOct2022
that are replacing desktop and laptop computer systems for some users. These devices are
typically connected to networks through cellular or other wireless technologies. The user interface
for mobile computers generally features a touch screen, where the user interacts with the system
by pressing and swiping fingers across the screen rather than using a physical keyboard and
mouse. Many mobile devices also allow users to interact through a voice recognition interface,
such as Apple's Siri.
Some computers have little or no user view. For example, embedded computers in home devices
and automobiles may have numeric keypads and may turn indicator lights on or off to show status,
but they and their operating systems and applications are designed primarily to run without user
intervention.

System view

From the computer's point of view, the operating system is the program most
©zyBooks intimately
10/20/22 involved
18:14 1496583
with the hardware. In this context, we can view an operating system as Noraisyah
a resourceAbdl Aziz
allocator. A
AbdlAzizOSCOct2022
computer system has many resources that may be required to solve a problem: CPU time, memory
space, storage space, I/O devices, and so on. The operating system acts as the manager of these
resources. Facing numerous and possibly conflicting requests for resources, the operating system
must decide how to allocate them to specific programs and users so that it can operate the
computer system efficiently and fairly.
A slightly different view of an operating system emphasizes the need to control the various I/O
devices and user programs. An operating system is a control program. A control program
manages the execution of user programs to prevent errors and improper use of the computer. It is
especially concerned with the operation and control of I/O devices.

Defining operating systems

By now, you can probably see that the term operating system covers many roles and functions.
That is the case, at least in part, because of the myriad designs and uses of computers.
Computers are present within toasters, cars, ships, spacecraft, homes, and businesses. They are
the basis for game machines, cable TV tuners, and industrial control systems.

To explain this diversity, we can turn to the history of computers. Although computers have a
relatively short history, they have evolved rapidly. Computing started as an experiment to determine
what could be done and quickly moved to fixed-purpose systems for military uses, such as code
breaking and trajectory plotting, and governmental uses, such as census calculation. Those early
computers evolved into general-purpose, multifunction mainframes, and that's when operating
systems were born. In the 1960s, Moore's Law predicted that the number of transistors on an
integrated circuit would double every 18 months, and that prediction has held true. Computers
gained in functionality and shrank in size, leading to a vast number of uses and a vast number and
variety of operating systems. (See Appendix A for more details on the history of operating
systems.)

How, then, can we define what an operating system is? In general, we have no completely
adequate definition of an operating system. Operating systems exist because they offer a
©zyBooks 10/20/22 18:14 1496583
reasonable way to solve the problem of creating a usable computing system. TheAbdl
Noraisyah fundamental
Aziz
AbdlAzizOSCOct2022
goal of computer systems is to execute programs and to make solving user problems easier.
Computer hardware is constructed toward this goal. Since bare hardware alone is not particularly
easy to use, application programs are developed. These programs require certain common
operations, such as those controlling the I/O devices. The common functions of controlling and
allocating resources are then brought together into one piece of software: the operating system.

In addition, we have no universally accepted definition of what is part of the operating system. A
simple viewpoint is that it includes everything a vendor ships when you order "the operating
system." The features included, however, vary greatly across systems. Some systems take up less
than a megabyte of space and lack even a full-screen editor, whereas others require gigabytes of
space and are based entirely on graphical windowing systems. A more common definition, and the
one that we usually follow, is that the operating system is the one program running at all times on
the computer—usually called the kernel. Along with the kernel, there are two other types of
programs: system programs, which are associated with the operating system but are not
necessarily part of the kernel, and application programs, which include all programs not associated
with the operation of the system. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
There are also awkward bits of code that defy categorization. Device drivers for example manage
hardeware devices, run within the kernel, but are frequently provided by the hardware
manufacturer. They are arguably part of the operating system or possibly thought of as being a
layer between the hardware and the operating system. Another confusion comes from loadable
kernel modules. These chunks of compiled code sometimes come with the operating system (for
example, a non-default file system) and are automatically loaded by the system as needed.
Sometimes the system administrator adds and can manage these modules (for example, adding a
file system that doesn't ship with the operating system). So here we have a component running
within the operating system that didn't ship with it.

Further complicating the definition of an operating system is the difference between common
understanding and reality. Most people think of their computer as running \quoted{an operating
system}. But if we define an operating system as constantly running, and managing hardware, then
we need to consider the \bf{many} operating systems running on a common computer. The \CPU\
has firmware{\mdash} software embedded in the hardware{\mdash} the motherboard has \BIOS\
code that boots and manages it, and devices have firmware managing their functionality. In reality,
there might be more code running in these other operating systems than in the main general-
purpose operating system. We discuss some of these aspects further in this book but mostly
constrain coverage to the general-purpose operating system.
So, where does that leave us in our quest to define a general-purpose computer's
\quoted{operating system}? A reasonable summary is that the operating system is inclusive of the
kernel that is loaded at boot time, any device drivers and kernel functions loaded at run time, and
any system programs related to the operation of the system (as opposed to applications). The
operating system is the piece of software that sits between the hardware and applications,
providing a set of services to the computer and users, and is not part of the firmware or hardware
logic.
The matter of what constitutes an operating system became increasingly important as personal
computers became more widespread and operating systems grew increasingly sophisticated. In
1998, the United States Department of Justice filed suit against Microsoft, in essence claiming that
©zyBooks 10/20/22 18:14 1496583
Microsoft included too much functionality in its operating systems and thus prevented application
Noraisyah Abdl Aziz
vendors from competing. (For example, a web browser was an integralAbdlAzizOSCOct2022
part of Microsoft's
operating systems.) As a result, Microsoft was found guilty of using its operating-system
monopoly to limit competition.

Today, however, if we look at operating systems for mobile devices, we see that once again the
number of features constituting the operating system is increasing. Mobile operating systems
often include not only a core kernel but also middleware—a set of software frameworks that
provide additional services to application developers. For example, each of the two most
prominent mobile operating systems—Apple's IOS and Google's Android—features a core kernel
along with middleware that supports databases, multimedia, and graphics (to name only a few).

Why study operating systems?

Although there are many practitioners of computer science,©zyBooks


only a small
10/20/22 18:14 1496583
percentage of them will be involved in the creation or modificationNoraisyah Abdl Aziz
of an operating
AbdlAzizOSCOct2022
system. Why, then, study operating systems and how they work? Simply because,
as almost all code runs on top of an operating system, knowledge of how operating
systems work is crucial to proper, efficient, effective, and secure programming.
Understanding the fundamentals of operating systems, how they drive computer
hardware, and what they provide to applications is not only essential to those who
program them but also highly useful to those who write programs on them and use
them.

In summary, for our purposes, the operating system includes the always-running kernel,
middleware frameworks that ease application development and provide features, and system
programs that aid in managing the system while it is running. Most of this text is concerned with
the kernel of general-purpose operating systems, but other components are discussed as needed
to fully explain operating system design and operation.

PARTICIPATION
ACTIVITY 1.1.1: Section review questions.

1) ___ is a software framework that


provides additional services (to those
provided by an operating system) to
application developers.
System programs
Kernel
Middleware

©zyBooks 10/20/22 18:14 1496583


Section glossary Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

hardware: The CPU, memory devices, input/output (I/O) devices, and any other
physical components that are part of a computer.

application program: A program designed for end-user execution, such as a word


processor, spreadsheet, compiler, or Web browser.
ease of use: The amount of difficulty and complexity involved in using some aspect
of computing.

resource utilization: The amount of a given resource (hardware or software) that is


being used.

touch screen: A touch-sensitive screen used as a computer input device.


voice recognition: A computer interface based on spoken commands, which the
©zyBooks 10/20/22 18:14 1496583
computer parses and turns into actions. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Siri: The Apple voice-recognition system.
embedded computer: A computer system within some other, larger system (such
as a car) that performs specific, limited functions and has little or no user interface.
resource allocator: An operating system or application that determines how
resources are to be used.

control program: A program that manages the execution of user programs to


prevent errors and improper use of the computer. It is especially concerned with
the operation and control of I/O devices.

Moore's Law: A law predicting that the number of transistors on an integrated


circuit would double every eighteen months.

kernel: The operating system component running on the computer at all times
after system boot.
system program: A program associated with the operating system but not
necessarily part of the kernel.
middleware: A set of software frameworks that provide additional services to
application developers.

1.2 Computer-system organization


A modern general-purpose computer system consists of one or more CPUs and a number of
device controllers connected through a common bus that provides access10/20/22
©zyBooks between18:14
components
1496583
Noraisyah Abdl Aziz
and shared memory (Figure 1.2.1). Each device controller is in charge of a specific type of device
AbdlAzizOSCOct2022
(for example, a disk drive, audio device, or graphics display). Depending on the controller, more
than one device may be attached. For instance, one system USB port can connect to a USB hub, to
which several devices can connect. A device controller maintains some local buffer storage and a
set of special-purpose registers. The device controller is responsible for moving the data between
the peripheral devices that it controls and its local buffer storage.

Fi 121 At i l PC t t
Figure 1.2.1: A typical PC computer system.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Typically, operating systems have a device driver for each device controller. This device driver
understands the device controller and provides the rest of the operating system with a uniform
interface to the device. The CPU and the device controllers can execute in parallel, competing for
memory cycles. To ensure orderly access to the shared memory, a memory controller
synchronizes access to the memory.

In the following subsections, we describe some basics of how such a system operates, focusing
on three key aspects of the system. We start with interrupts, which alert the CPU to events that
require attention. We then discuss storage structure and I/O structure.

Interrupts

Consider a typical computer operation: a program performing I/O. To start an I/O operation, the
device driver loads the appropriate registers in the device controller. The device controller, in turn,
examines the contents of these registers to determine what action to take (such as "read a
character from the keyboard"). The controller starts the transfer of data from the device to its local
buffer. Once the transfer of data is complete, the device controller informs the device driver that it
has finished its operation. The device driver then gives control to other parts of the operating
system, possibly returning the data or a pointer to the data if the operation was a read. For other
operations, the device driver returns status information such as "write completed successfully" or
©zyBooks 10/20/22 18:14 1496583
"device busy". But how does the controller inform the device driver that Noraisyah
it has finished its
Abdl Aziz
operation? This is accomplished via an interrupt. AbdlAzizOSCOct2022

Overview

Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the
system bus. (There may be many buses within a computer system, but the system bus is the main
communications path between the major components.) Interrupts are used for many other
purposes as well and are a key part of how operating systems and hardware interact.

When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a
fixed location. The fixed location usually contains the starting address where the service routine for
the interrupt is located. The interrupt service routine executes; on completion, the CPU resumes
the interrupted computation. A timeline of this operation is shown in the animation below.

©zyBooks 10/20/22 18:14 1496583


PARTICIPATION Noraisyah Abdl Aziz
ACTIVITY 1.2.1: Interrupt Timeline for a Single Process Doing Output.
AbdlAzizOSCOct2022

Animation content:

Step 1: The user program runs. The I/O device receives an I/O request.
Step 2: The I/O device transfers data. The I/O device then finishes
the transfer and signals an interrupt. The CPU receives the interrupt
and halts the execution of the user program. Eventually, the execution
resumes. Step 3: The I/O device receives another I/O request. Step 4:
The I/O device transfers data and signals another interrupt. The CPU
receives the interrupt and handles the interrupt. Once the I/O
interrupt is handled, the CPU resumes execution of the user program.

Animation captions:

1. The user program runs. The I/O device receives an I/O request.
2. The I/O device transfers data. The I/O device then finishes the transfer and signals an
interrupt. The CPU receives the interrupt and halts the execution of the user program.
Eventually, the execution resumes.
3. The I/O device receives another I/O request.
4. The I/O device transfers data and signals another interrupt. The CPU receives the interrupt
and handles the interrupt. Once the I/O interrupt is handled, the CPU resumes execution of
the user program.

Interrupts are an important part of a computer architecture. Each computer design has its own
interrupt mechanism, but several functions are common. The interrupt must transfer control to the
appropriate interrupt service routine. The straightforward method for managing this transfer would
be to invoke a generic routine to examine the interrupt information. The routine, in turn, would call
the interrupt-specific handler. However, interrupts must be handled quickly, as they occur very
©zyBooks 10/20/22 18:14 1496583
frequently. A table of pointers to interrupt routines can be used instead Noraisyah
to provideAbdl
the Aziz
necessary
speed. The interrupt routine is called indirectly through the table, with no intermediate routine
AbdlAzizOSCOct2022
needed. Generally, the table of pointers is stored in low memory (the first hundred or so locations).
These locations hold the addresses of the interrupt service routines for the various devices. This
array, or interrupt vector, of addresses is then indexed by a unique number, given with the interrupt
request, to provide the address of the interrupt service routine for the interrupting device. Operating
systems as different as Windows and UNIX dispatch interrupts in this manner.
The interrupt architecture must also save the state information of whatever was interrupted, so
that it can restore this information after servicing the interrupt. If the interrupt routine needs to
modify the processor state—for instance, by modifying register values—it must explicitly save the
current state and then restore that state before returning. After the interrupt is serviced, the saved
return address is loaded into the program counter, and the interrupted computation resumes as
though the interrupt had not occurred.

Implementation ©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
The basic interrupt mechanism works as follows. The CPU hardware has a wire called the
interrupt-request line that the CPU senses after executing every instruction. When the CPU detects
that a controller has asserted a signal on the interrupt-request line, it reads the interrupt number
and jumps to the interrupt-handler routine by using that interrupt number as an index into the
interrupt vector. It then starts execution at the address associated with that index. The interrupt
handler saves any state it will be changing during its operation, determines the cause of the
interrupt, performs the necessary processing, performs a state restore, and executes a
return_from_interrupt instruction to return the CPU to the execution state prior to the
interrupt. We say that the device controller raises an interrupt by asserting a signal on the interrupt
request line, the CPU catches the interrupt and dispatches it to the interrupt handler, and the
handler clears the interrupt by servicing the device. The animation below summarizes the
interrupt-driven I/O cycle.

PARTICIPATION
ACTIVITY
1.2.2: Interrupt-driven I/O Cycle.

Animation content:

Step One: Device driver senses device I/O activity, initiates I/O.
Step 2: Driver tells I/O controller to initiate I/O. Step 3: While I/O
executes, the CPU checks for interrupts between instructions. Step 4:
The device completes its operation, generates an interrupt which is
received by the CPU. Step 5. CPU jumps to interrupt handler which
processes the interrupt, returns from interrupt handler. Step 6: CPU
resumes task that was interrupted. Step 7: Ready for the next
interrupt to start the cycle again.

Animation captions:
©zyBooks 10/20/22 18:14 1496583
1. Device driver senses device I/O activity, initiates I/O. Noraisyah Abdl Aziz
2. Driver tells I/O controller to initiate I/O. AbdlAzizOSCOct2022
3. While I/O executes, the CPU checks for interrupts between instructions.
4. The device completes its operation, generates an interrupt which is received by the CPU.
5. CPU jumps to interrupt handler which processes the interrupt, returns from interrupt
handler.
6. CPU resumes task that was interrupted.
7. Ready for the next interrupt to start the cycle again.
The basic interrupt mechanism just described enables the CPU to respond to an asynchronous
event, as when a device controller becomes ready for service. In a modern operating system,
however, we need more sophisticated interrupt-handling features.

1. We need the ability to defer interrupt handling during critical processing.

2. We need an efficient way to dispatch to the proper interrupt handler for a device.

3. We need multilevel interrupts, so that the operating system©zyBooks


can distinguish
10/20/22between high-
18:14 1496583
and low-priority interrupts and can respond with the appropriate degree of urgency.
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
In modern computer hardware, these three features are provided by the CPU and the interrupt-
controller hardware.

Most CPUs have two interrupt request lines. One is the nonmaskable interrupt, which is reserved
for events such as unrecoverable memory errors. The second interrupt line is maskable: it can be
turned off by the CPU before the execution of critical instruction sequences that must not be
interrupted. The maskable interrupt is used by device controllers to request service.
Recall that the purpose of a vectored interrupt mechanism is to reduce the need for a single
interrupt handler to search all possible sources of interrupts to determine which one needs service.
In practice, however, computers have more devices (and, hence, interrupt handlers) than they have
address elements in the interrupt vector. A common way to solve this problem is to use interrupt
chaining, in which each element in the interrupt vector points to the head of a list of interrupt
handlers. When an interrupt is raised, the handlers on the corresponding list are called one by one,
until one is found that can service the request. This structure is a compromise between the
overhead of a huge interrupt table and the inefficiency of dispatching to a single interrupt handler.
Figure 1.2.2 illustrates the design of the interrupt vector for Intel processors. The events from 0 to
31, which are nonmaskable, are used to signal various error conditions. The events from 32 to 255,
which are maskable, are used for purposes such as device-generated interrupts.

Figure 1.2.2: Intel processor event-vector table.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

The interrupt mechanism also implements a system of interrupt priority levels. These levels
enable the CPU to defer the handling of low-priority interrupts without masking all interrupts and
makes it possible for a high-priority interrupt to preempt the execution of a low-priority interrupt.
In summary, interrupts are used throughout modern operating systems to handle asynchronous
events (and for other purposes we will discuss throughout the text). Device controllers and
hardware faults raise interrupts. To enable the most urgent work to be done first, modern
computers use a system of interrupt priorities. Because interrupts are used so heavily for time-
sensitive processing, efficient interrupt handling is required for good system performance.

Storage structure

The CPU can load instructions only from memory, so any programs must first
©zyBooks be loaded
10/20/22 into
18:14 1496583
memory to run. General-purpose computers run most of their programsNoraisyah
from rewritable
Abdl Azizmemory,
AbdlAzizOSCOct2022
called main memory (also called random-access memory, or RAM). Main memory commonly is
implemented in a semiconductor technology called dynamic random-access memory (DRAM).

Computers use other forms of memory as well. For example, the first program to run on computer
power-on is a bootstrap program, which then loads the operating system. Since RAM is volatile—
loses its content when power is turned off or otherwise lost—we cannot trust it to hold the
bootstrap program. Instead, for this and some other purposes, the computer uses electrically
erasable programmable read-only memory (EEPROM) and other forms of firmware—storage that is
infrequently written to and is nonvolatile. EEPROM can be changed but cannot be changed
frequently. In addition, it is low speed, and so it contains mostly static programs and data that
aren't frequently used. For example, the iPhone uses EEPROM to store serial numbers and
hardware information about the device.

Storage definitions and notation


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
The basic unit of computer storage is the bit. A bit can contain one of two values, 0
and 1. All other storage in a computer is based on collections of bits. Given enough
bits, it is amazing how many things a computer can represent: numbers, letters,
images, movies, sounds, documents, and programs, to name a few. A byte is 8 bits,
and on most computers it is the smallest convenient chunk of storage. For
example, most computers don't have an instruction to move a bit but do have one
to move a byte. A less common term is word, which is a given computer
architecture's native unit of data. A word is made up of one or more bytes. For
example, a computer that has 64-bit registers and 64-bit memory addressing
typically has 64-bit (8-byte) words. A computer executes many operations in its
native word size rather than a byte at a time.

Computer storage, along with most computer throughput, is generally measured


and manipulated in bytes and collections of bytes. A kilobyte, or KB, is 1,024 bytes;
a megabyte, or MB, is 1, 0242 bytes; a gigabyte, or GB, is 1, 0243 bytes; a terabyte,
or TB, is 1, 0244 bytes; and a petabyte, or PB, is 1, 0245 bytes. Computer
manufacturers often round off these numbers and say that a megabyte is 1 million
bytes and a gigabyte is 1 billion bytes. Networking measurements are an exception
to this general rule; they are given in bits (because networks move data a bit at a
time).

All forms of memory provide an array of bytes. Each byte has its own address. Interaction is
achieved through a sequence of load or store instructions to specific memory addresses. The
load instruction moves a byte or word from main memory to an internal register within the CPU,
whereas the store instruction moves the content of a register to main memory. Aside from
explicit loads and stores, the CPU automatically loads instructions from main memory for
execution from the location stored in the program counter.
©zyBooks 10/20/22 18:14 1496583
Noraisyah
A typical instruction-execution cycle, as executed on a system with a von Neumann Abdlarchitecture,
Aziz
AbdlAzizOSCOct2022
first fetches an instruction from memory and stores that instruction in the instruction register. The
instruction is then decoded and may cause operands to be fetched from memory and stored in
some internal register. After the instruction on the operands has been executed, the result may be
stored back in memory. Notice that the memory unit sees only a stream of memory addresses. It
does not know how they are generated (by the instruction counter, indexing, indirection, literal
addresses, or some other means) or what they are for (instructions or data). Accordingly, we can
ignore how a memory address is generated by a program. We are interested only in the sequence
of memory addresses generated by the running program.

Ideally, we want the programs and data to reside in main memory permanently. This arrangement
usually is not possible on most systems for two reasons:

1. Main memory is usually too small to store all needed programs and data permanently.

2. Main memory, as mentioned, is volatile—it loses its contents when power


©zyBooks is turned
10/20/22 off or
18:14 1496583
otherwise lost. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Thus, most computer systems provide secondary storage as an extension of main memory. The
main requirement for secondary storage is that it be able to hold large quantities of data
permanently.

The most common secondary-storage devices are hard-disk drives (HDDs) and nonvolatile
memory (NVM) devices, which provide storage for both programs and data. Most programs
(system and application) are stored in secondary storage until they are loaded into memory. Many
programs then use secondary storage as both the source and the destination of their processing.
Secondary storage is also much slower than main memory. Hence, the proper management of
secondary storage is of central importance to a computer system, as we discuss in the chapter
Mass-Storage Structure.

In a larger sense, however, the storage structure that we have described—consisting of registers,
main memory, and secondary storage—is only one of many possible storage system designs.
Other possible components include cache memory, CD-ROM or blu-ray, magnetic tapes, and so on.
Those that are slow enough and large enough that they are used only for special purposes—to
store backup copies of material stored on other devices, for example—are called tertiary storage.
Each storage system provides the basic functions of storing a datum and holding that datum until
it is retrieved at a later time. The main differences among the various storage systems lie in speed,
size, and volatility.

The wide variety of storage systems can be organized in a hierarchy (Figure 1.2.3) according to
storage capacity and access time. As a general rule, there is a trade-off between size and speed,
with smaller and faster memory closer to the CPU. As shown in the figure, in addition to differing in
speed and capacity, the various storage systems are either volatile or nonvolatile. Volatile storage,
as mentioned earlier, loses its contents when the power to the device is removed, so data must be
written to nonvolatile storage for safekeeping.

Figure 1.2.3: Storage-device hierarchy.


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

The top four levels of memory in the figure are constructed using semiconductor memory, which
consists of semiconductor-based electronic circuits. NVM devices, at the fourth level, have several
variants but in general are faster than hard disks. The most common form of NVM device is flash
memory, which is popular in mobile devices such as smartphones and tablets. Increasingly, flash
memory is being used for long-term storage on laptops, desktops, and servers as well.

Since storage plays an important role in operating-system structure, we will refer to it frequently in
the text. In general, we will use the following terminology:

Volatile storage will be referred to simply as memory. If we need to emphasize a particular


type of storage device (for example, a register), we will do so explicitly.
Nonvolatile storage retains its contents when power is lost. It will be referred to as NVS. The
vast majority of the time we spend on NVS will be on secondary storage. This type of storage
can be classified into two distinct types:
Mechanical. A few examples of such storage systems are HDDs, optical disks,
holographic storage, and magnetic tape. If we need to emphasize a particular type of
mechanical storage device (for example, magnetic tape), we will
©zyBooks do so explicitly.
10/20/22 18:14 1496583
Noraisyah Abdl Aziz
Electrical. A few examples of such storage systems are flash memory, FRAM, NRAM,
AbdlAzizOSCOct2022
and SSD. Electrical storage will be referred to as NVM. If we need to emphasize a
particular type of electrical storage device (for example, SSD), we will do so explicitly.

Mechanical storage is generally larger and less expensive per byte than electrical storage.
Conversely, electrical storage is typically costly, smaller, and faster than mechanical storage.
The design of a complete storage system must balance all the factors just discussed: it must use
only as much expensive memory as necessary while providing as much inexpensive, nonvolatile
storage as possible. Caches can be installed to improve performance where a large disparity in
access time or transfer rate exists between two components.

I/O structure

A large portion of operating system code is dedicated to managing I/O, both


©zyBooks because
10/20/22 of 1496583
18:14 its
importance to the reliability and performance of a system and becauseNoraisyah Abdl Aziz
of the varying nature of the
AbdlAzizOSCOct2022
devices.
Recall from the beginning of this section that a general-purpose computer system consists of
multiple devices, all of which exchange data via a common bus. The form of interrupt-driven I/O
described in Section Interrupts is fine for moving small amounts of data but can produce high
overhead when used for bulk data movement such as NVS I/O. To solve this problem, direct
memory access (DMA) is used. After setting up buffers, pointers, and counters for the I/O device,
the device controller transfers an entire block of data directly to or from the device and main
memory, with no intervention by the CPU. Only one interrupt is generated per block, to tell the
device driver that the operation has completed, rather than the one interrupt per byte generated for
low-speed devices. While the device controller is performing these operations, the CPU is available
to accomplish other work.
Some high-end systems use switch rather than bus architecture. On these systems, multiple
components can talk to other components concurrently, rather than competing for cycles on a
shared bus. In this case, DMA is even more effective. The animation below shows the interplay of
all components of a computer system.

PARTICIPATION
ACTIVITY
1.2.3: How a modern computer works.

Animation content:

Step 1: The CPU core instruction cycle involves reading instructions


and read and writing data to main memory. Step 2: An instruction might
trigger an I/O request to a device. Step 3: That request leads to data
transfer with the device, and an interrupt to signal the CPU when the
transfer is complete. Step 4: For larger mass media data movement, an
instruction requests the I/O. Step 5: The I/O request triggers a DMA
transfer of data from the device to main memory. Step 6: The interrupt
©zyBooks 10/20/22 18:14 1496583
informs the CPU of the I/O completion. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Animation captions:

1. The CPU core instruction cycle involves reading instructions and read and writing data to
main memory.
2. An instruction might trigger an I/O request to a device.
3. That request leads to data transfer with the device, and an interrupt to signal the CPU when
the transfer is complete.
4. For larger mass media data movement, an instruction requests the I/O.
5. The I/O request triggers a DMA transfer of data from the device to main memory.
6. The interrupt informs the CPU of the I/O completion.

PARTICIPATION ©zyBooks 10/20/22 18:14 1496583


ACTIVITY
1.2.4: Section review questions.
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
1) A device controller informs a device
driver it has completed an I/O
operation using ________.
direct memory access (DMA)
an interrupt handler
an interrupt

2) What best describes a maskable


interrupt?
An interrupt that can
temporarily be disabled.
An interrupt that must be
responded to immediately,
regardless what the operating
system is performing at the
moment.
A technique for prioritizing
various interrupts.

3) Which of the following forms of


storage has the largest capacity?
registers
hard-disk drives
nonvolatile memory

©zyBooks 10/20/22 18:14 1496583


Section glossary Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

bus: A communication system; e.g., within a computer, a bus connects various


components, such as the CPU and I/O devices, allowing them to transfer data and
commands.

device driver: An operating system component that provides uniform access to


various devices and manages I/O to those devices.
interrupt: A hardware mechanism that enables a device to notify the CPU that it
needs attention.

interrupt vector: An operating-system data structure indexed by interrupt address


and pointing to the interrupt handlers. A kernel memory data structure that holds
the addresses of the interrupt service routines for the various devices.
interrupt-request line: The hardware connection to the CPU on which interrupts are
signaled. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
interrupt-handler routine: An operating system routine that is called when an
AbdlAzizOSCOct2022
interrupt signal is received.

interrupt-controller hardware: Computer hardware components for interrupt


management.

nonmaskable interrupt: An interrupt that cannot be delayed or blocked (such as an


unrecoverable memory error)

maskable: Describes an interrupt that can be delayed or blocked (such as when the
kernel is in a critical section).

interrupt chaining: A mechanism by which each element in an interrupt vector


points to the head of a list of interrupt handlers, which are called individually until
one is found to service the interrupt request.

interrupt priority level: Prioritization of interrupts to indicate handling order.

random-access memory (RAM): Rewritable memory, also called main memory.


Most programs run from RAM, which is managed by the kernel.

dynamic random-access memory (DRAM): The common version of RAM, which


features high read and write speeds.

bootstrap program: The program that allows the computer to start running by
initializing hardware and loading the kernel.

volatile: Describes storage whose content can be lost in a power outage or similar
event.

firmware: Software stored in ROM or EEPROM for booting the system and
managing low level hardware.
bit: The basic unit of computer storage. A bit can contain one of two values, 0 or 1.

byte: Eight bits.


©zyBooks 10/20/22 18:14 1496583
word: A unit made up of one or more bytes. For example, a computer that has
Noraisyah Abdl64-
Aziz
AbdlAzizOSCOct2022
bit registers and 64-bit memory addressing typically has 64-bit (8-byte) words.

kilobyte (KB): 1,024 bytes.

megabyte (MB): 1, 0242 bytes.

gigabyte (GB): 1, 0243 bytes.

terabyte (TB): 1, 0244 bytes.


petabyte (PB): 1, 0245 bytes.

von Neumann architecture: The structure of most computers, in which both


process instructions and data are stored in the same main memory.

secondary storage: A storage system capable of holding large amounts of data


permanently; most commonly, HDDs and NVM devices.

hard disk drive (HDD): A secondary storage device based on mechanical


©zyBooks 10/20/22 18:14 1496583
components, including spinning magnetic media platters and moving read-write
Noraisyah Abdl Aziz
heads. AbdlAzizOSCOct2022

nonvolatile memory (NVM): Persistent storage based on circuits and electric


charges.

devices: Persistent storage based on circuits and electric charges.


tertiary storage: A type of storage that is slower and cheaper than main memory or
secondary storage; frequently magnetic tape or optical disk.
semiconductor memory: The various types of memory constructed from
semiconductors.
memory: Volatile storage within a computer system.

nonvolatile storage (NVS): Storage in which data will not be lost in a power outage
or similar event.

nonvolatile memory (NVM): Persistent storage based on circuits and electric


charges.

direct memory access (DMA): A resource-conserving and performance-improving


operation for device controllers allowing devices to transfer large amounts of data
directly to and from main memory.

1.3 Computer-system architecture


In Section 1.2, we introduced the general structure of a typical computer
©zyBookssystem.
10/20/22A18:14
computer
1496583
Noraisyah Abdl Aziz
system can be organized in a number of different ways, which we can categorize roughly
AbdlAzizOSCOct2022
according to the number of general-purpose processors used.

Single-processor systems

Many years ago, most computer systems used a single processor containing one CPU with a
single processing core. The core is the component that executes instructions and registers for
storing data locally. The one main CPU with its core is capable of executing a general-purpose
instruction set, including instructions from processes. These systems have other special-purpose
processors as well. They may come in the form of device-specific processors, such as disk,
keyboard, and graphics controllers.

All of these special-purpose processors run a limited instruction set and do not run processes.
Sometimes, they are managed by the operating system, in that the operating system sends them
information about their next task and monitors their status. For example, a disk-controller
microprocessor receives a sequence of requests from the main CPU core and implements its own
©zyBooks 10/20/22 18:14 1496583
disk queue and scheduling algorithm. This arrangement relieves the main CPU ofAbdl
Noraisyah the Aziz
overhead of
disk scheduling. PCs contain a microprocessor in the keyboard to convertAbdlAzizOSCOct2022
the keystrokes into
codes to be sent to the CPU. In other systems or circumstances, special-purpose processors are
low-level components built into the hardware. The operating system cannot communicate with
these processors; they do their jobs autonomously. The use of special-purpose microprocessors is
common and does not turn a single-processor system into a multiprocessor. If there is only one
general-purpose CPU with a single processing core, then the system is a single-processor system.
According to this definition, however, very few contemporary computer systems are single-
processor systems.

Multiprocessor systems

On modern computers, from mobile devices to servers, multiprocessor systems now dominate the
landscape of computing. Traditionally, such systems have two (or more) processors, each with a
single-core CPU. The processors share the computer bus and sometimes the clock, memory, and
peripheral devices. The primary advantage of multiprocessor systems is increased throughput.
That is, by increasing the number of processors, we expect to get more work done in less time. The
speed-up ratio with N processors is not N , however; it is less than N . When multiple processors
cooperate on a task, a certain amount of overhead is incurred in keeping all the parts working
correctly. This overhead, plus contention for shared resources, lowers the expected gain from
additional processors.

The most common multiprocessor systems use symmetric multiprocessing (SMP), in which each
peer CPU processor performs all tasks, including operating-system functions and user processes.
Figure 1.3.1 illustrates a typical SMP architecture with two processors, each with its own CPU.
Notice that each CPU processor has its own set of registers, as well as a private—or local—cache.
However, all processors share physical memory over the system bus.

Figure 1.3.1: Symmetric multiprocessing architecture.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

The benefit of this model is that many processes can run simultaneously—N processes can run if
there are N CPUs—without causing performance to deteriorate significantly. However, since the
CPUs are separate, one may be sitting idle while another is overloaded, resulting in inefficiencies.
These inefficiencies can be avoided if the processors share certain data structures. A
multiprocessor system of this form will allow processes and resources—such as memory—to be
shared dynamically among the various processors and can lower the workload variance among
the processors. Such a system must be written carefully, as we shall see in the chapter CPU
Scheduling and the chapter Synchronization Tools.

The definition of multiprocessor has evolved over time and now includes multicore systems, in
which multiple computing cores reside on a single chip. Multicore systems can be more efficient
than multiple chips with single cores because on-chip communication is faster than between-chip
communication. In addition, one chip with multiple cores uses significantly less power than
multiple single-core chips, an important issue for mobile devices as well as laptops.
In Figure 1.3.2, we show a dual-core design with two cores on the same processor chip. In this
design, each core has its own register set, as well as its own local cache, often known as a level 1,
or L1, cache. Notice, too, that a level 2 (L2) cache is local to the chip but is shared by the two
©zyBooks 10/20/22 18:14 1496583
processing cores. Most architectures adopt this approach, combining local and shared
Noraisyah caches,
Abdl Aziz
where local, lower-level caches are generally smaller and faster than higher-level shared caches.
AbdlAzizOSCOct2022
Aside from architectural considerations, such as cache, memory, and bus contention, a multicore
processor with N cores appears to the operating system as N standard CPUs. This characteristic
puts pressure on operating-system designers—and application programmers—to make efficient
use of these processing cores, an issue we pursue in the chapter Threads & Concurrency. Virtually
all modern operating systems—including Windows, macOS, and Linux, as well as Android and iOS
mobile systems—support multicore SMP systems.
Figure 1.3.2: A dual-core design with two cores on the same chip.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Definitions of computer system components

CPU—The hardware that executes instructions.


Processor—A physical chip that contains one or more CPUs.
Core—The basic computation unit of the CPU.
Multicore—Including multiple computing cores on the same CPU.
Multiprocessor—Including multiple processors.

Although virtually all systems are now multicore, we use the general term CPU
when referring to a single computational unit of a computer system and core as
well as multicore when specifically referring to one or more cores on a CPU.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
PARTICIPATION
ACTIVITY
1.3.1: Mid-section review question.

1) The ________ is the physical chip


that contains one or more
CPUs.
Check Show answer

PARTICIPATION
ACTIVITY
1.3.2: Mid-section review question.
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
1) Multicore also means multiple CPUs. AbdlAzizOSCOct2022

True
False

Adding additional CPUs to a multiprocessor system will increase computing power; however, as
suggested earlier, the concept does not scale very well, and once we add too many CPUs,
contention for the system bus becomes a bottleneck and performance begins to degrade. An
alternative approach is instead to provide each CPU (or group of CPUs) with its own local memory
that is accessed via a small, fast local bus. The CPUs are connected by a shared system
interconnect, so that all CPUs share one physical address space. This approach—known as non-
uniform memory access, or NUMA—is illustrated in Figure 1.3.3. The advantage is that, when a
CPU accesses its local memory, not only is it fast, but there is also no contention over the system
interconnect. Thus, NUMA systems can scale more effectively as more processors are added.

Figure 1.3.3: NUMA multiprocessing architecture.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

A potential drawback with a NUMA system is increased latency when a CPU must access remote
memory across the system interconnect, creating a possible performance penalty. In other words,
for example, CPU0 cannot access the local memory of CPU3 as quickly as it can access its own
local memory, slowing down performance. Operating systems can minimize this NUMA penalty
through careful CPU scheduling and memory management, as discussed in Section Multicore
Processors and Section Non-Uniform Memory Access. Because NUMA systems can scale to
accommodate a large number of processors, they are becoming increasingly popular on servers
as well as high-performance computing systems.

Finally, blade servers are systems in which multiple processor boards, I/O boards, and networking
boards are placed in the same chassis. The difference between these and traditional
©zyBooks 10/20/22 18:14 1496583
multiprocessor systems is that each blade-processor board boots independently and Aziz
Noraisyah Abdl runs its own
operating system. Some blade-server boards are multiprocessor as well, AbdlAzizOSCOct2022
which blurs the lines
between types of computers. In essence, these servers consist of multiple independent
multiprocessor systems.

Clustered systems

Another type of multiprocessor system is a clustered system, which gathers together multiple
CPUs. Clustered systems differ from the multiprocessor systems described in Section
Multiprocessor systems in that they are composed of two or more individual systems—or nodes—
joined together; each node is typically a multicore system. Such systems are considered loosely
coupled. We should note that the definition of clustered is not concrete; many commercial and
open-source packages wrestle to define what a clustered system is and why one form is better
than another. The generally accepted definition is that clustered computers share storage and are
closely linked via a local-area network LAN (as described in the chapter Networks and Distributed
Systems) or a faster interconnect, such as InfiniBand.
Clustering is usually used to provide high-availability service—that is, service that will continue
even if one or more systems in the cluster fail. Generally, we obtain high availability by adding a
level of redundancy in the system. A layer of cluster software runs on the cluster nodes. Each node
can monitor one or more of the others (over the network). If the monitored machine fails, the
monitoring machine can take ownership of its storage and restart the applications that were
running on the failed machine. The users and clients of the applications see only a brief
interruption of service.
High availability provides increased reliability, which is crucial in many applications. The ability to
continue providing service proportional to the level of surviving hardware is called graceful
degradation. Some systems go beyond graceful degradation and are called fault tolerant, because
they can suffer a failure of any single component and still continue operation. Fault tolerance
requires a mechanism to allow the failure to be detected, diagnosed, and, if possible, corrected.

Clustering can be structured asymmetrically or symmetrically. In asymmetric clustering, one


©zyBooks 10/20/22
machine is in hot-standby mode while the other is running the applications. 18:14 1496583
The hot-standby host
Noraisyah Abdl Aziz
machine does nothing but monitor the active server. If that server fails,AbdlAzizOSCOct2022
the hot-standby host
becomes the active server. In symmetric clustering, two or more hosts are running applications
and are monitoring each other. This structure is obviously more efficient, as it uses all of the
available hardware. However, it does require that more than one application be available to run.

PC motherboard
Consider the desktop PC motherboard with a processor socket shown below:

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

This board is a fully functioning computer, once its slots are populated. It consists
of a processor socket containing a CPU, DRAM sockets, PCIe bus slots, and I/O
connectors of various types. Even the lowest-cost general-purpose CPU contains
multiple cores. Some motherboards contain multiple processor sockets. More
advanced computers allow more than one system board, creating NUMA systems.

Since a cluster consists of several computer systems connected via a network, clusters can also
be used to provide high-performance computing environments. Such systems can supply
significantly greater computational power than single-processor or even SMP systems because
they can run an application concurrently on all computers in the cluster. The application must have
been written specifically to take advantage of the cluster, however. This involves a technique
known as parallelization, which divides a program into separate components that run in parallel on
individual cores in a computer or computers in a cluster. Typically, these applications are designed
so that once each computing node in the cluster has solved its portion of the problem, the results
from all the nodes are combined into a final solution.
Other forms of clusters include parallel clusters and clustering over a wide-area network (WAN) (as
described in the chapter Networks and Distributed Systems). Parallel clusters allow multiple hosts
to access the same data on shared storage. Because most operating ©zyBooks 10/20/22
systems lack18:14 1496583
support for
Noraisyah Abdl Aziz
simultaneous data access by multiple hosts, parallel clusters usually require the use of special
AbdlAzizOSCOct2022
versions of software and special releases of applications. For example, Oracle Real Application
Cluster is a version of Oracle's database that has been designed to run on a parallel cluster. Each
machine runs Oracle, and a layer of software tracks access to the shared disk. Each machine has
full access to all data in the database. To provide this shared access, the system must also supply
access control and locking to ensure that no conflicting operations occur. This function, commonly
known as a distributed lock manager (DLM), is included in some cluster technology.
Cluster technology is changing rapidly. Some cluster products support thousands of systems in a
cluster, as well as clustered nodes that are separated by miles. Many of these improvements are
made possible by storage-area networks (SANs), as described in a Section Storage-Area Networks
and Storage Arrays, which allow many systems to attach to a pool of storage. If the applications
and their data are stored on the SAN, then the cluster software can assign the application to run on
any host that is attached to the SAN. If the host fails, then any other host can take over. In a
database cluster, dozens of hosts can share the same database, greatly increasing performance
©zyBooks
and reliability. Figure 1.3.4 depicts the general structure of a clustered 10/20/22 18:14 1496583
system.
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Figure 1.3.4: General structure of a clustered system.

PARTICIPATION
ACTIVITY
1.3.3: Section review questions.

1) Which of the following is not true of


clustered systems?
They can provide high-
availability service.
Because they are typically
connected across a computer
network, they cannot meet
high-performance computing
needs. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
Data sharing is still possible on AbdlAzizOSCOct2022
clustered systems even though
the cluster consists of separate
computer systems.

Section glossary
core: Within a CPU, the component that executes instructions.

multiprocessor systems: Systems that have two or more hardware processors


(CPU cores) in close communication, sharing the computer bus and sometimes
the clock, memory, and peripheral devices.

symmetric multiprocessing (SMP): Multiprocessing in which each processor


performs all tasks, including operating-system tasks and user processes. Also, a
©zyBooks 10/20/22 18:14 1496583
multiprocessor scheduling method in which each processor is self-scheduling
Noraisyah Abdland
Aziz
may run kernel threads or user-level threads. AbdlAzizOSCOct2022

multicore: Multiple processing cores within the same CPU chip or within a single
system.
multiprocessor: multiple processors within the same cpu chip or within a single
system.

shared system interconnect: A bus connecting CPUs to memory in such a way that
all CPUs can access all system memory; the basis for NUMA systems.

non-uniform memory access (NUMA): An architecture aspect of many computer


systems in which the time to access memory varies based on which core the
thread is running on (e.g., a core interlink is slower than accessing DIMMs directly
attached to core).

blade server: A computer with multiple processor boards, I/O boards, and
networking boards placed in the same chassis. The difference between these and
traditional multiprocessor systems is that each blade-processor board boots
independently and runs its own operating system.

clustered system: A system that gathers together multiple CPUs. Clustered


systems differ from multiprocessor systems in that they are composed of two or
more individual systems—or nodes—joined together.

loosely coupled: Describes a kernel design in which the kernel is composed of


components that have specific and limited functions.

high-availability: Describes a service that will continue even if one or more systems
in the cluster fail.
graceful degradation: The ability of a system to continue providing service
proportional to the level of surviving hardware.
fault-tolerant system: A system that can suffer a failure of any single component
©zyBooks 10/20/22 18:14 1496583
and still continue operation. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
asymmetric clustering: A configuration in which one machine in a cluster is in hot-
standby mode while the other is running applications.

hot-standby mode: A condition in which a computer in a cluster does nothing but


monitor the active server. If that server fails, the hot-standby host becomes the
active server.
symmetric clustering: A situation in which two or more hosts are running
applications and are monitoring each other.

high-performance computing: A computing facility designed for use with a large


number of resources to be used by software designed for parallel operation.

parallelization: The process of dividing a program into separate components that


run in parallel on individual cores in a computer or computers in a cluster.
©zyBooks 10/20/22 18:14 1496583
distributed lock manager (DLM): A function used by a clustered system to supply
Noraisyah Abdl Aziz
access control and locking to ensure that no conflicting operations occur.
AbdlAzizOSCOct2022

storage-area network (SAN): A local-area storage network allowing multiple


computers to connect to one or more storage devices.

1.4 Operating-system operations


Now that we have discussed basic information about computer-system organization and
architecture, we are ready to talk about operating systems. An operating system provides the
environment within which programs are executed. Internally, operating systems vary greatly, since
they are organized along many different lines. There are, however, many commonalities, which we
consider in this section.

For a computer to start running—for instance, when it is powered up or rebooted—it needs to have
an initial program to run. As noted earlier, this initial program, or bootstrap program, tends to be
simple. Typically, it is stored within the computer hardware in firmware. It initializes all aspects of
the system, from CPU registers to device controllers to memory contents. The bootstrap program
must know how to load the operating system and how to start executing that system. To
accomplish this goal, the bootstrap program must locate the operating-system kernel and load it
into memory.

Hadoop

Hadoop is an open-source software framework that is used©zyBooks 10/20/22 18:14 1496583


for distributed
Noraisyah Abdl Aziz
processing of large data sets (known as big data) in a clustered system containing
AbdlAzizOSCOct2022
simple, low-cost hardware components. Hadoop is designed to scale from a single
system to a cluster containing thousands of computing nodes. Tasks are assigned
to a node in the cluster, and Hadoop arranges communication between nodes to
manage parallel computations to process and coalesce results. Hadoop also
detects and manages failures in nodes, providing an efficient and highly reliable
distributed computing service.
Hadoop is organized around the following three components:

1. A distributed file system that manages data and files across distributed
computing nodes.
2. The YARN ("Yet Another Resource Negotiator") framework, which manages
resources within the cluster as well as scheduling tasks on nodes in the
cluster.
©zyBooks 10/20/22 18:14 1496583
3. The MapReduce system, which allows parallel processing ofNoraisyah
data across
Abdl Aziz
nodes in the cluster. AbdlAzizOSCOct2022

Hadoop is designed to run on Linux systems, and Hadoop applications can be


written using several programming languages, including scripting languages such
as PHP, Perl, and Python. Java is a popular choice for developing Hadoop
applications, as Hadoop has several Java libraries that support MapReduce. More
information on MapReduce and Hadoop can be found at
https://hadoop.apache.org/docs/r1.2.1/mapred_tutorial.html and
https://hadoop.apache.org

Once the kernel is loaded and executing, it can start providing services to the system and its users.
Some services are provided outside of the kernel by system programs that are loaded into memory
at boot time to become system daemons, which run the entire time the kernel is running. On Linux,
the first system program is "systemd," and it starts many other daemons. Once this phase is
complete, the system is fully booted, and the system waits for some event to occur.

If there are no processes to execute, no I/O devices to service, and no users to whom to respond,
an operating system will sit quietly, waiting for something to happen. Events are almost always
signaled by the occurrence of an interrupt. In Section Interrupts we described hardware interrupts.
Another form of interrupt is a trap (or an exception), which is a software-generated interrupt
caused either by an error (for example, division by zero or invalid memory access) or by a specific
request from a user program that an operating-system service be performed by executing a
special operation called a system call.

Multiprogramming and multitasking

One of the most important aspects of operating systems is the ability to run
©zyBooks multiple
10/20/22 programs,
18:14 1496583as
a single program cannot, in general, keep either the CPU or the I/O devices busy at
Noraisyah all Aziz
Abdl times.
AbdlAzizOSCOct2022
Furthermore, users typically want to run more than one program at a time as well.
Multiprogramming increases CPU utilization, as well as keeping users satisfied, by organizing
programs so that the CPU always has one to execute. In a multiprogrammed system, a program in
execution is termed a process.

The idea is as follows: The operating system keeps several processes in memory simultaneously
(Figure 1.4.1). The operating system picks and begins to execute one of these processes.
Eventually, the process may have to wait for some task, such as an I/O operation, to complete. In a
non-multiprogrammed system, the CPU would sit idle. In a multiprogrammed system, the
operating system simply switches to, and executes, another process. When that process needs to
wait, the CPU switches to another process, and so on. Eventually, the first process finishes waiting
and gets the CPU back. As long as at least one process needs to execute, the CPU is never idle.

Figure 1.4.1: Memory layout for a multiprogramming system.


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

This idea is common in other life situations. A lawyer does not work for only one client at a time,
for example. While one case is waiting to go to trial or have papers typed, the lawyer can work on
another case. If she has enough clients, the lawyer will never be idle for lack of work. (Idle lawyers
tend to become politicians, so there is a certain social value in keeping lawyers busy.)
Multitasking is a logical extension of multiprogramming. In multitasking systems, the CPU
executes multiple processes by switching among them, but the switches occur frequently,
providing the user with a fast response time. Consider that when a process executes, it typically
executes for only a short time before it either finishes or needs to perform I/O. I/O may be
interactive; that is, output goes to a display for the user, and input comes from a user keyboard,
mouse, or touch screen. Since interactive I/O typically runs at "people speeds," it may take a long
time to complete. Input, for example, may be bounded by the user's typing speed; seven characters
per second is fast for people but incredibly slow for computers. Rather than let the CPU sit idle as
this interactive input takes place, the operating system will rapidly switch the CPU to another
process. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
Having several processes in memory at the same time requires some form of memory
AbdlAzizOSCOct2022
management, which we cover in the chapter Main Memory and chapter Virtual Memory. In
addition, if several processes are ready to run at the same time, the system must choose which
process will run next. Making this decision is CPU scheduling, which is discussed in the chapter
CPU Scheduling. Finally, running multiple processes concurrently requires that their ability to affect
one another be limited in all phases of the operating system, including process scheduling, disk
storage, and memory management. We discuss these considerations throughout the text.
In a multitasking system, the operating system must ensure reasonable response time. A common
method for doing so is virtual memory, a technique that allows the execution of a process that is
not completely in memory (chapter Virtual Memory). The main advantage of this scheme is that it
enables users to run programs that are larger than actual physical memory. Further, it abstracts
main memory into a large, uniform array of storage, separating logical memory as viewed by the
user from physical memory. This arrangement frees programmers from concern over memory-
storage limitations.
©zyBooks 10/20/22 18:14 1496583
Multiprogramming and multitasking systems must also provide a file system (chapter
Noraisyah File-System
Abdl Aziz
Interface, chapter File-System Implementation, and chapter File-SystemAbdlAzizOSCOct2022
Internals). The file system
resides on a secondary storage; hence, storage management must be provided (chapter Mass-
Storage Structure). In addition, a system must protect resources from inappropriate use (chapter
Protection). To ensure orderly execution, the system must also provide mechanisms for process
synchronization and communication (chapter Synchronization Tools and chapter Synchronization
Examples), and it may ensure that processes do not get stuck in a deadlock, forever waiting for
one another (chapter Deadlocks).

Dual-mode and multimode operation

Since the operating system and its users share the hardware and software resources of the
computer system, a properly designed operating system must ensure that an incorrect (or
malicious) program cannot cause other programs—or the operating system itself—to execute
incorrectly. In order to ensure the proper execution of the system, we must be able to distinguish
between the execution of operating-system code and user-defined code. The approach taken by
most computer systems is to provide hardware support that allows differentiation among various
modes of execution.

At the very least, we need two separate modes of operation: user mode and kernel mode (also
called supervisor mode, system mode, or privileged mode). A bit, called the mode bit, is added to
the hardware of the computer to indicate the current mode: kernel (0) or user (1). With the mode
bit, we can distinguish between a task that is executed on behalf of the operating system and one
that is executed on behalf of the user. When the computer system is executing on behalf of a user
application, the system is in user mode. However, when a user application requests a service from
the operating system (via a system call), the system must transition from user to kernel mode to
fulfill the request. This is shown in Figure 1.4.2. As we shall see, this architectural enhancement is
useful for many other aspects of system operation as well.

Figure 1.4.2: Transition from user to kernel mode.


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

At system boot time, the hardware starts in kernel mode. The operating system is then loaded and
starts user applications in user mode. Whenever a trap or interrupt occurs, the hardware switches
from user mode to kernel mode (that is, changes the state of the mode bit to 0). Thus, whenever
the operating system gains control of the computer, it is in kernel mode. The system always
switches to user mode (by setting the mode bit to 1) before passing control to a user program.

The dual mode of operation provides us with the means for protecting the operating system from
errant users—and errant users from one another. We accomplish this protection by designating
some of the machine instructions that may cause harm as privileged instructions. The hardware
allows privileged instructions to be executed only in kernel mode. If an attempt is made to execute
a privileged instruction in user mode, the hardware does not execute the instruction but rather
treats it as illegal and traps it to the operating system.
The instruction to switch to kernel mode is an example of a privileged instruction. Some other
examples include I/O control, timer management, and interrupt management. Many additional
privileged instructions are discussed throughout the text.

The concept of modes can be extended beyond two modes. For example, Intel processors have
four separate protection rings, where ring 0 is kernel mode and ring 3 is user mode. (Although
rings 1 and 2 could be used for various operating-system services, in practice they are rarely used.)
ARM v8 systems have seven modes. CPUs that support virtualization (Section Virtual machines
'Overview') frequently have a separate mode to indicate when the virtual machine manager (VMM)
is in control of the system. In this mode, the VMM has more privileges than user processes but
fewer than the kernel. It needs that level of privilege so it can create and manage virtual machines,
changing the CPU state to do so.
We can now better understand the life cycle of instruction execution in a computer system. Initial
control resides in the operating system, where instructions are executed in kernel mode. When
control is given to a user application, the mode is set to user mode. Eventually, control is switched
back to the operating system via an interrupt, a trap, or a system ©zyBooks
call. Most10/20/22
contemporary
18:14 1496583
operating systems—such as Microsoft Windows, Unix, and Linux—take Noraisyah
advantageAbdl
of this
Aziz dual-
mode feature and provide greater protection for the operating system. AbdlAzizOSCOct2022

System calls provide the means for a user program to ask the operating system to perform tasks
reserved for the operating system on the user program's behalf. A system call is invoked in a
variety of ways, depending on the functionality provided by the underlying processor. In all forms, it
is the method used by a process to request action by the operating system. A system call usually
takes the form of a trap to a specific location in the interrupt vector. This trap can be executed by a
generic trap instruction, although some systems have a specific syscall instruction to invoke a
system call.

When a system call is executed, it is typically treated by the hardware as a software interrupt.
Control passes through the interrupt vector to a service routine in the operating system, and the
mode bit is set to kernel mode. The system-call service routine is a part of the operating system.
The kernel examines the interrupting instruction to determine what system call has occurred; a
parameter indicates what type of service the user program is requesting. Additional information
©zyBooks 10/20/22 18:14 1496583
needed for the request may be passed in registers, on the stack, or in memory (with
Noraisyah Abdlpointers
Aziz to the
AbdlAzizOSCOct2022
memory locations passed in registers). The kernel verifies that the parameters are correct and
legal, executes the request, and returns control to the instruction following the system call. We
describe system calls more fully in Section 2.3.
Once hardware protection is in place, it detects errors that violate modes. These errors are
normally handled by the operating system. If a user program fails in some way—such as by making
an attempt either to execute an illegal instruction or to access memory that is not in the user's
address space—then the hardware traps to the operating system. The trap transfers control
through the interrupt vector to the operating system, just as an interrupt does. When a program
error occurs, the operating system must terminate the program abnormally. This situation is
handled by the same code as a user-requested abnormal termination. An appropriate error
message is given, and the memory of the program may be dumped. The memory dump is usually
written to a file so that the user or programmer can examine it and perhaps correct it and restart
the program.

Timer

We must ensure that the operating system maintains control over the CPU. We cannot allow a user
program to get stuck in an infinite loop or to fail to call system services and never return control to
the operating system. To accomplish this goal, we can use a timer. A timer can be set to interrupt
the computer after a specified period. The period may be fixed (for example, 1/60 second) or
variable (for example, from 1 millisecond to 1 second). A variable timer is generally implemented
by a fixed-rate clock and a counter. The operating system sets the counter. Every time the clock
ticks, the counter is decremented. When the counter reaches 0, an interrupt occurs. For instance, a
10-bit counter with a 1-millisecond clock allows interrupts at intervals from 1 millisecond to 1,024
milliseconds, in steps of 1 millisecond.
Before turning over control to the user, the operating system ensures that the timer is set to
interrupt. If the timer interrupts, control transfers automatically to the operating system, which may
treat the interrupt as a fatal error or may give the program more time. Clearly, instructions that
modify the content of the timer are privileged. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Linux timers

On Linux systems, the kernel configuration parameter HZ specifies the frequency of


timer interrupts. An HZ value of 250 means that the timer generates 250 interrupts
per second, or one interrupt every 4 milliseconds. The value of HZ depends upon
how the kernel is configured, as well the machine type and architecture on which it
is running. A related kernel variable is jiffies, which represent the number of
timer interrupts that have occurred since the system was booted. A programming
project in chapter Operating-System Structures further explores timing in the Linux
kernel.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
PARTICIPATION
ACTIVITY
1.4.1: Section review questions. AbdlAzizOSCOct2022

1) ______ refers to the special operation


which allows a user program to
request an operating system service.
process
system call
kernel mode

2) Which of the following terms is not


considered another term for kernel
mode?
user mode
system mode
privileged mode

3) What statement concerning


privileged instructions is considered
false?
Unless used appropriately,
privileged instructions may
cause harm to the system.
Privileged instructions can only
be executed in kernel mode.
Privileged instructions can be
executed in both user mode
and kernel mode.
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Section glossary

big data: Extremely large sets of data; distributed systems are well suited to
working with big data.
MapReduce: A Google-created big data programming model and implementation
for parallel processing across nodes in a distributed cluster. A layer on top of the
Google file system (GFS), it allows developers to carry out large-scale parallel
computations easily.

system daemon: A service that is provided outside the kernel by system programs
that are loaded into memory at boot time and run continuously.
trap: A software interrupt. The interrupt can be caused either by an error
©zyBooks (e.g.,18:14 1496583
10/20/22
Noraisyah Abdl Aziz
division by zero or invalid memory access) or by a specific request from a user
AbdlAzizOSCOct2022
program that an operating-system service be performed.

exception: A software-generated interrupt caused either by an error (such as


division by zero or invalid memory access) or by a specific request from a user
program than an operating-system service be performed.

system call: Software-triggered interrupt allowing a process to request a kernel


service.

multiprogramming: A technique that increases CPU utilization by organizing jobs


(code and data) so that the CPU always has a job to execute.

process: A program loaded into memory and executing.

multitasking: The concurrent performance of multiple jobs. A CPU executes


multiple jobs by switching among them, but the switches occur so frequently that
users can interact with the processes.

response time: The amount of time it takes the system to respond to user action.

CPU scheduling: The process by which the system chooses which job will run next
If several jobs are ready to run at the same time.

virtual memory: A technique that allows the execution of a process that is not
completely in memory. Also, separation of computer memory address space from
physical into logical, allowing easier programming and larger name space.
logical memory: Memory as viewed by the user; usually a large uniform array, not
matching physical memory in virtual memory systems.
user mode: A CPU mode for executing user processes in which some instructions
are limited or not allowed. See also kernel mode.

kernel mode: A CPU mode in which all instructions are enabled. The kernel runs in
this mode. See also user mode.
©zyBooks 10/20/22 18:14 1496583
Noraisyah
supervisor mode: A CPU mode in which all instructions are enabled. Abdl Aziz
The kernel
AbdlAzizOSCOct2022
runs in this mode. See also user mode.

system mode: A CPU mode in which all instructions are enabled. The kernel runs in
this mode. See also user mode.
privileged mode: A CPU mode in which all instructions are enabled. The kernel runs
in this mode. See also user mode.

mode bit: A CPU status bit used to indicate the current mode: kernel (0) or user (1).
privileged instructions: Instructions that can execute only if the CPU is in in kernel
mode.

protection rings: A model of privilege separation consisting of a series of rings,


with each successive ring representing greater execution privileges.

virtual machine manager (VMM): The computer function that manages the virtual
machine; also called a hypervisor.
©zyBooks 10/20/22 18:14 1496583
timer: A hardware component that can be set to interrupt the computer after
Noraisyah a Aziz
Abdl
specified period. AbdlAzizOSCOct2022

1.5 Resource management


As we have seen, an operating system is a resource manager. The system's CPU, memory space,
file-storage space, and I/O devices are among the resources that the operating system must
manage.

Process management

A program can do nothing unless its instructions are executed by a CPU. A program in execution,
as mentioned, is a process. A program such as a compiler is a process, and a word-processing
program being run by an individual user on a PC is a process. Similarly, a social media app on a
mobile device is a process. For now, you can consider a process to be an instance of a program in
execution, but later you will see that the concept is more general. As described in the chapter
Processes, it is possible to provide system calls that allow processes to create subprocesses to
execute concurrently.

A process needs certain resources—including CPU time, memory, files, and I/O devices—to
accomplish its task. These resources are typically allocated to the process while it is running. In
addition to the various physical and logical resources that a process obtains when it is created,
various initialization data (input) may be passed along. For example, consider a process running a
web browser whose function is to display the contents of a web page on a screen. The process will
be given the URL as an input and will execute the appropriate instructions
©zyBooks and system
10/20/22 18:14calls to
1496583
obtain and display the desired information on the screen. When the process terminates,
Noraisyah Abdl Azizthe
operating system will reclaim any reusable resources. AbdlAzizOSCOct2022

We emphasize that a program by itself is not a process. A program is a passive entity, like the
contents of a file stored on disk, whereas a process is an active entity. A single-threaded process
has one program counter specifying the next instruction to execute. (Threads are covered in the
chapter Threads & Concurrency.) The execution of such a process must be sequential. The CPU
executes one instruction of the process after another, until the process completes. Further, at any
time, one instruction at most is executed on behalf of the process. Thus, although two processes
may be associated with the same program, they are nevertheless considered two separate
execution sequences. A multithreaded process has multiple program counters, each pointing to
the next instruction to execute for a given thread.
A process is the unit of work in a system. A system consists of a collection of processes, some of
which are operating-system processes (those that execute system code) and the rest of which are
user processes (those that execute user code). All these processes can potentially execute
concurrently—by multiplexing on a single CPU core—or in parallel across multiple CPU cores.
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
The operating system is responsible for the following activities in connection with process
AbdlAzizOSCOct2022
management:

Creating and deleting both user and system processes


Scheduling processes and threads on the CPUs
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication

We discuss process-management techniques in the chapter Processes through chapter


Synchronization Examples.

Memory management

As discussed in Section Storage structure, the main memory is central to the operation of a
modern computer system. Main memory is a large array of bytes, ranging in size from hundreds of
thousands to billions. Each byte has its own address. Main memory is a repository of quickly
accessible data shared by the CPU and I/O devices. The CPU reads instructions from main
memory during the instruction-fetch cycle and both reads and writes data from main memory
during the data-fetch cycle (on a von Neumann architecture). As noted earlier, the main memory is
generally the only large storage device that the CPU is able to address and access directly. For
example, for the CPU to process data from disk, those data must first be transferred to main
memory by CPU-generated I/O calls. In the same way, instructions must be in memory for the CPU
to execute them.

For a program to be executed, it must be mapped to absolute addresses and loaded into memory.
As the program executes, it accesses program instructions and data from memory by generating
these absolute addresses. Eventually, the program terminates, its memory space is declared
available, and the next program can be loaded and executed.
To improve both the utilization of the CPU and the speed of the computer's response to its users,
general-purpose computers must keep several programs in memory, creating a need for memory
©zyBooks 10/20/22 18:14 1496583
management. Many different memory-management schemes are used.Noraisyah These schemes
Abdl Azizreflect
AbdlAzizOSCOct2022
various approaches, and the effectiveness of any given algorithm depends on the situation. In
selecting a memory-management scheme for a specific system, we must take into account many
factors—especially the hardware design of the system. Each algorithm requires its own hardware
support.

The operating system is responsible for the following activities in connection with memory
management:
Keeping track of which parts of memory are currently being used and which process is using
them
Allocating and deallocating memory space as needed
Deciding which processes (or parts of processes) and data to move into and out of memory

Memory-management techniques are discussed in the chapter Main Memory and chapter Virtual
Memory.
©zyBooks 10/20/22 18:14 1496583
File-system management Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

To make the computer system convenient for users, the operating system provides a uniform,
logical view of information storage. The operating system abstracts from the physical properties of
its storage devices to define a logical storage unit, the file. The operating system maps files onto
physical media and accesses these files via the storage devices.

File management is one of the most visible components of an operating system. Computers can
store information on several different types of physical media. Secondary storage is the most
common, but tertiary storage is also possible. Each of these media has its own characteristics and
physical organization. Most are controlled by a device, such as a disk drive, that also has its own
unique characteristics. These properties include access speed, capacity, data-transfer rate, and
access method (sequential or random).
A file is a collection of related information defined by its creator. Commonly, files represent
programs (both source and object forms) and data. Data files may be numeric, alphabetic,
alphanumeric, or binary. Files may be free-form (for example, text files), or they may be formatted
rigidly (for example, fixed fields such as an mp3 music file). Clearly, the concept of a file is an
extremely general one.

The operating system implements the abstract concept of a file by managing mass storage media
and the devices that control them. In addition, files are normally organized into directories to make
them easier to use. Finally, when multiple users have access to files, it may be desirable to control
which user may access a file and how that user may access it (for example, read, write, append).
The operating system is responsible for the following activities in connection with file
management:

Creating and deleting files


Creating and deleting directories to organize files
Supporting primitives for manipulating files and directories
Mapping files onto mass storage
Backing up files on stable (nonvolatile) storage media ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
File-management techniques are discussed in chapter File-System Interface, chapter File-System
AbdlAzizOSCOct2022
Implementation, and chapter File-System Internals.

Mass-storage management

As we have already seen, the computer system must provide secondary storage to back up main
memory. Most modern computer systems use HDDs and NVM devices as the principal on-line
storage media for both programs and data. Most programs—including compilers, web browsers,
word processors, and games—are stored on these devices until loaded into memory. The
programs then use the devices as both the source and the destination of their processing. Hence,
the proper management of secondary storage is of central importance to a computer system. The
operating system is responsible for the following activities in connection with secondary storage
management:

Mounting and unmounting


Free-space management ©zyBooks 10/20/22 18:14 1496583
Storage allocation Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Disk scheduling
Partitioning
Protection

Because secondary storage is used frequently and extensively, it must be used efficiently. The
entire speed of operation of a computer may hinge on the speeds of the secondary storage
subsystem and the algorithms that manipulate that subsystem.

At the same time, there are many uses for storage that is slower and lower in cost (and sometimes
higher in capacity) than secondary storage. Backups of disk data, storage of seldom-used data,
and long-term archival storage are some examples. Magnetic tape drives and their tapes and CD,
DVD, and Blu-ray drives and platters are typical tertiary storage devices.

Tertiary storage is not crucial to system performance, but it still must be managed. Some
operating systems take on this task, while others leave tertiary-storage management to application
programs. Some of the functions that operating systems can provide include mounting and
unmounting media in devices, allocating and freeing the devices for exclusive use by processes,
and migrating data from secondary to tertiary storage.

Techniques for secondary storage and tertiary storage management are discussed in the chapter
Mass-Storage Structure.

Cache management

Caching is an important principle of computer systems. Here's how it works. Information is


normally kept in some storage system (such as main memory). As it is used, it is copied into a
faster storage system—the cache—on a temporary basis. When we need a particular piece of
information, we first check whether it is in the cache. If it is, we use the information directly from
the cache. If it is not, we use the information from the source, putting a copy in the cache under the
assumption that we will need it again soon.

In addition, internal programmable registers provide a high-speed©zyBooks


cache for10/20/22
main memory. The
18:14 1496583
programmer (or compiler) implements the register-allocation and register-replacement algorithms
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
to decide which information to keep in registers and which to keep in main memory.

Other caches are implemented totally in hardware. For instance, most systems have an instruction
cache to hold the instructions expected to be executed next. Without this cache, the CPU would
have to wait several cycles while an instruction was fetched from main memory. For similar
reasons, most systems have one or more high-speed data caches in the memory hierarchy. We are
not concerned with these hardware-only caches in this text, since they are outside the control of
the operating system.
Because caches have limited size, cache management is an important design problem. Careful
selection of the cache size and of a replacement policy can result in greatly increased
performance, as you can see by examining Figure 1.5.1. Replacement algorithms for software-
controlled caches are discussed in the chapter Virtual Memory.

Figure 1.5.1: Characteristics of various types of storage.


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

The movement of information between levels of a storage hierarchy may be either explicit or
implicit, depending on the hardware design and the controlling operating-system software. For
instance, data transfer from cache to CPU and registers is usually a hardware function, with no
operating-system intervention. In contrast, transfer of data from disk to memory is usually
controlled by the operating system.
In a hierarchical storage structure, the same data may appear in different levels of the storage
system. For example, suppose that an integer A that is to be incremented by 1 is located in file B,
and file B resides on hard disk. The increment operation proceeds by first issuing an I/O operation
to copy the disk block on which A resides to main memory. This operation is followed by copying A
to the cache and to an internal register. Thus, the copy of A appears in several places: on the hard
disk, in main memory, in the cache, and in an internal register (see Figure 1.5.2). Once the
increment takes place in the internal register, the value of A differs in the various storage systems.
The value of A becomes the same only after the new value of A is written from the internal register
back to the hard disk.

©zyBooks 10/20/22 18:14 1496583


Figure 1.5.2: Migration of integer A from disk to register.Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
In a computing environment where only one process executes at a time, this arrangement poses
no difficulties, since an access to integer A will always be to the copy at the highest level of the
hierarchy. However, in a multitasking environment, where the CPU is switched back and forth
among various processes, extreme care must be taken to ensure that, if several processes wish to
access A, then each of these processes will obtain the most recently updated value of A.
The situation becomes more complicated in a multiprocessor environment where, in addition to
maintaining internal registers, each of the CPUs also contains a local cache (refer back to Figure
©zyBooks 10/20/22 18:14 1496583
1.3.1). In such an environment, a copy of A may exist simultaneously inNoraisyah
several caches.
Abdl AzizSince the
AbdlAzizOSCOct2022
various CPUs can all execute in parallel, we must make sure that an update to the value of A in one
cache is immediately reflected in all other caches where A resides. This situation is called cache
coherency, and it is usually a hardware issue (handled below the operating-system level).

In a distributed environment, the situation becomes even more complex. In this environment,
several copies (or replicas) of the same file can be kept on different computers. Since the various
replicas may be accessed and updated concurrently, some distributed systems ensure that, when
a replica is updated in one place, all other replicas are brought up to date as soon as possible.
There are various ways to achieve this guarantee, as we discuss in the chapter Networks and
Distributed Systems.

I/O system management

One of the purposes of an operating system is to hide the peculiarities of specific hardware
devices from the user. For example, in UNIX, the peculiarities of I/O devices are hidden from the
bulk of the operating system itself by the I/O subsystem. The I/O subsystem consists of several
components:

A memory-management component that includes buffering, caching, and spooling


A general device-driver interface
Drivers for specific hardware devices

Only the device driver knows the peculiarities of the specific device to which it is assigned.
We discussed earlier in this chapter how interrupt handlers and device drivers are used in the
construction of efficient I/O subsystems. In the chapter I/O Systems, we discuss how the I/O
subsystem interfaces to the other system components, manages devices, transfers data, and
detects I/O completion.

PARTICIPATION
ACTIVITY
1.5.1: Section review questions.

©zyBooks 10/20/22 18:14 1496583


1) Two important design issues for Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
cache memory are ___.
speed and volatility
size and replacement policy
size and access privileges

2) A/an ___ is an instance of a program


in execution.
process
operating system
program counter

©zyBooks 10/20/22 18:14 1496583


Section glossary Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

resource manager: The role of an operating system in managing the computer's


resources.

program counter: A CPU register indicating the main memory location of the next
instruction to load and execute.

file: The smallest logical storage unit; a collection of related information defined by
its creator.
caching: The use of temporary data storage areas to improve performance.

cache management: The management of a cache's contents.

cache coherency: The coordination of the contents of caches such that an update
to a value stored in one cache is immediately reflected in all other caches that hold
that value.

I/O subsystem: The I/O devices and the part of the kernel that manages I/O.

1.6 Security and protection


If a computer system has multiple users and allows the concurrent execution of multiple
processes, then access to data must be regulated. For that purpose, mechanisms ensure that files,
memory segments, CPU, and other resources can be operated on by only those processes that
have gained proper authorization from the operating system. For example, memory-addressing
hardware ensures that a process can execute only within its own©zyBooks
address space.
10/20/22The timer
18:14 1496583
Noraisyah Abdl Aziz
ensures that no process can gain control of the CPU without eventually relinquishing control.
AbdlAzizOSCOct2022
Device-control registers are not accessible to users, so the integrity of the various peripheral
devices is protected.
Protection, then, is any mechanism for controlling the access of processes or users to the
resources defined by a computer system. This mechanism must provide means to specify the
controls to be imposed and to enforce the controls.
Protection can improve reliability by detecting latent errors at the interfaces between component
subsystems. Early detection of interface errors can often prevent contamination of a healthy
subsystem by another subsystem that is malfunctioning. Furthermore, an unprotected resource
cannot defend against use (or misuse) by an unauthorized or incompetent user. A protection-
oriented system provides a means to distinguish between authorized and unauthorized usage, as
we discuss in the chapter Protection.
A system can have adequate protection but still be prone to failure and allow inappropriate access.
©zyBooks 10/20/22 18:14 1496583
Consider a user whose authentication information (her means of identifying herself
Noraisyah AbdltoAziz
the system)
AbdlAzizOSCOct2022
is stolen. Her data could be copied or deleted, even though file and memory protection are working.
It is the job of security to defend a system from external and internal attacks. Such attacks spread
across a huge range and include viruses and worms, denial-of-service attacks (which use all of a
system's resources and so keep legitimate users out of the system), identity theft, and theft of
service (unauthorized use of a system). Prevention of some of these attacks is considered an
operating-system function on some systems, while other systems leave it to policy or additional
software. Due to the alarming rise in security incidents, operating-system security features are a
fast-growing area of research and implementation. We discuss security in the chapter Security.

Protection and security require the system to be able to distinguish among all its users. Most
operating systems maintain a list of user names and associated user identifiers (user IDs). In
Windows parlance, this is a security ID (SID). These numerical IDs are unique, one per user. When a
user logs in to the system, the authentication stage determines the appropriate user ID for the
user. That user ID is associated with all of the user's processes and threads. When an ID needs to
be readable by a user, it is translated back to the user name via the user name list.

In some circumstances, we wish to distinguish among sets of users rather than individual users.
For example, the owner of a file on a UNIX system may be allowed to issue all operations on that
file, whereas a selected set of users may be allowed only to read the file. To accomplish this, we
need to define a group name and the set of users belonging to that group. Group functionality can
be implemented as a system-wide list of group names and group identifiers. A user can be in one
or more groups, depending on operating-system design decisions. The user's group IDs are also
included in every associated process and thread.
In the course of normal system use, the user ID and group ID for a user are sufficient. However, a
user sometimes needs to escalate privileges to gain extra permissions for an activity. The user
may need access to a device that is restricted, for example. Operating systems provide various
methods to allow privilege escalation. On UNIX, for instance, the setuid attribute on a program
causes that program to run with the user ID of the owner of the file, rather than the current user's
ID. The process runs with this effective UID until it turns off the extra privileges or terminates.

PARTICIPATION
©zyBooks 10/20/22 18:14 1496583
ACTIVITY
1.6.1: Section review questions. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

1) UNIX systems escalate privileges by


setting the _______ attribute.
effective user id
setuid
security id
Section glossary

protection: A category of system calls. Any mechanism for controlling the access
of processes or users to the resources defined by a computer system.
©zyBooks 10/20/22 18:14 1496583
security: The defense of a system from external and internal attacks. Such Abdl
Noraisyah attacks
Aziz
include viruses and worms, denial-of-service attacks, identity theft, and theft of
AbdlAzizOSCOct2022
service.
user identifier (user ID) (UID): A unique numerical user identifier.
user IDs: A unique numerical user identifier.

security ID (SID): In Windows, a value used to uniquely identify a user or group for
security purposes.

group identifier: Similar to a user identifier, but used to identify a group of users to
determine access rights.
escalate privileges: To gain extra permissions for an activity, as when a user needs
access to a device that is restricted.
effective UID: The UID the process is currently using, which can be different from
the login UID due to, e.g., escalating privileges.

1.7 Virtualization
Virtualization is a technology that allows us to abstract the hardware of a single computer (the
CPU, memory, disk drives, network interface cards, and so forth) into several different execution
environments, thereby creating the illusion that each separate environment is running on its own
private computer. These environments can be viewed as different individual operating systems (for
example, Windows and UNIX) that may be running at the same time and may interact with each
other. A user of a virtual machine can switch among the various operating systems in the same
way a user can switch among the various processes running concurrently in a single
©zyBooks 10/20/22 operating
18:14 1496583
system. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Virtualization allows operating systems to run as applications within other operating systems. At
first blush, there seems to be little reason for such functionality. But the virtualization industry is
vast and growing, which is a testament to its utility and importance.

Broadly speaking, virtualization software is one member of a class that also includes emulation.
Emulation, which involves simulating computer hardware in software, is typically used when the
source CPU type is different from the target CPU type. For example, when Apple switched from the
IBM Power CPU to the Intel x86 CPU for its desktop and laptop computers, it included an emulation
facility called "Rosetta," which allowed applications compiled for the IBM CPU to run on the Intel
CPU. That same concept can be extended to allow an entire operating system written for one
platform to run on another. Emulation comes at a heavy price, however. Every machine-level
instruction that runs natively on the source system must be translated to the equivalent function
on the target system, frequently resulting in several target instructions. If the source and target
CPUs have similar performance levels, the emulated code may run much more slowly than the
native code. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
With virtualization, in contrast, an operating system that is natively compiled for a particular CPU
architecture runs within another operating system also native to that CPU. Virtualization first came
about on IBM mainframes as a method for multiple users to run tasks concurrently. Running
multiple virtual machines allowed (and still allows) many users to run tasks on a system designed
for a single user. Later, in response to problems with running multiple Microsoft Windows
applications on the Intel x86 CPU, VMware created a new virtualization technology in the form of
an application that ran on Windows. That application ran one or more guest copies of Windows or
other native x86 operating systems, each running its own applications. (See Figure 1.7.1.) Windows
was the host operating system, and the VMware application was the virtual machine manager
(VMM). The VMM runs the guest operating systems, manages their resource use, and protects
each guest from the others.

Figure 1.7.1: A computer running (a) a single operating system and (b)
three virtual machines.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Even though modern operating systems are fully capable of running multiple applications reliably,
the use of virtualization continues to grow. On laptops and desktops, a VMM allows the user to
install multiple operating systems for exploration or to run applications written for operating
systems other than the native host. For example, an Apple laptop running macOS on the x86 CPU
can run a Windows 10 guest to allow execution of Windows applications. Companies writing
software for multiple operating systems can use virtualization to run all of those operating
systems on a single physical server for development, testing, and debugging. Within data centers,
virtualization has become a common method of executing and managing computing
environments. VMMs like VMware ESXand Citrix XenServer no longer run on host operating
systems but rather are the host operating systems, providing services and resource management
to virtual machine processes.
©zyBooks 10/20/22 18:14 1496583
With this text, we provide a Linux virtual machine that allows you to runNoraisyah
Linux—asAbdl
wellAziz
as the
development tools we provide—on your personal system regardless ofAbdlAzizOSCOct2022
your host operating system.
Full details of the features and implementation of virtualization can be found in a later chapter

PARTICIPATION
ACTIVITY
1.7.1: Section review questions.

1) _______ is a technology that abstracts


the hardware of an actual computer
into several different execution
environments.
Emulation
Host operating system
Virtualization

Section glossary

virtualization: A technology for abstracting the hardware of a single computer into


several different execution environments, thereby creating the illusion that each
environment is running on its own private computer.

virtual machine (VM): The abstraction of hardware allowing a virtual computer to


execute on a physical computer. Multiple virtual machines can run on a single
physical machine (and each can have a different operating system).
emulation: A methodology used to enable a process to run when the compiled
program's original (source) CPU type is different from the target CPU type on which
the program is to run.
©zyBooks 10/20/22 18:14 1496583
guest: In virtualization, an operating system running in a virtual environment (rather
Noraisyah Abdl Aziz
than natively on the computer hardware). AbdlAzizOSCOct2022

host: In virtualization, the location of the virtual machine manager, which runs
guest operating systems; generally, a computer.

virtual machine manager (VMM): The computer function that manages the virtual
machine; also called a hypervisor.
1.8 Distributed systems
A distributed system is a collection of physically separate, possibly heterogeneous computer
©zyBooks 10/20/22 18:14 1496583
systems that are networked to provide users with access to the variousNoraisyah
resources that
Abdl the system
Aziz
maintains. Access to a shared resource increases computation speed,AbdlAzizOSCOct2022
functionality, data
availability, and reliability. Some operating systems generalize network access as a form of file
access, with the details of networking contained in the network interface's device driver. Others
make users specifically invoke network functions. Generally, systems contain a mix of the two
modes—for example FTP and NFS. The protocols that create a distributed system can greatly
affect that system's utility and popularity.

A network, in the simplest terms, is a communication path between two or more systems.
Distributed systems depend on networking for their functionality. Networks vary by the protocols
used, the distances between nodes, and the transport media. TCP/IP is the most common network
protocol, and it provides the fundamental architecture of the Internet. Most operating systems
support TCP/IP, including all general-purpose ones. Some systems support proprietary protocols
to suit their needs. For an operating system, it is necessary only that a network protocol have an
interface device—a network adapter, for example—with a device driver to manage it, as well as
software to handle data. These concepts are discussed throughout this book.
Networks are characterized based on the distances between their nodes. A local-area network
(LAN) connects computers within a room, a building, or a campus. A wide-area network (WAN)
usually links buildings, cities, or countries. A global company may have a WAN to connect its
offices worldwide, for example. These networks may run one protocol or several protocols. The
continuing advent of new technologies brings about new forms of networks. For example, a
metropolitan-area network (MAN) could link buildings within a city. BlueTooth and 802.11 devices
use wireless technology to communicate over a distance of several feet, in essence creating a
personal-area network (PAN) between a phone and a headset or a smartphone and a desktop
computer.
The media to carry networks are equally varied. They include copper wires, fiber strands, and
wireless transmissions between satellites, microwave dishes, and radios. When computing devices
are connected to cellular phones, they create a network. Even very short-range infrared
communication can be used for networking. At a rudimentary level, whenever computers
communicate, they use or create a network. These networks also vary in their performance and
©zyBooks 10/20/22 18:14 1496583
reliability. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Some operating systems have taken the concept of networks and distributed systems further than
the notion of providing network connectivity. A network operating system is an operating system
that provides features such as file sharing across the network, along with a communication
scheme that allows different processes on different computers to exchange messages. A
computer running a network operating system acts autonomously from all other computers on the
network, although it is aware of the network and is able to communicate with other networked
computers. A distributed operating system provides a less autonomous environment. The different
computers communicate closely enough to provide the illusion that only a single operating system
controls the network. We cover computer networks and distributed systems in a later chapter.

PARTICIPATION
ACTIVITY
1.8.1: Section review questions.

1) Bluetooth devices use wireless


technology to communicate over ©zyBooks 10/20/22 18:14 1496583
several feet, in essence creating a Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
____.
local-area network
wide-area network
personal-area network

Section glossary

network: In the simplest terms, a communication path between two or more


systems.
transmission control protocol/Internet protocol (TCP/IP): The most common
network protocol; it provides the fundamental architecture of the Internet.
local-area network (LAN): A network that connects computers within a room, a
building, or a campus.

local-area network (LAN): A network that connects computers within a room, a


building, or a campus.

metropolitan-area network (MAN): A network linking buildings within a city.


personal-area network (PAN): A network linking devices within several feet of each
other (e.g., on a person).

network operating system: A type of operating system that provides features such
as file sharing across a network, along with a communication scheme that allows
different processes on different computers to exchange messages. It provides an
environment in which users can access remote resources by remote login or data
transfer between remote and local systems.
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

1.9 Kernel data structures


We turn next to a topic central to operating-system implementation: the way data are structured in
the system. In this section, we briefly describe several fundamental data structures used
extensively in operating systems. Readers who require further details on these structures, as well
as others, should consult the bibliography at the end of the chapter.

Lists, stacks, and queues

An array is a simple data structure in which each element can be©zyBooks


accessed10/20/22
directly.18:14
For example,
1496583
Noraisyah Abdl Aziz
main memory is constructed as an array. If the data item being stored is larger than one byte, then
AbdlAzizOSCOct2022
multiple bytes can be allocated to the item, and the item is addressed as "item number × item size."
But what about storing an item whose size may vary? And what about removing an item if the
relative positions of the remaining items must be preserved? In such situations, arrays give way to
other data structures.

After arrays, lists are perhaps the most fundamental data structures in computer science. Whereas
each item in an array can be accessed directly, the items in a list must be accessed in a particular
order. That is, a list represents a collection of data values as a sequence. The most common
method for implementing this structure is a linked list, in which items are linked to one another.
Linked lists are of several types:

In a singly linked list, each item points to its successor, as illustrated in Figure 1.9.1.

In a doubly linked list, a given item can refer either to its predecessor or to its successor, as
illustrated in Figure 1.9.2.

In a circularly linked list, the last element in the list refers to the first element, rather than to
null, as illustrated in Figure 1.9.3.

Figure 1.9.1: Singly linked list.

Figure 1.9.2: Doubly linked list. ©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Figure 1.9.3: Circularly linked list.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Linked lists accommodate items of varying sizes and allow easy insertion and deletion of items.
One potential disadvantage of using a list is that performance for retrieving a specified item in a list
of size n is linear—O(n), as it requires potentially traversing all n elements in the worst case. Lists
are sometimes used directly by kernel algorithms. Frequently, though, they are used for
constructing more powerful data structures, such as stacks and queues.

A stack is a sequentially ordered data structure that uses the last in, first out (LIFO) principle for
adding and removing items, meaning that the last item placed onto a stack is the first item
removed. The operations for inserting and removing items from a stack are known as push and
pop, respectively. An operating system often uses a stack when invoking function calls.
Parameters, local variables, and the return address are pushed onto the stack when a function is
called; returning from the function call pops those items off the stack.

A queue, in contrast, is a sequentially ordered data structure that uses the first in, first out (FIFO)
principle: items are removed from a queue in the order in which they were inserted. There are many
everyday examples of queues, including shoppers waiting in a checkout line at a store and cars
waiting in line at a traffic signal. Queues are also quite common in operating systems—jobs that
are sent to a printer are typically printed in the order in which they were submitted, for example. As
we shall see in the chapter CPU Scheduling, tasks that are waiting to be run on an available CPU
are often organized in queues.

Trees

A tree is a data structure that can be used to represent data hierarchically. Data values in a tree
structure are linked through parent-child relationships. In a general tree, a parent may have an
unlimited number of children. In a binary tree, a parent may have at most two children, which we
term the left child and the right child. A binary search tree additionally requires an ordering
between the parent's two children in which left_child <= right_child. Figure 1.9.4 provides an
©zyBooks 10/20/22 18:14 1496583
example of a binary search tree. When we search for an item in a binaryNoraisyah
search tree,
Abdlthe
Azizworst-
case performance is O (n ) (consider how this can occur). To remedy this situation, we can use an
AbdlAzizOSCOct2022
algorithm to create a balanced binary search tree. Here, a tree containing n items has at most
lg n levels, thus ensuring worst-case performance of O (lg n ). We shall see Section

Example:Linux Scheudling in a later section that Linux uses a balanced binary search tree (known
as a red-black tree) as part its CPU-scheduling algorithm.

Figure 1.9.4: Binary search tree.


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Hash functions and maps

A hash function takes data as its input, performs a numeric operation on the data, and returns a
numeric value. This numeric value can then be used as an index into a table (typically an array) to
quickly retrieve the data. Whereas searching for a data item through a list of size n can require up
to O(n) comparisons, using a hash function for retrieving data from a table can be as good as O(1),
depending on implementation details. Because of this performance, hash functions are used
extensively in operating systems.

One potential difficulty with hash functions is that two unique inputs can result in the same output
value—that is, they can link to the same table location. We can accommodate this hash collision by
having a linked list at the table location that contains all of the items with the same hash value. Of
course, the more collisions there are, the less efficient the hash function is.
One use of a hash function is to implement a hash map, which associates (or maps) [key:value]
pairs using a hash function. Once the mapping is established, we can apply the hash function to
the key to obtain the value from the hash map (Figure 1.9.5). For example, suppose that a user
name is mapped to a password. Password authentication then proceeds as follows: a user enters
her user name and password. The hash function is applied to the user name, which is then used to
retrieve the password. The retrieved password is then compared with the password entered by the
user for authentication.

©zyBooks 10/20/22 18:14 1496583


Figure 1.9.5: Hash map. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Bitmaps

A bitmap is a string of n binary digits that can be used to represent the status of n items. For
example, suppose we have several resources, and the availability of each resource is indicated by
the value of a binary digit: 0 means that the resource is available, while 1 indicates that it is
unavailable (or vice versa). The value of the ith position in the bitmap is associated with the ith
resource. As an example, consider the bitmap shown below:

0 0 1 0 1 1 1 0 1

Resources 2, 4, 5, 6, and 8 are unavailable; resources 0, 1, 3, and 7 are available.

Linux kernel data structures

The data structures used in the Linux kernel are available in the kernel source code.
The include file <linux/list.h> provides details of the linked-list data structure
used throughout the kernel. A queue in Linux is known as a kfifo, and its
implementation can be found in the kfifo.c file in the kernel directory of the
source code. Linux also provides a balanced binary search tree implementation
using red-black trees. Details can be found in the include file <linux/rbtree.h>.

The power of bitmaps becomes apparent when we consider their space efficiency. If we were to
use an eight-bit Boolean value instead of a single bit, the resulting©zyBooks 10/20/22
data structure 18:14be
would 1496583
eight
Noraisyah Abdl Aziz
times larger. Thus, bitmaps are commonly used when there is a need to represent the availability of
AbdlAzizOSCOct2022
a large number of resources. Disk drives provide a nice illustration. A medium-sized disk drive
might be divided into several thousand individual units, called disk blocks. A bitmap can be used to
indicate the availability of each disk block.

In summary, data structures are pervasive in operating system implementations. Thus, we will see
the structures discussed here, along with others, throughout this text as we explore kernel
algorithms and their implementations.
PARTICIPATION
ACTIVITY
1.9.1: Section review questions.

1) A stack uses the ______ principle for


organizing data while a queue uses
the ________ principle.
FIFO, LIFO
©zyBooks 10/20/22 18:14 1496583
LIFO, FIFO Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
left child, right child

2) A ________ associates [key:value]


pairs.
hash map
hash function
hash collision

Section glossary

list: A data structure that presents a collection of data values as a sequence.

linked list: A data structure in which items are linked to one another.

stack: A sequentially ordered data structure that uses the last-in, first-out (LIFO)
principle for adding and removing items; the last item placed onto a stack is the
first item removed.

queue: A sequentially ordered data structure that uses the first-in, first-out (FIFO)
principle; items are removed from a queue in the order in which they were inserted.

tree: A data structure that can be used to represent data hierarchically; data values
in a tree structure are linked through parent-child relationships.

general tree: A tree data structure in which a parent may have unlimited children.

binary tree: A tree data structure in which a parent may have at most two children.

binary search tree: A type of binary tree data structure that requires an ordering
between the parent's two children in which left child <= right©zyBooks
child. 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
balanced binary search tree: A tree containing n items that has, at most, lg n
AbdlAzizOSCOct2022
levels, thus ensuring worst-case performance of O (lg n).
red-black tree: A tree containing n items and having at most lg n levels, thus
ensuring worst-case performance of O(lg n).
hash function: A function that takes data as its input, performs a numeric operation
on the data, and returns a numeric value. Also, an algorithm for creating a hash (a
small, fixed-size block of data calculated from a larger data set, used to determine
if a message has been changed).

hash map: A data structure that maps [key:value] pairs using a hash function; a
hash function can then be applied to a key to obtain its matching value.

bitmap: A string of n binary digits that can be used to represent the status of n
items. The availability of each item is indicated by the value of a binary digit: 0
means that the resource is available, while 1 indicates that ©zyBooks
it is unavailable (or18:14
10/20/22 vice-1496583
Noraisyah Abdl Aziz
versa).
AbdlAzizOSCOct2022

1.10 Computing environments


So far, we have briefly described several aspects of computer systems and the operating systems
that manage them. We turn now to a discussion of how operating systems are used in a variety of
computing environments.

Traditional computing

As computing has matured, the lines separating many of the traditional computing environments
have blurred. Consider the "typical office environment." Just a few years ago, this environment
consisted of PCs connected to a network, with servers providing file and print services. Remote
access was awkward, and portability was achieved by use of laptop computers.
Today, web technologies and increasing WAN bandwidth are stretching the boundaries of
traditional computing. Companies establish portals, which provide web accessibility to their
internal servers. Network computers (or thin clients)—which are essentially terminals that
understand web-based computing—are used in place of traditional workstations where more
security or easier maintenance is desired. Mobile computers can synchronize with PCs to allow
very portable use of company information. Mobile devices can also connect to wireless networks
and cellular data networks to use the company's web portal (as well as the myriad other web
resources).
At home, most users once had a single computer with a slow modem connection to the office, the
Internet, or both. Today, network-connection speeds once available only at great cost are relatively
inexpensive in many places, giving home users more access to more data. These fast data
connections are allowing home computers to serve up web pages ©zyBooks 10/20/22
and to run 18:14that
networks 1496583
include
Noraisyah Abdl Aziz
printers, client PCs, and servers. Many homes use firewalls to protect their networks from security
AbdlAzizOSCOct2022
breaches. Firewalls limit the communications between devices on a network.
In the latter half of the 20th century, computing resources were relatively scarce. (Before that, they
were nonexistent!) For a period of time, systems were either batch or interactive. Batch systems
processed jobs in bulk, with predetermined input from files or other data sources. Interactive
systems waited for input from users. To optimize the use of the computing resources, multiple
users shared time on these systems. These time-sharing systems used a timer and scheduling
algorithms to cycle processes rapidly through the CPU, giving each user a share of the resources.

Traditional time-sharing systems are rare today. The same scheduling technique is still in use on
desktop computers, laptops, servers, and even mobile computers, but frequently all the processes
are owned by the same user (or a single user and the operating system). User processes, and
system processes that provide services to the user, are managed so that each frequently gets a
slice of computer time. Consider the windows created while a user is working on a PC, for
©zyBooks 10/20/22 18:14 1496583
example, and the fact that they may be performing different tasks at theNoraisyah
same time.
AbdlEven
Aziz a web
browser can be composed of multiple processes, one for each websiteAbdlAzizOSCOct2022
currently being visited, with
time sharing applied to each web browser process.

Mobile computing

Mobile computing refers to computing on handheld smartphones and tablet computers. These
devices share the distinguishing physical features of being portable and lightweight. Historically,
compared with desktop and laptop computers, mobile systems gave up screen size, memory
capacity, and overall functionality in return for handheld mobile access to services such as e-mail
and web browsing. Over the past few years, however, features on mobile devices have become so
rich that the distinction in functionality between, say, a consumer laptop and a tablet computer
may be difficult to discern. In fact, we might argue that the features of a contemporary mobile
device allow it to provide functionality that is either unavailable or impractical on a desktop or
laptop computer.
Today, mobile systems are used not only for e-mail and web browsing but also for playing music
and video, reading digital books, taking photos, and recording and editing high-definition video.
Accordingly, tremendous growth continues in the wide range of applications that run on such
devices. Many developers are now designing applications that take advantage of the unique
features of mobile devices, such as global positioning system (GPS) chips, accelerometers, and
gyroscopes. An embedded GPS chip allows a mobile device to use satellites to determine its
precise location on Earth. That functionality is especially useful in designing applications that
provide navigation—for example, telling users which way to walk or drive or perhaps directing them
to nearby services, such as restaurants. An accelerometer allows a mobile device to detect its
orientation with respect to the ground and to detect certain other forces, such as tilting and
shaking. In several computer games that employ accelerometers, players interface with the
system not by using a mouse or a keyboard but rather by tilting, rotating, and shaking the mobile
device! Perhaps more a practical use of these features is found in augmented-reality applications,
which overlay information on a display of the current environment. It is difficult to imagine how
equivalent applications could be developed on traditional laptop or desktop computer systems.
©zyBooks 10/20/22 18:14 1496583
To provide access to on-line services, mobile devices typically use eitherNoraisyah
IEEE standard 802.11
Abdl Aziz
AbdlAzizOSCOct2022
wireless or cellular data networks. The memory capacity and processing speed of mobile devices,
however, are more limited than those of PCs. Whereas a smartphone or tablet may have 256 GB in
storage, it is not uncommon to find 8 TB in storage on a desktop computer. Similarly, because
power consumption is such a concern, mobile devices often use processors that are smaller, are
slower, and offer fewer processing cores than processors found on traditional desktop and laptop
computers.
Two operating systems currently dominate mobile computing: Apple iOS and Google Android. iOS
was designed to run on Apple iPhone and iPad mobile devices. Android powers smartphones and
tablet computers available from many manufacturers. We examine these two mobile operating
systems in further detail in the next chapter Operating-System Structures.

Client-server computing

Contemporary network architecture features arrangements in which server10/20/22


©zyBooks systems satisfy
18:14 1496583
Noraisyah Abdl Aziz
requests generated by client systems. This form of specialized distributed system, called a client-
AbdlAzizOSCOct2022
server system, has the general structure depicted in Figure 1.10.1.

Figure 1.10.1: General structure of a client-server system.

Server systems can be broadly categorized as compute servers and file servers:

The compute-server system provides an interface to which a client can send a request to
perform an action (for example, read data). In response, the server executes the action and
sends the results to the client. A server running a database that responds to client requests
for data is an example of such a system.
The file-server system provides a file-system interface where clients can create, update,
read, and delete files. An example of such a system is a web server that delivers files to
clients running web browsers. The actual contents of the files can vary greatly, ranging from
traditional web pages to rich multimedia content such as high-definition video.

Peer-to-peer computing
©zyBooks 10/20/22 18:14 1496583
Another structure for a distributed system is the peer-to-peer (P2P) system model.
Noraisyah In Aziz
Abdl this model,
clients and servers are not distinguished from one another. Instead, all AbdlAzizOSCOct2022
nodes within the system are
considered peers, and each may act as either a client or a server, depending on whether it is
requesting or providing a service. Peer-to-peer systems offer an advantage over traditional client-
server systems. In a client-server system, the server is a bottleneck; but in a peer-to-peer system,
services can be provided by several nodes distributed throughout the network.

To participate in a peer-to-peer system, a node must first join the network of peers. Once a node
has joined the network, it can begin providing services to—and requesting services from—other
nodes in the network. Determining what services are available is accomplished in one of two
general ways:

When a node joins a network, it registers its service with a centralized lookup service on the
network. Any node desiring a specific service first contacts this centralized lookup service to
determine which node provides the service. The remainder of the communication takes
place between the client and the service provider.
©zyBooksa 10/20/22
An alternative scheme uses no centralized lookup service. Instead, 18:14
peer acting as1496583
a client
Noraisyah Abdl Aziz
must discover what node provides a desired service by broadcasting a request for the
AbdlAzizOSCOct2022
service to all other nodes in the network. The node (or nodes) providing that service responds
to the peer making the request. To support this approach, a discovery protocol must be
provided that allows peers to discover services provided by other peers in the network. Figure
1.10.2 illustrates such a scenario.

Figure 1.10.2: Peer-to-peer system with no centralized service.

Peer-to-peer networks gained widespread popularity in the late 1990s with several file-sharing
services, such as Napster and Gnutella, that enabled peers to exchange files with one another. The
Napster system used an approach similar to the first type described above: a centralized server
maintained an index of all files stored on peer nodes in the Napster network, and the actual
exchange of files took place between the peer nodes. The Gnutella system used a technique
similar to the second type: a client broadcast file requests to other nodes in the system, and nodes
©zyBooks 10/20/22
that could service the request responded directly to the client. Peer-to-peer networks18:14
can1496583
be used
Noraisyah Abdl Aziz
to exchange copyrighted materials (music, for example) anonymously,AbdlAzizOSCOct2022
and there are laws
governing the distribution of copyrighted material. Notably, Napster ran into legal trouble for
copyright infringement, and its services were shut down in 2001. For this reason, the future of
exchanging files remains uncertain.

Skype is another example of peer-to-peer computing. It allows clients to make voice calls and
video calls and to send text messages over the Internet using a technology known as voice over IP
(VoIP). Skype uses a hybrid peer-to-peer approach. It includes a centralized login server, but it also
incorporates decentralized peers and allows two peers to communicate.

Cloud computing

Cloud computing is a type of computing that delivers computing, storage, and even applications as
a service across a network. In some ways, it's a logical extension of virtualization, because it uses
virtualization as a base for its functionality. For example, the Amazon Elastic
©zyBooks Compute
10/20/22 18:14Cloud (ec2)
1496583
Noraisyah
facility has thousands of servers, millions of virtual machines, and petabytes Abdl Aziz
of storage available
AbdlAzizOSCOct2022
for use by anyone on the Internet. Users pay per month based on how much of those resources
they use. There are actually many types of cloud computing, including the following:

Public cloud—a cloud available via the Internet to anyone willing to pay for the services

Private cloud—a cloud run by a company for that company's own use

Hybrid cloud—a cloud that includes both public and private cloud components

Software as a service (SaaS)—one or more applications (such as word processors or


spreadsheets) available via the Internet

Platform as a service (PaaS)—a software stack ready for application use via the Internet (for
example, a database server)

Infrastructure as a service (IaaS)—servers or storage available over the Internet (for example,
storage available for making backup copies of production data)

These cloud-computing types are not discrete, as a cloud computing environment may provide a
combination of several types. For example, an organization may provide both SaaS and IaaS as
publicly available services.

Certainly, there are traditional operating systems within many of the types of cloud infrastructure.
Beyond those are the VMMs that manage the virtual machines in which the user processes run. At
a higher level, the VMMs themselves are managed by cloud management tools, such as VMware
vCloud Director and the open-source Eucalyptus toolset. These tools manage the resources within
a given cloud and provide interfaces to the cloud components, making a good argument for
considering them a new type of operating system.

Figure 1.10.3 illustrates a public cloud providing IaaS. Notice that both the cloud services and the
cloud user interface are protected by a firewall.

Figure 1.10.3: Cloud computing. ©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Real-time embedded systems

Embedded computers are the most prevalent form of computers in existence. These devices are
found everywhere, from car engines and manufacturing robots to optical drives and microwave
ovens. They tend to have very specific tasks. The systems they run on are usually primitive, and so
the operating systems provide limited features. Usually, they have little or no user interface,
preferring to spend their time monitoring and managing hardware devices, such as automobile
engines and robotic arms.

These embedded systems vary considerably. Some are general-purpose computers, running
standard operating systems—such as Linux—with special-purpose applications to implement the
functionality. Others are hardware devices with a special-purpose embedded operating system
providing just the functionality desired. Yet others are hardware devices with application-specific
integrated circuits (ASICs) that perform their tasks without an operating system.
The use of embedded systems continues to expand. The power of these devices, both as
standalone units and as elements of networks and the web, is sure to increase
©zyBooks as well.
10/20/22 18:14Even now,
1496583
Noraisyah Abdl Aziz
entire houses can be computerized, so that a central computer—either a general-purpose
AbdlAzizOSCOct2022
computer or an embedded system—can control heating and lighting, alarm systems, and even
coffee makers. Web access can enable a home owner to tell the house to heat up before she
arrives home. Someday, the refrigerator will be able to notify the grocery store when it notices the
milk is gone.
Embedded systems almost always run real-time operating systems. A real-time system is used
when rigid time requirements have been placed on the operation of a processor or the flow of data;
thus, it is often used as a control device in a dedicated application. Sensors bring data to the
computer. The computer must analyze the data and possibly adjust controls to modify the sensor
inputs. Systems that control scientific experiments, medical imaging systems, industrial control
systems, and certain display systems are real-time systems. Some automobile-engine fuel-
injection systems, home-appliance controllers, and weapon systems are also real-time systems.

A real-time system has well-defined, fixed time constraints. Processing must be done within the
defined constraints, or the system will fail. For instance, it would not do for a robot arm to be
©zyBooks 10/20/22 18:14 1496583
instructed to halt after it had smashed into the car it was building. A real-time system
Noraisyah functions
Abdl Aziz
AbdlAzizOSCOct2022
correctly only if it returns the correct result within its time constraints. Contrast this system with a
traditional laptop system where it is desirable (but not mandatory) to respond quickly.
In the chapter CPU Scheduling, we consider the scheduling facility needed to implement real-time
functionality in an operating system, and in the chapter The Linux System, we describe the real-
time components of Linux.

PARTICIPATION
ACTIVITY
1.10.1: Section review questions.

1) Embedded computers typically run


on a ____ operating system.
real-time
mobile
client-server

2) Which of the following is a property


of peer-to-peer systems?
Clients and servers are not
distinguished from one
another.
Peer-to-peer systems do not
offer any advantages over
traditional client-server
systems.
Peer-to-peer systems suffer
from the server acting as the
bottleneck in performance.
©zyBooks 10/20/22 18:14 1496583
3) Examples of the _______ model
Noraisyah Abdl Aziz
include applications such as word AbdlAzizOSCOct2022
processors or spreadsheets that run
in the cloud and may be accessed via
the internet.
platform as a service
hybrid cloud
software as a service
4) A _____ provides a file-system
interface which allows clients to
create and modify files.
compute-server system
file-server system
software as a service ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

Section glossary

portals: Gateways between requestors and services running on provider


computers.
network computer: A limited computer that understands only web-based
computing.

thin client: A limited computer (terminal) used for web-based computing.


wireless network: A communication network composed of radio signals rather
than physical wires.
firewall: A computer, appliance, process, or network router that sits between
trusted and untrusted systems or devices. It protects a network from security
breaches by managing and blocking certain types of communications.
mobile computing: A mode of computing involving small portable devices like
smartphones and tablet computers.

Apple iOS: The mobile operating system created by Apple Inc.

Google Android: The mobile operating system created by Google Inc.

server system: A system providing services to other computers (e.g., a web server).

client system: A computer that uses services from other computers (such as a
web client).

client-server model: A mode of computing in which a server provides services to


one or more clients. In distributed computing, a model in which a computer acts as
a resource server to other computers that are clients of those resources.
©zyBooks 10/20/22 18:14 1496583
compute-server system: A server that provides an interface to which a client
Noraisyah canAziz
Abdl
AbdlAzizOSCOct2022
send a request for an action (e.g., read data). In response, the server executes the
action and sends the results to the client.
file-server system: A server that provides a file-system interface where clients can
create, update, read, and delete files (e.g., a web server that delivers files to clients
running web browsers).
cloud computing: A computing environment in which hardware, software, or other
resources are made available to customers across a WAN, such as the Internet,
usually with APIs for management. A type of computing that delivers computing,
storage, and even applications "as a service" across a network.

Amazon Elastic Compute Cloud (ec2): An instance of cloud computing


implemented by Amazon.

public cloud: Cloud computing available via the Internet to anyone willing
©zyBooks to pay
10/20/22 for1496583
18:14
the services offered. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
private cloud: Cloud computing run by a company for that company's own use.

hybrid cloud: A type of cloud computing that includes both public and private cloud
components.
Software as a Service (SaaS): A type of computing in which one or more
applications (such as word processors or spreadsheets) are available as a service
via the Internet.
platform as a service (PaaS): A software stack ready for application use via the
Internet (e.g., a database server).
infrastructure as a service (IaaS): A type of computing in which servers or storage
are available over the Internet (e.g, storage available for making backup copies of
production data).

ASIC: An application-specific integrated circuit (hardware chip) that performs its


tasks without an operating system.

real-time operating systems (RTOS): Systems used when rigid time requirements
have been placed on the operation of a processor or the flow of data; often used as
control devices in dedicated applications.

1.11 Free and open-source operating systems


The study of operating systems has been made easier by the availability of a vast number of free
software and open-source releases. Both free operating systems and open-source operating
systems are available in source-code format rather than as compiled binary code. Note, though,
©zyBooks
that free software and open-source software are two different ideas 10/20/22by
championed 18:14 1496583
different
Noraisyah Abdl Aziz
groups of people (see http://gnu.org/philosophy/open-source-misses-the-point.html for a
AbdlAzizOSCOct2022
discussion on the topic). Free software (sometimes referred to as free/libre software) not only
makes source code available but also is licensed to allow no-cost use, redistribution, and
modification. Open-source software does not necessarily offer such licensing. Thus, although all
free software is open source, some open-source software is not "free." GNU/Linux is the most
famous open-source operating system, with some distributions free and others open source only
(http://www.gnu.org/distros/). Microsoft Windows is a well-known example of the opposite
closed-source approach. Windows is proprietary software—Microsoft owns it, restricts its use, and
carefully protects its source code. Apple's macOS operating system comprises a hybrid approach.
It contains an open-source kernel named Darwin but includes proprietary, closed-source
components as well.

Starting with the source code allows the programmer to produce binary code that can be executed
on a system. Doing the opposite—reverse engineering the source code from the binaries—is quite
a lot of work, and useful items such as comments are never recovered. Learning operating
systems by examining the source code has other benefits as well. With the source code in hand, a
©zyBooks 10/20/22 18:14 1496583
student can modify the operating system and then compile and run theNoraisyah
code to try outAziz
Abdl those
changes, which is an excellent learning tool. This text includes projectsAbdlAzizOSCOct2022
that involve modifying
operating-system source code, while also describing algorithms at a high level to be sure all
important operating-system topics are covered. Throughout the text, we provide pointers to
examples of open-source code for deeper study.

There are many benefits to open-source operating systems, including a community of interested
(and usually unpaid) programmers who contribute to the code by helping to write it, debug it,
analyze it, provide support, and suggest changes. Arguably, open-source code is more secure than
closed-source code because many more eyes are viewing the code. Certainly, open-source code
has bugs, but open-source advocates argue that bugs tend to be found and fixed faster owing to
the number of people using and viewing the code. Companies that earn revenue from selling their
programs often hesitate to open-source their code, but Red Hat and a myriad of other companies
are doing just that and showing that commercial companies benefit, rather than suffer, when they
open-source their code. Revenue can be generated through support contracts and the sale of
hardware on which the software runs, for example.

History

In the early days of modern computing (that is, the 1950s), software generally came with source
code. The original hackers (computer enthusiasts) at MIT's Tech Model Railroad Club left their
programs in drawers for others to work on. "Homebrew" user groups exchanged code during their
meetings. Company-specific user groups, such as Digital Equipment Corporation's DECUS,
accepted contributions of source-code programs, collected them onto tapes, and distributed the
tapes to interested members. In 1970, Digital's operating systems were distributed as source code
with no restrictions or copyright notice.
Computer and software companies eventually sought to limit the use of their software to
authorized computers and paying customers. Releasing only the binary files compiled from the
source code, rather than the source code itself, helped them to achieve this goal, as well as
protecting their code and their ideas from their competitors. Although the Homebrew user groups
of the 1970s exchanged code during their meetings, the operating systems10/20/22
©zyBooks for hobbyist
18:14 machines
1496583
(such as CPM) were proprietary. By 1980, proprietary software was the Noraisyah
usual case.
Abdl Aziz
AbdlAzizOSCOct2022

Free operating systems

To counter the move to limit software use and redistribution, Richard Stallman in 1984 started
developing a free, UNIX-compatible operating system called GNU (which is a recursive acronym for
"GNU's Not Unix!"). To Stallman, "free" refers to freedom of use, not price. The free-software
movement does not object to trading a copy for an amount of money but holds that users are
entitled to four certain freedoms: (1) to freely run the program, (2) to study and change the source
code, and to give or sell copies either (3) with or (4) without changes. In 1985, Stallman published
the GNU Manifesto, which argues that all software should be free. He also formed the Free
Software Foundation (FSF) with the goal of encouraging the use and development of free software.

The FSF uses the copyrights on its programs to implement "copyleft," a form of licensing invented
by Stallman. Copylefting a work gives anyone that possesses a copy of the work the four essential
freedoms that make the work free, with the condition that redistribution must preserve these
©zyBooks 10/20/22 18:14 1496583
freedoms. The GNU General Public License (GPL) is a common licenseNoraisyah
under which
Abdlfree
Azizsoftware
AbdlAzizOSCOct2022
is released. Fundamentally, the GPL requires that the source code be distributed with any binaries
and that all copies (including modified versions) be released under the same GPL license. The
Creative Commons "Attribution Sharealike" license is also a copyleft license; "sharealike" is another
way of stating the idea of copyleft.

GNU/linux

As an example of a free and open-source operating system, consider GNU/Linux. By 1991, the GNU
operating system was nearly complete. The GNU Project had developed compilers, editors, utilities,
libraries, and games—whatever parts it could not find elsewhere. However, the GNU kernel never
became ready for prime time. In 1991, a student in Finland, Linus Torvalds, released a rudimentary
UNIX-like kernel using the GNU compilers and tools and invited contributions worldwide. The
advent of the Internet meant that anyone interested could download the source code, modify it,
and submit changes to Torvalds. Releasing updates once a week allowed this so-called "Linux"
operating system to grow rapidly, enhanced by several thousand programmers. In 1991, Linux was
not free software, as its license permitted only noncommercial redistribution. In 1992, however,
Torvalds rereleased Linux under the GPL, making it free software (and also, to use a term coined
later, "open source").

The resulting GNU/Linux operating system (with the kernel properly called Linux but the full
operating system including GNU tools called GNU/Linux) has spawned hundreds of unique
distributions, or custom builds, of the system. Major distributions include Red Hat, SUSE, Fedora,
Debian, Slackware, and Ubuntu. Distributions vary in function, utility, installed applications,
hardware support, user interface, and purpose. For example, Red Hat Enterprise Linux is geared to
large commercial use. PCLinuxOS is a live CD—an operating system that can be booted and run
from a CD-ROM without being installed on a system's boot disk. A variant of PCLOS—called PCLOS
Supergamer DVD—is a live DVD that includes graphics drivers and games. A gamer can run it on
any compatible system simply by booting from the DVD. When the gamer is finished, a reboot of
the system resets it to its installed operating system.

You can run Linux on a Windows (or other) system using the following simple,
©zyBooks free 18:14
10/20/22 approach:
1496583
Noraisyah Abdl Aziz
1. Download the free Virtualbox VMM tool from https://www.virtualbox.org/ and install it on
AbdlAzizOSCOct2022
your system.
2. Choose to install an operating system from scratch, based on an installation image like a CD,
or choose pre-built operating-system images that can be installed and run more quickly from
a site like http://virtualboxes.org/images/. These images are preinstalled with operating
systems and applications and include many flavors of GNU/Linux.
3. Boot the virtual machine within Virtualbox.
An alternative to using Virtualbox is to use the free program Qemu
(http://wiki.qemu.org/Download/), which includes the qemu-img command for converting
Virtualbox images to Qemu images to easily import them.
With this text, we provide a virtual machine image of GNU/Linux running the Ubuntu release. This
image contains the GNU/Linux source code as well as tools for software development. We cover
examples involving the GNU/Linux image throughout this text, as well as in a detailed case study in
the chapter The Linux System.
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
BSD unix AbdlAzizOSCOct2022

BSD UNIX has a longer and more complicated history than Linux. It started in 1978 as a derivative
of AT&T's UNIX. Releases from the University of California at Berkeley (UCB) came in source and
binary form, but they were not open source because a license from AT&T was required. BSD UNIX's
development was slowed by a lawsuit by AT&T, but eventually a fully functional, open-source
version, 4.4BSD-lite, was released in 1994.

Just as with Linux, there are many distributions of BSD UNIX, including FreeBSD, NetBSD,
OpenBSD, and DragonflyBSD. To explore the source code of FreeBSD, simply download the virtual
machine image of the version of interest and boot it within Virtualbox, as described above for
Linux. The source code comes with the distribution and is stored in /usr/src/. The kernel source
code is in /usr/src/sys. For example, to examine the virtual memory implementation code in the
FreeBSD kernel, see the files in /usr/src/sys/vm. Alternatively, you can simply view the source
code online at https://svnweb.freebsd.org.

As with many open-source projects, this source code is contained in and controlled by a version
control system—in this case, "subversion" (https://subversion.apache.org/source-code). Version
control systems allow a user to "pull" an entire source code tree to his computer and "push" any
changes back into the repository for others to then pull. These systems also provide other features,
including an entire history of each file and a conflict resolution feature in case the same file is
changed concurrently. Another version control system is git, which is used for GNU/Linux, as well
as other programs (http://www.git-scm.com).

Darwin, the core kernel component of macOS, is based on BSD UNIX and is open-sourced as well.
That source code is available from http://www.opensource.apple.com/. Every macOS release has
its open-source components posted at that site. The name of the package that contains the kernel
begins with "xnu." Apple also provides extensive developer tools, documentation, and support at
http://developer.apple.com.

The study of operating systems ©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

There has never been a more interesting time to study operating systems, and it
has never been easier. The open-source movement has overtaken operating
systems, causing many of them to be made available in both source and binary
(executable) format. The list of operating systems available in both formats
includes Linux, BSD UNIX, Solaris, and part of macOS. The availability of source
code allows us to study operating systems from the inside out. Questions that we
could once answer only by looking at documentation or the behavior of an
operating system we can now answer by examining the code itself.

Operating systems that are no longer commercially viable have been open-sourced
as well, enabling us to study how systems operated in a time of fewer CPU,
memory, and storage resources. An extensive but incomplete list of open-source
operating-system projects is available from
http://dmoz.org/Computers/Software/Operating_Systems/Open_Source/.
©zyBooks 10/20/22 18:14 1496583
Noraisyah
In addition, the rise of virtualization as a mainstream (and frequently free) Abdl Aziz
AbdlAzizOSCOct2022
computer function makes it possible to run many operating systems on top of one
core system. For example, VMware (http://www.vmware.com) provides a free
"player" for Windows on which hundreds of free "virtual appliances" can run.
Virtualbox (http://www.virtualbox.com) provides a free, open-source virtual
machine manager on many operating systems. Using such tools, students can try
out hundreds of operating systems without dedicated hardware.
In some cases, simulators of specific hardware are also available, allowing the
operating system to run on "native" hardware, all within the confines of a modern
computer and modern operating system. For example, a DECSYSTEM-20 simulator
running on macOS can boot TOPS-20, load the source tapes, and modify and
compile a new TOPS-20 kernel. An interested student can search the Internet to
find the original papers that describe the operating system, as well as the original
manuals.
The advent of open-source operating systems has also made it easier to make the
move from student to operating-system developer. With some knowledge, some
effort, and an Internet connection, a student can even create a new operating-
system distribution. Not so many years ago, it was difficult or impossible to get
access to source code. Now, such access is limited only by how much interest,
time, and disk space a student has.

Solaris

Solaris is the commercial UNIX-based operating system of Sun Microsystems. Originally, Sun's
SunOS operating system was based on BSD UNIX. Sun moved to AT&T's System V UNIX as its
base in 1991. In 2005, Sun open-sourced most of the Solaris code as the OpenSolaris project. The
purchase of Sun by Oracle in 2009, however, left the state of this ©zyBooks 10/20/22 18:14 1496583
project unclear.
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
Several groups interested in using OpenSolaris have expanded its features, and their working set is
Project Illumos, which has expanded from the OpenSolaris base to include more features and to be
the basis for several products. Illumos is available at http://wiki.illumos.org.

Open-source systems as learning tools


The free-software movement is driving legions of programmers to create thousands of open-
source projects, including operating systems. Sites like http://freshmeat.net/ and
http://distrowatch.com/ provide portals to many of these projects. As we stated earlier, open-
source projects enable students to use source code as a learning tool. They can modify programs
and test them, help find and fix bugs, and otherwise explore mature, full-featured operating
systems, compilers, tools, user interfaces, and other types of programs. The availability of source
code for historic projects, such as Multics, can help students to understand those projects and to
©zyBooks 10/20/22 18:14 1496583
build knowledge that will help in the implementation of new projects.
Noraisyah Abdl Aziz
Another advantage of working with open-source operating systems is theirAbdlAzizOSCOct2022
diversity. GNU/Linux
and BSD UNIX are both open-source operating systems, for instance, but each has its own goals,
utility, licensing, and purpose. Sometimes, licenses are not mutually exclusive and cross-pollination
occurs, allowing rapid improvements in operating-system projects. For example, several major
components of OpenSolaris have been ported to BSD UNIX. The advantages of free software and
open sourcing are likely to increase the number and quality of open-source projects, leading to an
increase in the number of individuals and companies that use these projects.

PARTICIPATION
ACTIVITY
1.11.1: Section review questions.

1) Which of the following statements


concerning open source operating
systems is true?
Source code is made available.
Open source operating
systems are always more
secure than commercial,
closed systems.
All open source operating
systems share the same set of
goals.

2) Which of the following operating


systems is not open source?
Windows
Solaris
GNU/Linux
©zyBooks 10/20/22 18:14 1496583
3) A ___ is a custom build of the Linux Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
operating system.
LiveCD
distribution
VMWare Player
Section glossary

free operating system: An operating system released under a license that makes
its source code available and allows no-cost use, redistribution, and modification.

open-source operating system: An operating system or other program available in


©zyBooks 10/20/22 18:14 1496583
source-code format rather than as compiled binary code. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
closed-source: An operating system or other program available only in compiled
binary code format.
reverse engineering: The procedure of converting a compiled binary file into a
human-readable format.
GNU General Public License (GPL): A license agreement that codifies copylefting
(allowing and requiring open sourcing of the associated programs); a common
license under which free software is released.

GNU/Linux (aka Linux): An open-source operating system composed of


components contributed by the GNU foundation and Linus Torvalds, as well as
many others.
distribution: A release of a version of an operating system.

LiveCD: An operating system that can be booted and run from a CD-ROM (or more
generally from any media) without being installed on a system's boot disk(s).

LiveDVD: An operating system that can be booted and run from a DVD (or more
generally from any media) without being installed on a system's boot disk(s).
UnixBSD: A UNIX derivative based on work done at the University of California at
Berkeley (UCB).
version control system: Software that manages software distributions by allowing
contributors to "push" changes into a repository and "pull" a version of the software
source-code tree to a system (e.g., for compilation).
git: A version control system used for GNU/Linux and other programs.

Solaris: A UNIX derivative that is the main operating system of Sun Microsystems
(now owned by Oracle Corporation). There is an active open source version called
Illumos.
©zyBooks 10/20/22 18:14 1496583
SunOS: The predecessor of Solaris by Sun Microsystems Inc. Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

1.12 Summary
An operating system is software that manages the computer hardware, as well as providing
an environment for application programs to run.
Interrupts are a key way in which hardware interacts with the operating system. A hardware
device triggers an interrupt by sending a signal to the CPU to alert the CPU that some event
requires attention. The interrupt is managed by the interrupt handler.
For a computer to do its job of executing programs, the programs must be in main memory,
which is the only large storage area that the processor can ©zyBooks 10/20/22 18:14 1496583
access directly.
Noraisyah Abdl Aziz
The main memory is usually a volatile storage device that loses its contents when power is
AbdlAzizOSCOct2022
turned off or lost.
Nonvolatile storage is an extension of main memory and is capable of holding large
quantities of data permanently.
The most common nonvolatile storage device is a hard disk, which can provide storage of
both programs and data.
The wide variety of storage systems in a computer system can be organized in a hierarchy
according to speed and cost. The higher levels are expensive, but they are fast. As we move
down the hierarchy, the cost per bit generally decreases, whereas the access time generally
increases.
Modern computer architectures are multiprocessor systems in which each CPU contains
several computing cores.
To best utilize the CPU, modern operating systems employ multiprogramming, which allows
several jobs to be in memory at the same time, thus ensuring that the CPU always has a job
to execute.
Multitasking is an extension of multiprogramming wherein CPU scheduling algorithms
rapidly switch between processes, providing users with a fast response time.
To prevent user programs from interfering with the proper operation of the system, the
system hardware has two modes: user mode and kernel mode.
Various instructions are privileged and can be executed only in kernel mode. Examples
include the instruction to switch to kernel mode, I/O control, timer management, and
interrupt management.
A process is the fundamental unit of work in an operating system. Process management
includes creating and deleting processes and providing mechanisms for processes to
communicate and synchronize with each other.
An operating system manages memory by keeping track of what parts of memory are being
used and by whom. It is also responsible for dynamically allocating and freeing memory
space.
Storage space is managed by the operating system; this includes providing file systems for
representing files and directories and managing space on mass-storage devices.
©zyBooks 10/20/22 18:14 1496583
Operating systems provide mechanisms for protecting and securing the operating
Noraisyah Abdl Azizsystem
AbdlAzizOSCOct2022
and users. Protection measures control the access of processes or users to the resources
made available by the computer system.
Virtualization involves abstracting a computer's hardware into several different execution
environments.
Data structures that are used in an operating system include lists, stacks, queues, trees, and
maps.
Computing takes place in a variety of environments, including traditional computing, mobile
computing, client-server systems, peer-to-peer systems, cloud computing, and real-time
embedded systems.
Free and open-source operating systems are available in source-code format. Free software
is licensed to allow no-cost use, redistribution, and modification. GNU/Linux, FreeBSD, and
Solaris are examples of popular open-source systems.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
1.13 Practice exercises AbdlAzizOSCOct2022

fitness_center EXERCISE 1.13.1 All solutions visible to students help_outline


(a) What are the three main purposes of an operating system?
Solution keyboard_arrow_up Visible to students
The three main purposes are:

To provide an environment for a computer user to execute programs on


computer hardware in a convenient and efficient manner.
To allocate the separate resources of the computer as needed to perform the
required tasks. The allocation process should be as fair and efficient as
possible.
As a control program, it serves two major functions: (1) supervision of the
execution of user programs to prevent errors and improper use of the
computer, and (2) management of the operation and control of I/O devices.

fitness_center EXERCISE 1.13.2 All solutions visible to students help_outline


(a) We have stressed the need for an operating system to make efficient use of the
computing hardware. When is it appropriate for the operating system to forsake this
principle and to "waste" resources? Why is such a system not really wasteful?
Solution keyboard_arrow_up Visible to students
Single-user systems should maximize use of the system for the user. A GUI might
"waste" CPU cycles, but it optimizes the user's interaction©zyBooks
with the 10/20/22
system. 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

fitness_center EXERCISE 1.13.3 All solutions visible to students help_outline


(a) What is the main difficulty that a programmer must overcome in writing an operating
system for a real-time environment?
Solution keyboard_arrow_up Visible to students
So ut o s b e to stude ts
The main difficulty is keeping the operating system within the fixed time constraints
of a real-time system. If the system does not complete a task in a certain time
frame, it may cause a breakdown of the entire system. Therefore, when writing an
operating system for a real-time system, the writer must be sure that his scheduling
schemes don't allow response time to exceed the time constraint.

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
fitness_center EXERCISE 1.13.4 All solutions visible toAbdlAzizOSCOct2022
students help_outline
(a) Keeping in mind the various definitions of operating system, consider whether the
operating system should include applications such as web browsers and mail
programs. Argue both that it should and that it should not, and support your
answers.
Solution keyboard_arrow_up Visible to students
An argument in favor of including popular applications in the operating system is
that if the application is embedded within the operating system, it is likely to be
better able to take advantage of features in the kernel and therefore have
performance advantages over an application that runs outside of the kernel.
Arguments against embedding applications within the operating system typically
dominate, however: (1) the applications are applications—not part of an operating
system, (2) any performance benefits of running within the kernel are offset by
security vulnerabilities, and (3) inclusion of applications leads to a bloated operating
system.

fitness_center EXERCISE 1.13.5 All solutions visible to students help_outline


(a) How does the distinction between kernel mode and user mode function as a
rudimentary form of protection (security)?
Solution keyboard_arrow_up Visible to students
The distinction between kernel mode and user mode provides a rudimentary form of
protection in the following manner. Certain instructions can be executed only when
the CPU is in kernel mode. Similarly, hardware devices can be accessed only when
the program is in kernel mode, and interrupts can be enabled or disabled only when
©zyBooks 10/20/22 18:14 1496583
the CPU is in kernel mode. Consequently, the CPU has very limited capability when
Noraisyah Abdl Aziz
executing in user mode, thereby enforcing protection of criticalAbdlAzizOSCOct2022
resources.

fitness_center EXERCISE 1.13.6 All solutions visible to students help_outline


(a) Which of the following instructions should be
privileged?

a. Set value of timer.


b. Read the clock.
c. Clear memory.
d. Issue a trap instruction.
e. Turn off interrupts.
f. Modify entries in device-status table. ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
g. Switch from user to kernel mode. AbdlAzizOSCOct2022
h. Access I/O device.
Solution keyboard_arrow_up Visible to students
The following operations need to be privileged:

set value of timer


clear memory
turn off interrupts
modify entries in device-status table
access I/O device

The rest can be performed in user mode.

fitness_center EXERCISE 1.13.7 All solutions visible to students help_outline


(a) Some early computers protected the operating system by placing it in a memory
partition that could not be modified by either the user job or the operating system
itself. Describe two difficulties that you think could arise with such a scheme.
Solution keyboard_arrow_up Visible to students
The data required by the operating system (passwords, access controls, accounting
information, and so on) would have to be stored in or passed through unprotected
memory and thus be accessible to unauthorized users.

fitness_center EXERCISE 1.13.8 All solutions visible to students help_outline


©zyBooks 10/20/22 18:14 1496583
(a) Some CPUs provide for more than two modes of operation. What are twoAbdl
Noraisyah possible
Aziz
uses of these multiple modes? AbdlAzizOSCOct2022

Solution keyboard_arrow_up Visible to students


Although most systems only distinguish between user and kernel modes, some
CPUs have supported multiple modes. Multiple modes could be used to provide a
finer-grained security policy. For example, rather than distinguishing between just
user and kernel mode, you could distinguish between different types of user mode.
Perhaps users belonging to the same group could execute each other's code. The
machine would go into a specified mode when one of these users was running code.
When the machine was in this mode, a member of the group could run code
belonging to anyone else in the group.
Another possibility would be to provide different distinctions within kernel code. For
example, a specific mode could allow USB device drivers to run. This would mean
that USB devices could be serviced without having to switch to kernel mode, thereby
essentially allowing USB device drivers to run in a quasi-user/kernel mode.
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

fitness_center EXERCISE 1.13.9 All solutions visible to students help_outline


(a) Timers could be used to compute the current time. Provide a short description of
how this could be accomplished.
Solution keyboard_arrow_up Visible to students
A program could use the following approach to compute the current time using
timer interrupts. The program could set a timer for some time in the future and go to
sleep. When awakened by the interrupt, it could update its local state, which it uses
to keep track of the number of interrupts it has received thus far. It could then repeat
this process of continually setting timer interrupts and updating its local state when
the interrupts are actually raised.

fitness_center EXERCISE 1.13.10 All solutions visible to students


help_outline
(a) Give two reasons why caches are useful. What problems do they solve? What
problems do they cause? If a cache can be made as large as the device for which it
is caching (for instance, a cache as large as a disk), why not make it that large and
eliminate the device?
Solution keyboard_arrow_up Visible to students
Caches are useful when two or more components need to exchange data, and the
components perform transfers at differing speeds. Caches solve the transfer
problem by providing a buffer of intermediate speed between the components. If the
fast device finds the data it needs in the cache, it need not wait for the slower device.
©zyBooks 10/20/22 18:14 1496583
The data in the cache must be kept consistent with the data in the components.
Noraisyah Abdl AzizIf a
component has a data value change, and the datum is also in the cache, the cache
AbdlAzizOSCOct2022
must also be updated. This is especially a problem on multiprocessor systems,
where more than one process may be accessing a datum. A component may be
eliminated by an equal-sized cache, but only if: (a) the cache and the component
have equivalent state-saving capacity (that is, if the component retains its data when
electricity is removed, the cache must retain data as well), and (b) the cache is
affordable, because faster storage tends to be more expensive.
fitness_center EXERCISE 1.13.11 All solutions visible to students help_outline
(a) Distinguish between the client-server and peer-to-peer models of distributed
systems.
Solution keyboard_arrow_up Visible to students
©zyBooks 10/20/22 18:14 1496583
Noraisyah
The client-server model firmly distinguishes the roles of the client Abdl Aziz
and server. Under
AbdlAzizOSCOct2022
this model, the client requests services that are provided by the server. The peer-to-
peer model doesn't have such strict roles. In fact, all nodes in the system are
considered peers and thus may act as either clients or servers—or both. A node may
request a service from another peer, or the node may in fact provide such a service
to other peers in the system.
For example, let's consider a system of nodes that share cooking recipes. Under the
client-server model, all recipes are stored with the server. If a client wishes to access
a recipe, it must request the recipe from the specified server. Using the peer-to-peer
model, a peer node could ask other peer nodes for the specified recipe. The node (or
perhaps nodes) with the requested recipe could provide it to the requesting node.
Notice how each peer may act as both a client (it may request recipes) and as a
server (it may provide recipes).

1.14 Exercises

fitness_center EXERCISE 1.14.1 help_outline


(a) How do clustered systems differ from multiprocessor systems? What is required for
two machines belonging to a cluster to cooperate to provide a highly available
service?

fitness_center EXERCISE 1.14.2 help_outline


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
(a) Consider a computing cluster consisting of two nodes running a database. Describe
two ways in which the cluster software can manage access to the data on the disk.
Discuss the benefits and disadvantages of each.

fitness_center EXERCISE 1.14.3 help_outline


(a) What is the purpose of interrupts? How does an interrupt differ from a trap? Can
traps be generated intentionally by a user program? If so, for what purpose?

fitness_center EXERCISE 1.14.4 help_outline


(a) Explain how the Linux kernel variables HZ and jiffies can be used
©zyBooks to determine
10/20/22 the
18:14 1496583
Noraisyah Abdl Aziz
number of seconds the system has been running since it was booted.
AbdlAzizOSCOct2022

fitness_center EXERCISE 1.14.5 help_outline


Direct memory access is used for high-speed I/O devices in order to avoid increasing the
CPU's execution load.
(a) How does the CPU interface with the device to coordinate the transfer?

(b) How does the CPU know when the memory operations are complete?

(c) The CPU is allowed to execute other programs while the DMA controller is
transferring data. Does this process interfere with the execution of the user
programs? If so, describe what forms of interference are caused.

fitness_center EXERCISE 1.14.6 help_outline


(a) Some computer systems do not provide a privileged mode of operation in hardware.
Is it possible to construct a secure operating system for these computer systems?
Give arguments both that it is and that it is not possible.

fitness_center EXERCISE 1.14.7 help_outline


(a) Many SMP systems have different levels of caches; one level is local to each
processing core, and another level is shared among all processing cores. Why are
caching systems designed this way?
©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
AbdlAzizOSCOct2022
fitness_center EXERCISE 1.14.8 help_outline
(a) Rank the following storage systems from slowest to
fastest:

a. Hard-disk drives
b. Registers
c. Optical disk
d. Main memory
e. Nonvolatile memory
f. Magnetic tapes
g. Cache

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
fitness_center EXERCISE 1.14.9 AbdlAzizOSCOct2022 help_outline
(a) Consider an SMP system similar to the one shown in Figure 1.9.2. Illustrate with an
example how data residing in memory could in fact have a different value in each of
the local caches.

fitness_center EXERCISE 1.14.10 help_outline


Discuss, with examples, how the problem of maintaining coherence of cached data
manifests itself in the following processing environments:
(a) Single-processor systems

(b) Multiprocessor systems

(c) Distributed systems

fitness_center EXERCISE 1.14.11 help_outline


(a) Describe a mechanism for enforcing memory protection in order to prevent a
program from modifying the memory associated with other programs.

fitness_center EXERCISE 1.14.12 help_outline


Which network configuration—LAN or WAN—would best suit the following
environments? ©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
(a) A campus student union AbdlAzizOSCOct2022

(b) Several campus locations across a statewide university system

(c) A neighborhood

fitness_center 1.14.13 help_outline


EXERCISE

(a)
Describe some of the challenges of designing operating systems for mobile devices
compared with designing operating systems for traditional PCs.

fitness_center EXERCISE 1.14.14


©zyBooks 10/20/22 18:14 1496583
help_outline
Noraisyah Abdl Aziz
(a) AbdlAzizOSCOct2022
What are some advantages of peer-to-peer systems over client-server
systems?

fitness_center EXERCISE 1.14.15 help_outline


(a) Describe some distributed applications that would be appropriate for a peer-to-peer
system.

fitness_center EXERCISE 1.14.16 help_outline


(a) Identify several advantages and several disadvantages of open-source operating
systems. Identify the types of people who would find each aspect to be an
advantage or a disadvantage.

1.15 Further reading


Many general textbooks cover operating systems, including [Stallings (2017)] and [Tanenbaum
(2014)]. [Hennessy and Patterson (2012)] provide coverage of I/O systems and buses and of
system architecture in general. [Kurose and Ross (2017)] provides a general overview of computer
networks.
[Russinovich et al. (2017)] give an overview of Microsoft Windows and covers considerable
technical detail about the system internals and components. [McDougall and Mauro (2007)] cover
the internals of the Solaris operating system. The macOS and iOS©zyBooks
internals10/20/22
are discussed in [Levin
18:14 1496583
Noraisyah Abdl Aziz
(2013)]. [Levin (2015)] covers the internals of Android. [Love (2010)] provides an overview of the
AbdlAzizOSCOct2022
Linux operating system and great detail about data structures used in the Linux kernel. The Free
Software Foundation has published its philosophy at http://www.gnu.org/philosophy/free-
software-for-freedom.html.

1.16 Bibliography
[Hennessy and Patterson (2012)] J. Hennessy and D. Patterson, Computer Architecture: A
Quantitative Approach, Fifth Edition, Morgan Kaufmann (2012).

[Kurose and Ross (2017)] J. Kurose and K. Ross, Computer Networking—A Top-Down Approach,
Seventh Edition, Addison-Wesley (2017).
[Levin (2013)] J. Levin, Mac OS X and iOS Internals to the Apple's Core, Wiley (2013).

[Levin (2015)] J. Levin, Android Internals—A Confectioner's Cookbook. Volume I (2015).


©zyBooks 10/20/22 18:14 1496583
Noraisyah Abdl Aziz
[Love (2010)] R. Love, Linux Kernel Development, Third Edition, Developer's Library (2010).
AbdlAzizOSCOct2022
[McDougall and Mauro (2007)] R. McDougall and J. Mauro, Solaris Internals, Second Edition,
Prentice Hall (2007).
[Russinovich et al. (2017)] M. Russinovich, D. A. Solomon, and A. Ionescu, Windows Internals—Part
1, Seventh Edition, Microsoft Press (2017).
[Stallings (2017)] W. Stallings, Operating Systems, Internals and Design Principles (9th Edition)
Ninth Edition, Prentice Hall (2017).

[Tanenbaum (2014)] A. S. Tanenbaum, Modern Operating Systems, Prentice Hall (2014).

©zyBooks 10/20/22 18:14 1496583


Noraisyah Abdl Aziz
AbdlAzizOSCOct2022

You might also like