Chapter 1
Chapter 1
Chapter 1
Operating Systems
Email:
L.O.1.1 Define the functionality and structures that a modern operating system must
deliver to meet a particular need.
L.O.1.2 Describe main operating system concepts and their aspects that are useful to realize
concurrent systems and describe the benefits of each.
L.O.1.3 Explain virtual memory and its realization in hardware and software.
L.O.2 Able to report the tradeoffs between the performance and the resource
and technology constraints in a design of an operating system.
L.O.2.1 Compare and contrast common algorithms used for both preemptive and non-
preemptive scheduling of tasks in operating systems
L.O.2.2 Compare and contrast different approaches to file organization, recognizing the
strengths and weaknesses of each.
● CPU scheduling
● Synchronization
● Memory management
● Main memory
● Virtual memory
● Storage management
● File systems
● Users
4 E.g., People, machines, other computers
● Mobile devices (e.g., smartphones and tablets) are resource poor, have to
be optimized for battery life and usability using user interfaces such as touch
screens.
● OSes were born when fixed use of computers for military became more
general purpose and needed resource management and program
control
● a system program (ships with the operating system, but not part of the
kernel), or
● Computer-system organization
● CPU moves data from/to main memory to/from local buffers, I/O
device does from the device to local buffer of controller
● Each device controller type has a device driver (installed inside an
operating system) to manage I/O operation
● Provides uniform interface between controller and kernel
● Some device drivers use interrupts when the I/O rate is low and
switch to polling when the rate increases to the point where polling is
faster and more efficient.
● After I/O starts, control returns to user program only upon I/O
completion
● Wait instruction idles the CPU until the next interrupt
● Wait loop (e.g., contention for memory access)
● At most one I/O request is outstanding at a time, no simultaneous I/O
processing
● After I/O starts, control returns to user program without waiting for I/O
completion
● System call – request to the OS to allow user to wait for I/O completion
● Device-status table contains entry for each I/O device indicating its
type, address, and state
4 OS indexes into I/O device table to determine device status and to modify
table entry to include interrupt
● Main memory – only storage media that the CPU can access
directly
● Random access, typically in the form of Dynamic Random-Access
Memory (DRAM)
● Typically volatile
4 Various technologies
Operating System Concepts 22 Silberschatz, Galvin and Gagne ©2018
Storage Definitions and Notation Review
● 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).
● Capacity
● Volatility
● Cost
● Advantages include:
4 Increased throughput
● Two types:
4 Asymmetric Multiprocessing – each processor is assigned a special task.
● Multi-chip and
multicore
● Systems containing
all chips
● Chassis containing
multiple separate
systems
● Loads kernel
● Single user cannot keep CPU and I/O devices busy at all times
● Multiprogramming organizes jobs (i.e., code and data) so that CPU always
has one to execute
● If processes don’t fit in memory, swapping moves them in and out to run
4 System call changes mode to kernel, return from call resets it to user mode
● Timer is set to interrupt the computer after some time period. Operating system
sets a counter (privileged instruction), keeps the counter that is decremented by
the physical clock, when counter zero generate an interrupt.
● Typically system has many processes (some user & some operating
system processes) running concurrently on one or more CPUs
● Concurrency by multiplexing the CPUs among the processes / threads
● To execute a program,
● All (or part) of the data needed by the program must be in memory
● OS activities
● Keeping track of which parts of memory are currently being used and by
whom
● Deciding which processes (or parts thereof) and data to move into and
out of memory
● Filesystem management
● OS activities
● Various solutions
4 Group identifier (GID) allows set of users to be defined for access control,
then also associated with each process or file
● Emulation used when source CPU type different from target CPU
type (e.g., PowerPC to Intel x86)
● Generally slowest method
● Use cases involve laptops and desktops running multiple OSes for
exploration or compatibility
● E.g.,
4 Apple laptop running Mac OS X host, Windows as a guest
● VMM can run natively, in which case they are also the host
● There is no general purpose host then (e.g., VMware ESX and Citrix
XenServer)
● Distributed computing
● Mainframe system
● Desktop system
● Multiprocessor system
● Distributed system
● Real-time system
● Client-Server Computing
4 File-server system provides interface for clients to store and retrieve files
● Cloud computing
environments
composed of
traditional OSes,
plus VMMs, plus
cloud management
tools
● Internet
connectivity
requires security
like firewalls
● Load balancers
spread traffic
across multiple
applications
● Use expanding
4 http://gnu.org/philosophy/open-source-misses-the-point.html/
● 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
https://curlie.org/Computers/Software/Operating_Systems/Open_Source/
● In addition, the rise of virtualization as a mainstream (and frequently free) 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.
● 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. Just a few 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.