Operating Systems Lecture Notes Overview
Operating Systems Lecture Notes Overview
Recommended Texts:
1. Silberschatz A, Galvin PB and Gagne G (2018). Operating System Concepts, 10th
Edition. USA: John Wiley and Sons
2. Stallings W. (2012). Operating Systems: Internals and Design Principles, 7 th Edition.
USA: Prentice Hall
3. Tanenbaum, AS (2009). Modern Operating Systems, 3 rd Edition. USA: Pearson
Education International
An operating system (OS) is a computer program or software environment that enables users
(humans, machines, or programs) conveniently, efficiently and reliably exploit the computer
resources. These resources include the information stored in the system (both data and code),
as well as the processor (CPU), memory (primary storage), secondary storage, tertiary
storage, communications equipment, terminals, and computer busses: system bus (address
bus, data bus, and control bus) which could be internal bus, external bus, or expansion bus;
and directly linked to main memory (front-side bus) or via cache (backside bus). However,
considering the diverse, evolving and increasing services of OS, the diverse computer systems
an OS exist.
For the purpose of this course, an OS consists of a kernel, middleware frameworks that ease
application development and seamlessly provide features, and systems programs that aid in
managing the system and ensuring the continuous and smooth running of the computer
systems. Thus, we can say, generally, that an OS is a computer program that controls and
coordinates the execution of application programs and serves as a mediator between the
application programs and the computer hardware (as shown in Figure 1) ensuring the
seamless utilization of the computer resources. It should have the following objectives: (i)
Convenience, (ii) Efficiency, (iii) Extensibility, (iv) Availability, and (v) Reliability.
(i) User interface: Almost all operating systems have a user interface (UI). This interface
can take several forms. Most commonly, a graphical user interface (GUI) is used. Here,
I/O, choose from menus, and make selections and a keyboard to enter text. Mobile
systems such as phones and tablets provide a touch-screen interface, enabling users to
slide their fingers across the screen or press buttons on the screen to select choices.
Another option is a command-line interface (CLI), which uses text commands and a
method for entering them (say, a keyboard for typing in commands in a specific format
with specific options). Some systems provide two or all three of these variations.
(ii) Program development: The OS provides a variety of facilities and services, such as
editors and debuggers, to assist the programmer in creating programs. Typically, these
services are in the form of utility programs that, while not strictly part of the core of the
OS, are supplied with the OS and are referred to as application program development
tools.
Instructions and data must be loaded into main memory, I/O devices and files must be
initialized, and other resources must be prepared. The OS handles these scheduling
(iv) Resource allocation: When there are multiple processes running at the same time,
resources must be allocated to each of them. The operating system manages many
different types of resources. Some (such as CPU cycles, main memory, and file
storage) may have special allocation code, whereas others (such as I/O devices) may
have much more general request and release code. For instance, in determining how
best to use the CPU, operating systems have CPU-scheduling routines that take into
account the speed of the CPU, the process that must be executed, the number of
processing cores on the CPU, and other factors. There may also be routines to allocate
(v) Access to I/O devices: Each I/O device requires its own peculiar set of instructions or
control signals for operation. The OS provides a uniform interface that hides these
details so that programmers can access such devices using simple reads and writes.
(vi) Controlled access to files: For file access, the OS must reflect a detailed
understanding of not only the nature of the I/O device (disk drive, tape drive) but also
the structure of the data contained in the files on the storage medium. In the case of a
system with multiple users, the OS may provide protection mechanisms to control
(vii) System access: For shared or public systems, the OS controls access to the system
as a whole and to specific system resources. The access function must provide
resource contention.
(viii) Communications: There are many circumstances in which one process needs to
exchange information with another process. Such communication may occur between
processes that are executing on the same computer or between processes that are
may be implemented via shared memory, in which two or more processes read and
system.
(ix) Error detection and response: A variety of errors can occur while a computer system
is running. These include internal and external hardware errors, such as a memory
error, or a device failure or malfunction; and various software errors, such as division by
zero, attempt to access forbidden memory location, and inability of the OS to grant the
request of an application. In each case, the OS must provide a response that clears the
error condition with the least impact on running applications. The response may range
from ending the program that caused the error, to retrying the operation, to simply
(x) Accounting: A good OS will collect usage statistics for various resources and monitor
useful in anticipating the need for future enhancements and in tuning the system to
improve performance. On a multiuser system, the information can be used for billing
purposes.
instructions that a computer can follow. This interface is the boundary between
hardware and software. Note that both application programs and utilities may access
the ISA directly. For these programs, a subset of the instruction repertoire is available
(user ISA). The OS has access to additional machine language instructions that deal
(xii) Application binary interface (ABI): The ABI defines a standard for binary portability
across programs. The ABI defines the system call interface to the operating system and
the hardware resources and services available in a system through the user ISA.
(xiii) Application programming interface (API): The API gives a program access to the
hardware resources and services available in a system through the user ISA
supplemented with high-level language (HLL) library calls. Any system calls are usually
easily, through recompilation, to other systems that support the same API.
The above service areas, as highlighted, sufficiently explain why an OS is a critical component
of the computer system that should be well understood by any computing professional.
Obviously, 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
It is now evident that OS covers many roles and functions in the computer. Computers are
present in diverse form, architecture and organization within toasters, cars, spacecraft, homes,
and business. They are the basis for game machines, cable TV tuners, smart factories and
cities, and industrial control systems. This diversity notwithstanding, OS plays the unique role
of a resource manager in the computer. The resources include CPU time, memory space,
storage space, and I/O devices. As a resource manager, it takes up the roles of (i) process
management, (ii) memory management, (iii) File-system management, (iv) Mass storage
management, (v) Cache management, (vi) I/O system management. The OS also provides the
environment within which programs are executed. As programs execution container, the OS is
capable of performing the following operations: (vii) multiprogramming and multitasking, (viii)
Dual-mode and multimode, (ix) virtualization, and (x) timing. More so, the OS serves as the
Chief Security Officer of the computer system (CS) where it plays the roles of: (xi) privacy
protection, and (xii) security. Finally, OS can now position itself as lobbyist negotiating and
connecting physically separate, possibly heterogeneous computer systems, and enabling the
different computer systems to communicate with and use others resources (network OS) or
exploit the resources of other computer systems transparently as their internal resources
(distributed OS). Hence, the additional roles of: (xiii) networking, and (xiv) migration – data
migration, computation migration, and process migration, on OS. The following subsections
file-storage space, and I/O devices. Generally, a manager is an entity that plans, coordinates,
reliable, and sustainable execution of the system’s service in strong alignment with the
system’s objectives for optimum (excellent) system’s performance and stakeholders (users)
(i) Process Management: A program can do nothing unless its instruction is executed by
(ii) Memory Management: Instructions and data from the CPU and I/O devices are only
executable or consumable only if they are mapped to absolute addresses and loaded to
memory. The main memory is generally the only large storage device the CPU is able to
address and access directly. Similarly, instructions must be in memory for the CPU
executes them. Eventually, when the program terminates, its memory including those of
associated data is declared available, and the next program can then loaded with its
a. Keeping track of which parts of memory are currently being used and which process
is using them
c. Deciding which processes (or parts of processes) and data to move into and out of
memory
(iii) File-System Management: File is simply a logical storage unit of data/information. The
OS implements this abstract concept of data organization called file, or its collections
(called directory), by managing mass storage media and the devices that control them.
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). To this end, the operating system is responsible for the following activities in
(iv) 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
system. The operating system is responsible for the following activities in connection
b. Free-space management
c. Storage allocation
d. Disk scheduling
e. Partitioning
f. Protection
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
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.
fast but limited storage system called cache to temporarily hold data or instructions in
demand, or migrate back to memory stale data or instruction, for efficiency. The caching
principles also involve high speed registers. Obviously, the caching process usually
results in duplication of data and instruction. The OS can help manage this migration
and guarantee cache coherency or replica consistency. This may be explicit or implicit
(vi) I/O System Management: One of the roles of OS as CS manager is to hide the
peculiarities of specific hardware device from the user. Only the device driver knows the
b. Device-driver interface
An OS besides being the CS manager also provides the environment within which programs
are executed. Once the CS is rebooted or powered up, the OS kernel or nucleus is loaded to
memory by the bootstrap program in firmware. Once the kernel is loaded and executing, it then
serves as the execution environment for all other programs, coordinating their resource
multiprogramming switch CPU due to idleness, multitasking switch CPU based on time
slice. Both execution type will require scheduling (akin to giving appointment) and
(viii) Dual-Mode and Multimode Operation: An OS though housing a program is on its own
a program too. So, in attempts to distinguish program executions and their privileges,
the OS need to execute in at least two mode of operations – user mode (for application
programs) and kernel mode for itself. The dual mode of operation provides us with the
means for protecting the operating system from errant users—and errant users from
instructions that may cause harm as privileged instructions. The hardware allows
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.
other examples include I/O control, timer management, and interrupt management. 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). ARMv8 systems have seven modes. CPUs that support
virtualization 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.
(ix) Virtualization: virtualization enables multiple presentation of same computer via the
the OS assume the place of the hardware and even enable OS to run within another
OS. One notable advantage of virtualization is portability – an OS, say, can be made to
processes, the timing role is critical to guarantee fair resource allocation. The timer
ensures that no process can gain control of the CPU without eventually relinquishing
control.
The OS ensures that access to CS resources is regulated and all processes execute without
any hitch. Thus, the OS help regulate access and ensure a seamless execution of programs
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
hardware ensures that a process can execute only within its own address space.
Device-control registers are not accessible to users, so the integrity of the various
Privacy 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. Privacy
protection can improve reliability by detecting latent errors at the interfaces between
(xii) Security: A system can have adequate protection but still be prone to failure and allow
identifying herself to the system) 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
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
Privacy 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
identifier (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
translated back to the user name via the user name list.
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
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
OS as CS lobbyist enables multiple CS to work as one or like one unlike virtualization the
makes a CS to work as many. This brings us to the networking and cooperation (migration)
(xiii) Networking: A network operating system provides an environment in which users can
appropriate remote machine or transferring data from the remote machine to their own
operating systems such as Android and iOS, are network operating systems. An
remote file transfer from one machine to another. In such an environment, each
computer maintains its own local file system. If a user at computer A wants to access a
file owned by another located on another computer B, then the file must be copied
and individual. The Internet provides a mechanism for such a transfer with the file
transfer protocol (FTP) and the more private secure file transfer protocol (SFTP).
Basic cloud-based storage applications allow users to also transfer files much as with
FTP. Users can upload files to a cloud server, download files to the local computer, and
share files with other cloud-service users via a web link or other sharing mechanism
through a graphical interface. Common examples include Dropbox and Google Drive.
storage applications is that they require the user to change paradigms. FTP, for
example, requires the user to know a command set entirely different from the normal
operating system commands. With SSH, the user must know appropriate commands on
the remote system. With cloud-based storage applications, users may have to log into
the cloud service (usually through a web browser) or native application and then use a
would find it more convenient not to be required to use a different set of commands.
(xiv) Migration: In a distributed operating system, users access remote resources in the
same way they access local resources. Data and process migration from one site to
another is under the control of the distributed operating system. Depending on the goals
Suppose a user on site A wants to access data (such as a file) that reside at site B. The
system can transfer the data by one of two basic methods. One approach to data
migration is to transfer the entire file to site A. From that point on, all access to the file is
local. When the user no longer needs access to the file, a copy of the file (if it has been
modified) is sent back to site B. Even if only a modest change has been made to a large
file, all the data must be transferred. This mechanism can be thought of as an
automated FTP system. This approach was used in the Andrew file system, but it was
The other approach is to transfer to site A only those portions of the file that are actually
necessary for the immediate task. If another portion is required later, another transfer
been modified must be sent back to site B. (Note the similarity to demand paging.) Most
modern distributed systems use this approach. Whichever method is used, data
migration includes more than the mere transfer of data from one site to another. The
system must also perform various data translations if the two sites involved are not
In some circumstances, we may want to transfer the computation, rather than the data,
across the system; this process is called computation migration. For example, consider
a job that needs to access various large files that reside at different sites, to obtain a
summary of those files. It would be more efficient to access the files at the sites where
they reside and return the desired results to the site that initiated the computation.
Generally, if the time to transfer the data is longer than the time to execute the remote
command, the remote command should be used. Such a computation can be carried
out in different ways. Suppose that process P wants to access a file at site A. Access to
the file is carried out at site A and could be initiated by an RPC. An RPC uses network
procedure at site A. The procedure executes appropriately and then returns the results
site A then creates a new process Q whose function is to carry out the designated task.
When process Q completes its execution, it sends the needed result back to P via the
message system. In this scheme, process P may execute concurrently with process Q.
various sites. One RPC might result in the invocation of another RPC or even in the
transfer of messages to another site. Similarly, process Q could, during the course of its
execution, send amessage to another site, which in turn would create another process.
This process might either send a message back to Q or repeat the cycle.
submitted for execution, it is not always executed at the site at which it is initiated. The
entire process, or parts of it, may be executed at different sites. This scheme may be
a. Load balancing. The processes (or subprocesses) may be distributed across the
subprocesses that can run concurrently on different sites or nodes, then the total
c. Hardware preference. The process may have characteristics that make it more
d. Software preference. The process may require software that is available at only a
particular site, and either the software cannot be moved, or it is less expensive to
e. Data access. Just as in computation migration, if the data being used in the
computation are numerous, it may be more efficient to have a process run remotely
(say, on a server that hosts a large database) than to transfer all the data and run
the first, the system can attempt to hide the fact that the process has migrated from the
client. The client then need not code her program explicitly to accomplish the migration.
This method is usually employed for achieving load balancing and computation speedup
among homogeneous systems, as they do not need user input to help them execute
programs remotely. The other approach is to allow (or require) the user to specify
explicitly how the process should migrate. This method is usually employed when the
You have probably realized that the World Wide Web has many aspects of a distributed
computing environment. Certainly it provides data migration (between a web server and
a web client). It also provides computation migration. For instance, a web client could
trigger a database operation on a web server. Finally, with Java, Javascript, and similar
languages, it provides a form of process migration: Java applets and Javascript scripts
are sent from the server to the client, where they are executed. A network operating
system provides most of these features, but a distributed operating system makes them
seamless and easily accessible. The result is a powerful and easy-to-use facility—one
of the reasons for the huge growth of the World Wide Web.
used and the computing paradigm it supports. These CS architectures and computing
Classification of CS by its number of processors makes the following CS evident: (i) Single-
Processor System (SPS), (ii) Multi-Processor System (MPS), and (iii) Clustered Computer
System (CCS).
(i) Single-Processor System (SPS): CS with a single processor containing one CPU
(ii) Multi-Processor System (MPS): CS with two or more processors, each with a single-
core CPU. The processors share the computer bus and sometimes the clock,
is less than N. MPS could be symmetric (multiple single core chips), multi-core (one
(iii) Clustered Computer System (CCS): multiple independent CS on separate board but
with shared storage or storage network. It provides high availability, scalability, fault
Traditional Computing (TC), (v) Mobile Computing (MC), (vi) Client-Server Computing (CSC),
(vii) Peer-to-Peer Computing (PPC), (viii) Cloud Computing (CC), and (ix) Real-
(iv) Traditional Computer (TC): Here, all computing activities are carried within a CS with
one or more terminals usually in fixed location. They are associated with
of heavy OS, high processor capability, large memory capacity, and limited mobility.
(v) Mobile Computing (MC): In MC the CS has limited processor capability and memory
capacity, unlimited mobility with light weight OS. MC typically supports the unique
the earth surface), and cellular data networks. Supporting OS include Apple iOS and
(vi) Client-Server-Computing (CSC): CSC enable a set of dependent and usually light
(vii) Peer-to-Peer Computing (PPC): In PPC, two or more fairly equally sophisticated
resources via a network in a mutually beneficial form. Any computer in PCC can be
(viii) Cloud Computing (CC): Cloud computing is an extension of CSC with virtualization
systems are enabled as service. Its climax is an interesting world where you do not
need to own anything to use it – just pay as you use or use as you can pay. Already,
we have various types of CC service: SaaS, PaaS, and IaaS which can be
(ix) Real-Time Embedded Computing (REC): Embedded computers are the most
transparent to human. REC usually runs real-time OS and thus usually used for
control, monitoring, and other autonomous computing tasks. REC is the future of
coordinate, monitor, and perform both the physical and computational tasks/entities
with the risk of leading humanity into singularity. Examples of REC include Internet
of Things (IoTs), smart buildings, smart factory or Industry 4.0, robots, and smart
vehicles (e.g. ―drones: they are unmanned – space, aerial, surface, underwater –
impregnable, hazardous, safety and time critical tasks‖ (Ekuobase, 202X, Chapter
3)).
The objectives and functions of OS have been identified and discussed. This week, we shall
examine from a bird’s eye view the fundamental structure and capabilities of the two dominant
Windows, which began with a very different OS, developed by Microsoft for the first IBM
designed to manage the complexity of the modern computing environment, provide a rich
platform for application developers, and support a rich set of experiences for users. Like
Solaris, Windows is designed to have the features that enterprises need, while at the same
time Windows, like MacOS, provides the simplicity and ease-of-use that consumers require.
Windows, as with virtually all OS, consists of the user mode components (application-oriented
software) and the kernel mode components (core OS software); as shown in Figure 3.
Windows 10 in particular can also use its Hyper-V hypervisor to provide orthogonal security
model through Virtual Trust Levels (VTLs): VTL 0 (Normal world) and VTL 1 (secure world) in a
third mode – Virtual Secure Mode (VSM). In both worlds are the user mode and the kernel
(i) Executive: Contains the core OS services, such as memory management, process
(ii) Kernel: Controls execution of the processors. The Kernel manages thread
(iii) Hardware abstraction layer (HAL): Maps between generic hardware commands and
responses and those unique to a specific platform. It isolates the OS from platform-
specific hardware differences. The HAL makes each computer’s system bus, direct
memory access (DMA) controller, interrupt controller, system timers, and memory
controller look the same to the Executive and Kernel components. It also delivers the
(iv) Device drivers: Dynamic libraries that extend the functionality of the Executive.
These include hardware device drivers that translate user I/O function calls into
specific hardware device I/O requests and software components for implementing
file systems, network protocols, and any other system extensions that need to run in
kernel mode.
(i) Special system processes: User-mode services needed to manage the system, such
as the session manager, the authentication subsystem, the service manager, and
(ii) Service processes: The printer spooler, the event logger, user-mode components
that cooperate with device drivers, various network services, and many, many
others. Services are used by both Microsoft and external software developers to
extend system functionality as they are the only way to run background user-mode
includes a subsystem process shared among all applications using the subsystem
and dynamic link libraries (DLLs) that convert the user application calls to ALPC
(iv) User applications: Executables (EXEs) and DLLs that provide the functionality users
run to make use of the system. EXEs and DLLs are generally targeted at a specific
environment subsystem; although some of the programs that are provided as part of
the OS use the native system interfaces (NT API). There is also support for running
Linux is a variant of UNIX that has gained popularity over the last several decades,
powering devices as small as mobile phones and as large as room filling supercomputers.
been a major design goal of the Linux project. Linux development began in 1991, when a
Finnish university student, Linus Torvalds, began creating a small but self-contained kernel
for the 80386 processor – a 32-bit processor in Intel’s range of PC-compatible CPUs.
The Linux system is composed of three main bodies of code, in line with most traditional
UNIX implementations:
1. Kernel. The kernel is responsible for maintaining all the important abstractions of the
2. System libraries. The system libraries define a standard set of functions through which
applications can interact with the kernel. These functions implement much of the
operating-system functionality that does not need the full privileges of kernel code. The
most important system library is the C library, known as libc. In addition to providing the
standard C library, libc implements the user mode side of the Linux system call
3. System utilities. The system utilities are programs that perform individual, specialized
management tasks. Some system utilities are invoked just once to initialize and
connections, accepting logon requests from terminals, and updating log files.
Process Description
and executed on a processor, to perform a given task or job. A program – executable code –
becomes a process when loaded to memory. Basically, a process consists of two parts – code
and associated set of data. The data can be static, heap dynamic or stack dynamic and are
unique to individual process. Two or more processes can have same code but not same data.
Also, a process can assume one of the following states depending on its relationship with the
processor core and memory: New, Running, Waiting/Blocked, Suspend, Ready, or Terminated
be waiting for an event and can only be removed from this state by the explicit orders only of
the agents that ordered the process suspension. Tables 1 to 3 summarize reasons for process
(i) Identifier: A unique identifier associated with this process, to distinguish it from all other
processes.
(iii) Program counter: The address of the next instruction in the program to be executed.
(iv) Memory pointers: Includes pointers to the program code and data associated with this
(v) Context data: These are data that are present in registers in the processor while the
process is executing.
(vi) I/O status information: Includes outstanding I/O requests, I/O devices (e.g., disk
drives) assigned to this process, a list of files in use by the process, and so on.
(vii) Accounting information: May include the amount of processor time and clock time
This process information is collectively called process/task control block (PCB or TCB). A PCB
serves as the repository for all data needed to start, or restart, a process along with some
accounting data. However, on system that supports multiple threads, the PCB is expanded to
include information for each thread. A thread is a lightweight process, a dispatch able unit of
work with a processor context (which includes the program counter and stack pointer) and its
own data area for a stack (to enable subroutine branching). A thread executes sequentially,
and is interruptible so that the processor can turn to another thread. Several threads of same
process can execute concurrently in one or more processors – multithreading. The benefits of
multithreading are: responsiveness, resource sharing, economy, and scalability. However, the
following challenges are evident: task and data splitting, load balancing, data dependency, and
testing and debugging. N.B: Amdahl’s Law: speedup ; as N >> ∞, speedup >> 2.
Process Management
The central themes of operating system design are all concerned with the management of
system
processes, sharing of and competing for resources (such as memory, files, and I/O access),
processes (CPU scheduling). We shall see that these issues arise not just in multiprocessing
concurrent processes.
(iii) Operating system structure: Operating systems are themselves often implemented as a
Table 4.
Scheduling can be long-term (determines the degree of multiprogramming: process creation &
to optimize CPU utilization, throughput, and turnaround, waiting and response times.
We have several scheduling algorithms for uniprocessor processes: FCFS, SJFS, SRTFS,
RRS, PS, PS-A, PS-RRS, MLQS, & MLFQS. For example problem, see Table 5 and Figure 8.
Also see pages 212 to 214 of recommended text. For multiprocessors (Multicore CPUs,
A cooperating process is one that can affect or be affected by other processes executing in the
system. Cooperating processes can either directly share a logical address space (that is, both
code and data) or be allowed to share data only through shared memory or message passing.
Concurrent access to shared data may result in data inconsistency, however. In this class, we
discuss various mechanisms to ensure the orderly execution of cooperating processes that
Critical Section Problem: Consider a system consisting of n processes {P0, P1, ..., Pn−1}.
Each process has a segment of code, called a critical section, in which the process may be
accessing — and updating — data that is shared with at least one other process. The
important feature of the system is that, when one process is executing in its critical section, no
other process is allowed to execute in its critical section. That is, no two processes are
executing in their critical sections at the same time. The critical-section problem is to design a
protocol that the processes can use to synchronize their activity so as to cooperatively share
data. Each process must request permission to enter its critical section.
A solution to the critical-section problem must satisfy the following three requirements:
(i) Mutual exclusion. If process Pi is executing in its critical section, then no other
(ii) Progress. If no process is executing in its critical section and some processes wish
to enter their critical sections, then only those processes that are not executing in
their remainder sections can participate in deciding which will enter its critical section
processes are allowed to enter their critical sections after a process has made a
request to enter its critical section and before that request is granted.
Possible solutions to this problem include Peterson solution as well as the use of Mutex locks,
Semaphores, and Monitors. Each of these solutions has their unique features, strengths and
Peterson’s Solution:
Monitor Problems
(i) A process might access a resource without first gaining access permission to the
resource.
(ii) A process might never release a resource once it has been granted access to the
resource.
(iv) A process might request the same resource twice (without first releasing the
resource).
Liveness refers to a set of properties that a system must satisfy to ensure that processes make
progress during their execution life cycle. Failure to satisfy the liveness property results in
liveness failure.
Deadlock: Two or more processes or threads are said to be deadlocked iff the following four
(i) Mutual exclusion. At least one resource must be held in a nonsharable mode; that is,
only one process or thread at a time can use the resource. If another process or thread
requests that resource, the requesting process or thread must be delayed until the
(ii) Hold and wait. A process or thread must be holding at least one resource and waiting
to acquire additional resources that are currently being held by other processes or
threads.
(iii) No preemption. Resources cannot be preempted; that is, a resource can be released
only voluntarily by the process or thread holding it, after that process or thread has
(iv) Circular wait. A set {T0, T1, ..., Tn} of waiting threads must exist such that T0 is waiting
for a resource held by T1, T1 is waiting for a resource held by T2, ..., Tn−1 is waiting for
A RAG is directed graph of two set of vertices P & R and two set of edges: request edge of the
form Pi → Rj and assignment edge of the form Rj → Pi where processes or threads (Ps) are
Given the definition of a resource-allocation graph, it can be shown that, if the graph contains
no cycles, then no thread in the system is deadlocked. If the graph does contain a cycle, then
a deadlock may exist.
If each resource type has exactly one instance, then a cycle implies that a deadlock has
occurred. If the cycle involves only a set of resource types, each of which has only a single
instance, then a deadlock has occurred. Each process or thread involved in the cycle is
deadlocked. In this case, a cycle in the graph is both a necessary and a sufficient condition for
the existence of deadlock.
If each resource type has several instances, then a cycle does not necessarily imply that a
deadlock has occurred. In this case, a cycle in the graph is a necessary but not a sufficient
condition for the existence of deadlock.
The operating system acts as the Chief Security Officer by providing mechanisms for privacy protection and security. It achieves this through user authentication, access control lists, and encryption. Privilege escalation is managed by mechanisms such as the setuid attribute on UNIX, which allows users to execute programs with higher privileges for specific tasks while preventing unauthorized access, thereby maintaining systems security without compromising privacy .
The operating system plays several roles in memory management, including mapping instructions to absolute addresses, loading them into memory, and managing space allocation. It ensures efficient use by managing memory allocation among various processes, keeping track of each byte in the computer's memory, and optimizing memory usage through methods like paging and segmentation to maximize efficient resource use .
Operating systems provide a variety of user interfaces, such as graphical user interfaces (GUIs) and command-line interfaces (CLIs), to enhance user convenience. GUIs use visual components like windows and icons, making system interaction intuitive, while CLIs offer powerful commands for precision tasks. These interfaces facilitate efficient communication between users and the system, improving user experience .
The operating system ensures cache coherency in multi-core processors using strategies such as maintaining consistency protocols (e.g., MESI - Modified, Exclusive, Shared, Invalid), which monitor and manage the states of data cached across multiple processors. The OS works alongside hardware mechanisms to update or invalidate cached data across cores when changes occur, ensuring that each core works with the most recent data .
Distributed operating systems manage data migration by transferring only the necessary data portions needed for tasks instead of the entire file, optimizing bandwidth usage. They also ensure data translation between different systems. This approach is more efficient than traditional file transfer methods like FTP, which require entire file copies, by reducing latency and limiting unnecessary data movement .
As a resource manager, the OS allocates CPU time and I/O devices to various processes by scheduling them efficiently to maximize throughput and minimize response time. It hides the hardware complexity from users while managing these resources, which boosts overall system performance by ensuring processes get timely access to resources and by facilitating parallel execution in multi-core systems .
The operating system enhances CPU efficiency through multiprogramming and multitasking by allowing multiple programs to reside in memory and execute simultaneously. Multiprogramming enables a CPU switch during idle times, while multitasking switches the CPU based on a time slice. Scheduling ensures that these processes have timely access to CPU resources, and synchronization ensures orderly process execution .
Operating systems manage tertiary storage by handling tasks such as mounting and unmounting media, and controlling access to ensure that devices are used exclusively by processes when needed. This management is significant because it ensures the efficient handling of slow, high-capacity storage, like magnetic tapes, which are essential for tasks such as data backups and archival storage .
The operating system functions as a 'lobbyist' by facilitating networking and seamless communication between separate computer systems. It allows resource sharing through network OS capabilities, enabling users to access remote resources as if they were local. This includes managing data and process migration across systems, ensuring resources can be shared without users needing to understand underlying network complexities .
Multiprogramming and multitasking both aim to optimize CPU utilization by keeping it busy as long as there are tasks to process. Multiprogramming allows multiple processes to reside in memory, switching the CPU among processes when one requires waiting. Multitasking involves time-slicing, dividing the CPU time among processes to ensure responsiveness. Both improve throughput by maximizing CPU use and reducing idle time. Multitasking particularly enhances response time in modern systems by allowing concurrent execution, which is crucial for real-time applications .