Unit 1-Introduction and
Overview
Operating Systems (I3792CO)
Course Coordinator: Frans Shafuda (Dr.)
Reference Material: Operating System Concepts 9th Ed By Abraham Silberschatz, Peter Baer Galvin
And Greg Gagne.
What is an Operating System (OS)?
❖Definition
• An Operating System is a program that manages a computer's hardware.
• It acts as an intermediary between the computer user and the computer hardware.
• Provides a basis for application programs to run.
• Think of it as the
❑ "government" of the computer: it performs no useful function by itself, but provides an environment
for other programs to do useful work.
2
What is an Operating System (OS)?
❖ Key Roles of an Operating System
• Resource Allocator: Manages and allocates
computer resources (CPU time, memory, file-
storage, I/O devices) efficiently and fairly among
competing requests.
• Control Program: Manages the execution of
user programs to prevent errors and improper
use of the computer,
➢ especially concerned with I/O device operation
and control.
3
What is an Operating System (OS)?
❖ Views of an Operating System: User vs. System
❖ User View
• PC Users: Primarily focused on ease of use and maximizing individual work/play. Resource
utilization is less of a concern.
• Mainframe/Minicomputer Users: Share resources; OS designed to maximize resource utilization
(CPU, memory, I/O) efficiently among multiple users.
• Workstation Users: Balance between individual usability and resource sharing (e.g., file, compute,
print servers).
• Mobile Users: Designed for easy interface via touch screens, often connected to networks
(cellular/wireless). Focus on portability and specific features like GPS, accelerometers.
• Embedded Systems: Little to no user view; designed to run without user intervention, primarily
monitoring and managing hardware (e.g., in cars, home devices).
4
What is an Operating System (OS)?
❖ Views of an Operating System: User vs.
System
❖ System View
• The OS is the program most intimately involved
with the hardware.
• Acts as a resource allocator and a control
program.
5
Computer System Organization
❖ The Building Blocks
• A modern computer system consists of
❑ CPUs, device controllers, and shared memory connected via a common bus.
6
Computer System Organization
❖ Operation
• Bootstrap Program (Firmware): Initial program run at power-up or reboot. Initializes all
system aspects and loads the OS kernel into memory.
❑Stored in ROM or EEPROM.
• Interrupts: Events signaled by hardware or software (via system calls) that transfer control to
an interrupt service routine.
❑ Essential for orderly system operation and efficient I/O.
❑ Interrupt Vector: A table of pointers to interrupt service routines, indexed by a unique
device number, enabling fast interrupt handling.
❑The CPU saves the interrupted instruction's address (often on the stack) to resume later.
7
Computer System Organization
❖ Operation
• Interrupt Timeline for I/O:.
8
Computer System Organization
❖ Storage Structure:
• Main Memory (RAM): Volatile, rewritable, CPU can load instructions and data directly.
• Secondary Storage: Nonvolatile, holds large quantities of data permanently (e.g., magnetic
disks, SSDs).
• Tertiary Storage: Slower, lower cost, higher capacity for backups and archival (e.g., magnetic
tapes, CD/DVDs).
9
Computer System Organization
❖ Storage Hierarchy:
• Organized by speed and cost,
• from fastest/most expensive (registers) to
slowest/cheapest (magnetic tapes).
10
Computer System Organization
❖ Interactive Question 1:
Which level of the memory hierarchy would be most suitable for frequently accessed, small
pieces of data that the CPU needs immediately? Why?
A) Magnetic Disk
B) Main Memory
C) Registers
D) Optical Disk
11
Computer System Organization
❖ Answer to Q1:
• The correct answer is : C) Registers.
❑ Explanation:
• Registers are at the top of the memory hierarchy, offering the fastest access time and highest cost
per bit.
• They are physically located within the CPU itself, allowing for immediate access by the processor.
• This makes them ideal for storing small, frequently accessed pieces of data that the CPU needs for
ongoing computations.
❑ Why not B) Main Memory?
• While faster than disk, main memory (RAM) is still significantly slower than registers and is used for
currently executing programs and data. Data must be moved from main memory to registers for CPU
processing.
12
Computer System Organization
13
Computer System Organization
❖ I/O Structure: Communicating with Devices
• Device Controllers: Manage specific device types (e.g., disk, audio, video) and have local buffer
storage and registers.
• Device Drivers: Software provided by the OS to understand and interact with device controllers,
offering a uniform interface to the rest of the OS.
• Interrupt-Driven I/O: For small data transfers, device controllers inform the device driver via an
interrupt upon completion of an operation.
• Direct Memory Access (DMA): For bulk data movement (e.g., disk I/O), the device controller
transfers entire blocks directly to or from its own buffer storage to memory, with no intervention by the
CPU. Only one interrupt is generated per block.
14
Computer System Organization
❖ I/O Structure: Communicating with
Devices
15
Computer-System Architecture
❖ Processing Power: Single-Processor Systems
• One main CPU capable of executing a general-purpose instruction set, including instructions
from user processes.
• May have other special-purpose processors (e.g., disk, keyboard controllers) that run limited
instruction sets and don't execute user processes.
16
Computer-System Architecture
❖ Processing Power: Multiprocessor Systems (Parallel/Multicore)
• Two or more processors in close communication, sharing the computer bus and sometimes the
clock, memory, and peripheral devices.
17
Computer-System Architecture
❖ Processing Power: Multiprocessor Systems (Parallel/Multicore)
• Multicore Systems: Multiple computing cores on a single chip, offering faster on-chip
communication and lower power consumption.
❑ Advantages: Increased throughput , economy of scale , increased reliability (graceful
degradation, fault-tolerant systems).
• Types
❑ Asymmetric Multiprocessing: One machine is in hot-standby mode while the other is
running the applications.
❑ Symmetric Multiprocessing (SMP): All processors are peers and perform all tasks within
the operating system, sharing physical memory but having their own registers and caches.
➢ Most modern OSes support SMP (Windows, Mac OS X, and Linux).
18
Computer-System Architecture
❖ Processing Power: Multiprocessor Systems (Parallel/Multicore)
• Symmetric Multiprocessing (SMP)
19
Computer-System Architecture
❖ Processing Power: Clustered Systems
• Another type of multiprocessor system is a clustered system.
• Clustered Systems: Multiple individual computer systems (nodes) joined via a LAN or faster
interconnect, sharing storage. Each node may be a single processor system or a multicore
system.
20
Computer-System Architecture
❖ Processing Power: Clustered Systems
• Primary for high-availability service (redundancy: service continues if one node fails).
• Can also provide high-performance computing through parallelization of applications.
• Asymmetric Clustering: One machine is in hot-standby mode while the other is running the
applications.
• Symmetric Clustering: Two or more hosts are running applications and are monitoring each
other, which is more efficient.
21
Operating System Structure
❖ How the OS Works
• Multiprogramming: OS keeps several jobs in memory simultaneously to increase CPU
utilization. When one job waits (e.g., for I/O), the CPU switches to another
22
Operating System Structure
❖ How the OS Works
• Time Sharing (Multitasking): Logical extension of multiprogramming. CPU switches among
jobs so frequently that users can interact with each program, providing the illusion of
simultaneous execution. Requires interactive systems with short response times.
❑Process: A program loaded into memory and executing. An active entity, unlike a passive
program.
❑Key Responsibilities: Job scheduling, CPU scheduling, memory management, and
limiting inter-process interference.
❑Virtual Memory: Allows execution of processes not entirely in physical memory,
abstracting memory for programmers and enabling larger programs
23
Operating System Operations
❖ Control & Protection
• Interrupt-Driven: Modern OSes wait for events signaled by interrupts (hardware) or
traps/exceptions (software-generated interrupts due to errors or system calls).
• Dual-Mode Operation: Hardware support to distinguish between User Mode (user
applications) and Kernel Mode (OS code execution) using a mode bit (0 for kernel, 1 for user).
• System Calls: The mechanism for a user program to request OS services, causing a trap from
user mode to kernel mode.
• Timer: Prevents user programs from monopolizing the CPU or getting stuck in infinite loops.
Generates an interrupt after a specified period, transferring control back to the OS.
24
Operating System Operations
❖ Control & Protection
• Dual-Mode Operation Illustration: User Mode (user applications) vs Kernel Mode (OS code
execution) using a mode bit (0 for kernel, 1 for user).
25
Core OS Management Functions
❖ Process Management
• A program in execution is a process.
• The operating system is responsible for:
1. Scheduling processes and threads on the CPUs.
2. Creating and deleting both user and system processes.
3. Suspending and resuming processes.
4. Providing mechanisms for process synchronization.
5. Providing mechanisms for process communication.
26
Core OS Management Functions
❖ Memory Management
• Main memory is a large array of bytes, each with its own address, and is a repository of quickly
accessible data shared by the CPU and I/O devices.
• The operating system is responsible for:
1. Keeping track of which parts of memory are currently being used and who is using them.
2. Deciding which processes (or parts of processes) and data to move into and out of
memory.
3. Allocating and deallocating memory space as needed.
27
Core OS Management Functions
❖ Storage Management
• The operating system abstracts from the physical properties of its storage devices to define a
logical storage unit, the file.
• File-System Management:
1. Creating and deleting files and directories.
2. Supporting primitives for manipulating files and directories.
3. Mapping files onto secondary storage.
4. Backing up files on stable (nonvolatile) storage media.
• Mass-Storage Management: Manages disk storage (free-space management, storage
allocation, disk scheduling) for efficiency.
28
Core OS Management Functions
❖ Storage Management
• Caching: Information is copied from a slower storage system (source) into a faster storage
system (cache) on a temporary basis for quicker access.
❑ Cache Coherency: In multiprocessor environments, ensuring an update to a value in one
cache is immediately reflected in all other caches where that value resides.
❑ This is usually a hardware issue.
• I/O Systems: Hides hardware peculiarities of specific devices from the user through an I/O
subsystem that includes buffering, caching, spooling, a general device-driver interface,
and drivers for specific hardware devices.
29
Protection and Security
• Protection: Any mechanism for controlling the access of processes or users to the resources
defined by a computer system. It provides means to specify and enforce controls.
• Security: Responsible for defending a system from external and internal attacks (e.g., viruses,
denial-of-service, identity theft).
• User IDs (UIDs) & Group IDs (GIDs): Most operating systems maintain a list of user names
and associated unique numerical user identifiers (user IDs or SIDs in Windows). Group IDs
distinguish among sets of users.
• Privilege Escalation: Operating systems provide various methods to allow users to escalate
privileges to gain extra permissions for an activity (e.g., the setuid attribute on a UNIX program)
30
Kernel Data Structures: The OS's Inner Workings
❖Fundamental data structures used extensively in operating systems: Lists
• Lists: Sequentially ordered data structures where items are linked to one another.
❑ Singly linked list: each item points to its successor.
❑ Doubly linked list: an item can refer to its predecessor or successor.
❑ Circularly linked list: the last element refers to the first.
31
Kernel Data Structures: The OS's Inner Workings
❖Fundamental data structures used extensively in operating systems: Stacks, Queues and
Trees
• Stacks: LIFO (Last In, First Out) data structure, where the last item added is the first removed.
Operations are push and pop. Used for function calls.
• Queues: FIFO (First In, First Out) data structure, where items are removed in the order they were
inserted. Common in operating systems for tasks waiting to be run (e.g., print jobs, CPU tasks).
• Trees: Data structures that represent data
hierarchically through parent-child relationships.
❑ Binary tree: a parent has at most two children.
❑ Binary search tree: requires ordering between
children.
❑ Balanced binary search tree: ensures efficient
search performance (e.g., red-black trees in
Linux kernel for CPU scheduling).
32
Kernel Data Structures: The OS's Inner Workings
❖Fundamental data structures used extensively in operating systems: Hash Functions & Maps
• Hash Functions: A hash function takes data input, performs a numeric operation, and returns a
numeric value used as an index into a table (hash map) to quickly retrieve data.
❑ Handle hash collisions by having a linked list at the table location for items with the same hash
value.
33
Kernel Data Structures: The OS's Inner Workings
❖Fundamental data structures used extensively in operating systems: Hash Functions & Maps
• Bitmaps: A string of binary digits used to represent the status of 'n' items (e.g., resource availability,
disk block status).
❖Example:
❑ Purpose: Resource availability
➢ 0 could mean "resource available", 1 means "resource unavailable" (or vice-versa).
➢ The value at the 𝑖 𝑡ℎ position in the bitmap corresponds to the 𝑖 𝑡ℎ resource.
❑ Example Bitmap: 001011101
• Resources 2, 4, 5, 6, and 8 are unavailable.
• Resources 0, 1, 3, and 7 are available.
• Why use Bitmaps? Highly space efficient
• Using a single bit per item is far more efficient than using a larger data type (e.g., an 8-bit Boolean
value would be 8 times larger).
• Real-world Use: Commonly used in operating systems for large numbers of resources, such as
indicating the availability of disk blocks on a disk drive.
34
Modern Computing Environments
❖Traditional Computing:
• Involves desktop and laptop PCs, usually connected to a computer network.
• Time-sharing techniques are still in use on these systems, often with processes owned by a single
user.
❖Mobile Computing:
• Refers to computing on handheld smartphones and tablet computers. These devices offer unique
features like GPS chips and accelerometers.
• Dominated by Apple iOS and Google Android.
35
Modern Computing Environments
❖Distributed Systems:
• A collection of physically separate, possibly heterogeneous, computer systems that are networked to
provide users with access to shared resources.
• Increases computation speed, functionality, data availability, and reliability.
❑ Network Types: Local-area network (LAN) , wide-area network (WAN) , metropolitan-area
network (MAN) , personal-area network (PAN) via Bluetooth/802.11.
• Network OS vs. Distributed OS: A network operating system provides features like file sharing
across the network, while a distributed operating system provides the illusion that only a single
operating system controls the network.
36
Modern Computing Environments
❖Client-Server Computing: Many of today's systems act as server systems to satisfy requests
generated by client systems.
❑Compute Servers: Provide an interface for clients to send requests to perform actions (e.g., read
data from a database).
❑File Servers: Provide a file-system interface where clients can create, update, read, and delete
files (e.g., a web server).
37
Modern Computing Environments
❖Peer-to-Peer (P2P) Computing: All nodes within the system are considered peers, and each may act
as either a client or a server.
• Services can be provided by several nodes distributed throughout the network, offering an advantage
over client-server systems by avoiding a single bottleneck.
38
Modern Computing Environments
❖Virtualization: A technology that allows
operating systems to run as applications within
other operating systems, or directly on hardware.
• The Virtual Machine Manager (VMM) runs
guest operating systems, manages their
resource use, and protects each guest.
❑Emulation: Used when the source CPU
type is different from the target CPU type,
translating instructions (e.g., Apple's
"Rosetta" for IBM to Intel CPUs, Java Virtual
Machine).
39
Modern Computing Environments
❖Cloud Computing: Delivers computing,
storage, and applications as a service across
a network, often using virtualization as a
base.
• Types: Public cloud, private cloud, hybrid
cloud, Software as a Service (SaaS),
Platform as a Service (PaaS), Infrastructure
as a Service (IaaS).
40
Modern Computing Environments
❖Real-Time Embedded Systems:
• Most prevalent form of computers, found in devices from car engines to microwave
ovens.
• They tend to have very specific tasks and usually have little or no user interface,
primarily monitoring and managing hardware devices.
• Embedded systems almost always run Real-Time Operating Systems (RTOS):
❑Used when rigid time requirements are placed on the operation of a processor
or data flow.
❑Processing must be done within defined constraints, or the system will fail (e.g.,
industrial control systems, medical imaging systems).
41
Open-Source Operating Systems
❖The Future is Open
❖ Definition: Open-Source OSs are operating systems available in source-code format rather
than as compiled binary code.
• Examples:
❑Linux (most famous) ,
❑BSD UNIX (FreeBSD, NetBSD, OpenBSD, DragonflyBSD) ,
❑Solaris (OpenSolaris project). Apple's macOS/iOS use the open-source Darwin kernel.
• Benefits:
1. Community contributions (debugging, support, suggestions).
2. Enhanced security (more eyes viewing the code).
3. Excellent learning tool for students to explore and modify kernel code.
4. Copylefting (GNU GPL): Encourages sharing and improvement; requires source code
distribution with any binaries and any changes to be released under the same GPL license.
42
Self Assessment Qs
PART A: MCQs
1. Which of the following best describes the primary role of an operating system?
A) To execute user application programs exclusively.
B) To manage computer hardware and provide an environment for application programs.
C) To act as a firewall, protecting the computer from all external attacks.
D) To provide direct communication between I/O devices without CPU intervention.
2. In a modern computer system, what is the initial program that runs when the computer is powered up
or rebooted?
A) The user's first application program.
B) A system daemon.
C) The bootstrap program (firmware).
D) The I/O interrupt processing routine.
43
Self Assessment Qs
3. Which of these storage levels offers the fastest access time but is typically the most expensive per bit?
A) Magnetic Disk
B) Main Memory
C) Optical Disk
D) Registers
4. What is the main purpose of "multiprogramming" in an operating system?
A) To allow a single user to run only one program at a time.
B) To ensure the CPU is always idle when an I/O operation is occurring.
C) To increase CPU utilization by organizing jobs so the CPU always has one to execute.
D) To convert a single-processor system into a multiprocessor system.
44
Self Assessment Qs
5. When a user program requests a service from the operating system, what special operation is typically
executed, causing a switch from user mode to kernel mode?
A) An I/O transfer done signal.
B) A general interrupt.
C) A system call (or monitor call).
D) A context switch between user processes.
6. Which of the following instructions should be considered privileged?
A) Reading data from main memory.
B) Performing arithmetic calculations.
C) Setting the value of the system timer.
D) Accessing local variables within a user program.
45
Self Assessment Qs
7. What is the key characteristic that distinguishes a "process" from a "program"?
A) A process is always written in assembly language, while a program is in a high-level language.
B) A process is an active entity (a program in execution), while a program is a passive entity.
C) A process resides on disk, while a program resides in main memory.
D) A process requires no CPU time, only I/O operations.
8. What mechanism is employed for high-speed I/O devices to avoid increasing the CPU's execution load
by transferring entire blocks of data directly to or from memory without CPU intervention for each byte?
A) Interrupt-driven I/O
B) Programmed I/O
C) Direct Memory Access (DMA)
D) Polling
46
Self Assessment Qs
9. In the context of computer system architecture, what is the primary purpose of "clustered systems"?
A) To combine multiple single-processor systems into one large mainframe.
B) To provide high-availability service and potentially high-performance computing.
C) To allow a single user to monopolize all system resources.
D) To replace all forms of secondary storage with faster, more expensive memory.
10. What is a "bitmap" primarily used for in operating systems, as described in the chapter?
A) To store graphical images for the user interface.
B) To represent hierarchical data structures.
C) To indicate the availability status of a large number of resources, such as disk blocks.
D) To implement client-server communication protocols.
47
Self Assessment Qs
11. Which of the following is a key responsibility of the operating system's memory management
component?
A) Creating and deleting user and system processes.
B) Deciding which processes and data to move into and out of memory.
C) Managing the execution of user programs to prevent errors.
D) Providing mechanisms for process synchronization.
12. In a hash map data structure, what is the term for when two different inputs produce the same output
value, linking to the same table location?
A) Collision
B) Overflow
C) Deadlock
D) Segmentation fault
48
Self Assessment Qs
13. Which computing environment is characterized by physically separate, possibly heterogeneous,
computer systems that are networked to provide users with access to various resources, increasing
computation speed, functionality, data availability, and reliability?
A) Single-processor system
B) Traditional batch system
C) Distributed system
D) Real-time embedded system
14. What is a primary advantage of open-source operating systems compared to closed-source systems?
A) They are always more graphically rich and user-friendly.
B) They are typically more secure due to a larger community viewing and debugging the code.
C) They do not require any form of licensing.
D) They cannot be modified by external developers.
49
Self Assessment Qs
PART B: Structured Qs
Question 1: What are the three main purposes of an operating system?
Question 2: In a time-sharing system, what is the primary goal regarding user interaction?
Question 3: Distinguish between a "program" and a "process.“
Question 4: What is the primary function of the bootstrap program when a computer is powered on?
Question 4: What is the primary function of the bootstrap program when a computer is powered on?
Question 6: Give two reasons why caches are useful.
Question 7: Explain the concept of "dual-mode operation" in an operating system. What is its main purpose?
Question 8: List three advantages of multiprocessor systems.
Question 9: How do clustered systems differ from multiprocessor systems?
Question 10: What is a "privileged instruction," and why is it important for operating system security?
Question 11: Briefly describe two core responsibilities of the operating system in Process Management.
Question 12: Distinguish between Client-Server Computing and Peer-to-Peer (P2P) Computing.
Question 13: What is "virtualization" and how does it relate to "cloud computing"?
50
Self Assessment Qs
PART C: Hands-on Problem
Concept Focus: Dual-Mode Operation, User Mode, Kernel Mode, Privileged Instructions, System Calls.
Task:
1. Open a terminal in your Ubuntu VM.
2. Run a simple command like ls -l /boot. This command lists files in a system directory.
3. Now, try to write directly to a sensitive system file (e.g., echo "test" > /etc/passwd). You will likely get a
"Permission denied" error.
4. Next, try the same write command with sudo (e.g., sudo echo "test" > /etc/passwd). You will be prompted
for your password.
Analyze:
1. When you execute ls -l /boot, is the ls program running in user mode or kernel mode primarily? When ls needs
to read file information from the disk, does it directly interact with the hardware, or does it make a system call?
Explain your reasoning.
continue to the next slide ….
51
Self Assessment Qs
Analyze:
2. Explain why the direct echo "test" > /etc/passwd command failed. Relate this to the concept of privileged
instructions and user mode operation.
3. When you used sudo, you were prompted for a password. What fundamental OS concept does sudo help
illustrate in terms of gaining temporary heightened permissions, and which mode does the system transition to
when executing the command via sudo after authentication?
52