0% found this document useful (0 votes)
16 views

lecture_01

The document outlines the introductory lecture on Operating Systems (OS) and computer system structures, presented by Dr. Syed Qamrun Nisa. It covers key topics such as the definition and functions of an OS, computer system organization, and the assessment structure for the course. Additionally, it highlights learning outcomes and the importance of various components like memory management, process management, and the role of interrupts in OS operations.

Uploaded by

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

lecture_01

The document outlines the introductory lecture on Operating Systems (OS) and computer system structures, presented by Dr. Syed Qamrun Nisa. It covers key topics such as the definition and functions of an OS, computer system organization, and the assessment structure for the course. Additionally, it highlights learning outcomes and the importance of various components like memory management, process management, and the role of interrupts in OS operations.

Uploaded by

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

Lecture 1 - Introduction to OS and

Computer System Structures

1
Lecturer Highlight

Dr. Syed Qamrun Nisa


 Room Number : BR2016
 Email : [email protected]

2
Textbook
Abraham Silberschatz, Peter Baer Galvin, Greg
Gagne, “Operating System Concepts”, 9/E, John
Wiley & Sons, 2018.

3
Reference books
William Stallings, "Operating Systems: Internals and
Design Principles", 7th Edition, Prentice Hall, 2012
(ISBN: 978-0-273-75150-2)

Andrew S. Tanenbaum, “Modern Operating


Systems”, 3rd Edition, Prentice Hall, 2009 (ISBN:978-
0-13-813459-4)

4
Assessments
Coursework Assessments (40%)
Mid-term Test (20%)
Topic: chapters 1- 4 and Lab 1 to 3.
Assignment (10%)
Quizzes (10%)
Quiz 1 (5%)
Chapter 4
Quiz 2 (5%)
Chapters 7 & 8
Final Assessments (60%)
Test (60%): Test 1 and Test 2 ( 30% each)
Test 1, chapters 1- 6 and Lab 1 to 3.
Test 2, chapters 7- 12 and Lab 1 to 3.
5
Teaching

6
Plan:
Learning outcomes
1. Identify the components and concepts of operating
systems.
2. Describe the factors in the implementation of an
operating system.
3. Apply specific algorithms and operational
principles considered in the design of operating
systems.
4. Demonstrate in a team environment solutions to
problems on a component of an operating system.

7
Lecture 1: Topic covers
What Operating Systems Do
Computer-System Organization
Computer-System Architecture
Operating-System Structure
Operating-System Operations
Process Management
Memory Management
Storage Management
Protection and Security
8
Objectives
To provide a grand tour of the major operating
systems components
To provide coverage of basic computer system
organization

9
What is an Operating System?
A program that acts as an intermediary between a
user of a computer and the computer hardware

Operating system goals:


 Execute user programs and make solving user
problems easier
 Make the computer system convenient to use
 Use the computer hardware in an efficient
manner
10
How Operating System Assists:
1. Computer System -
 Function: execute user programs efficiently and manages
system operation.
2. Computer hardware –
 Function: Executes application programs, with the OS
providing essential support to manage hardware resources.

 The operating system acts as a central manager that controls


and allocates resources, ensuring smooth and efficient
functioning of both the computer system and hardware.

11
Computer System Structure
Computer system can be divided into four components
 Hardware – provides basic computing resources
 CPU, memory, I/O devices
 Operating system - controls and coordinates use of hardware
among various applications and users programs.
 MS Windows, Android, UNIX, LINUX, MacOS
 Application programs – define the ways in which the system
resources are used to solve the computing problems of the users
 Word processors, compilers, web browsers, database systems,
video games
 Users
 People, machines, other computers (client and server), IOT

12
Four Components of a Computer System

13
Operating System Definition
OS is a resource allocator
 The OS acts as a resource manager, overseeing the allocation
of all system resources such as RAM, ROM, and busses.
 It resolves conflicting requests for resources, ensuring efficient
and fair usage.
OS is a control program
 The OS controls the execution of programs, preventing errors
and unauthorized use of the computer.
 It manages and controls I/O devices through utilities like device
drivers, utility programs, and directory management tools.

14
Operating System as a Central
Manager

15
Operating System Definition
(Cont…)
No Universally Accepted Definition
 A general approximation could be: “Everything a
vendor ships when you order an operating system.”
 However, this can vary significantly depending on
the type of OS and version.
“The one program running at all times on the
computer” is the kernel.
Other components are either system programs
(shipped with the OS) or application programs
(installed by the user).

16
Variations Across Systems:
Early operating systems had limited resources,
often offering just a megabyte of storage space
and lacking even basic features like a full-screen
editor.
Modern systems provide gigabytes of storage and
are primarily built around graphical windowing
environments.

17
Variations Across Systems:
(Cont…)
Microsoft Case (1998):
In 1998, Microsoft faced legal action for integrating
too many functionalities into its OS, limiting the ability
of third-party application vendors to compete.
Example: The inclusion of the web browser as an
integral part of the OS was a key issue.
Microsoft was found guilty of leveraging its OS
monopoly to conquer competition, violating antitrust
laws.

18
OS in Mobile Devices
The number of features in mobile operating systems has
significantly increased over time.
Mobile OSs now include not only a core kernel but also
middleware—software frameworks that provide essential services
for application development.
 Middleware examples: Database-oriented middleware like Microsoft
Open Database Connectivity (ODBC) and Java Database Connectivity
(JDBC).
E.g. of Mobile OS: Apple’s iOS and Google’s Android.
Key Features - a core kernel along with middleware that supports
advance functionalities such as databases, multimedia, graphics.

19
Computer Startup Process:
Bootstrap (BIOS) program is loaded at power-up or reboot
 Is the initial program that runs when you turn on your
computer.
 Typically stored in ROM or EPROM, generally known as
firmware
Key Functions:
 Initializes all system components including hardware
checks, and verification of system functionality)
 Loads the operating system kernel into memory and
starts its execution.

20
Middleware vs Firmware
Middleware: sits between an OS or database and
applications.
 Middleware is a type of computer software that
provides services to software applications beyond
those available from the operating system.
Firmware: is software for hardware, commonly used in
embedded system.
 It is a type of microcode or software program that is
embedded into hardware devices to enable their
efficient operation.
21
Computer System Organization
Computer-system operation
Comprises one or more CPUs, and device
controllers that connect via a common bus
providing
It supportaccess to shared memory
concurrent
execution, where
multiple CPUs and
devices competing for
memory cycles,
enhancing overall
system efficiency.
22
Computer-System Operation
 Concurrent Execution: Both I/O devices and the CPU can
execute tasks simultaneously.
 Device Controllers: Each device controller manages a specific
type of device and has a local buffer (a small storage area) for
temporary data storage.
 Data Movement: The CPU transfers data between main memory
and the local buffers of device controllers.
 I/O Process: Input/Output operations occur between the device
and the local buffer of its controller.
 Interrupts: Once a device completes its operation, the device
controller sends an interrupt to notify the CPU. An interrupt is a
signal from hardware or software to the CPU, requesting
immediate attention or action.
23
Common Functions of Interrupts
An operating system is interrupt driven. Operating
systems respond to interrupts to manage tasks.
Interrupt transfers control to the interrupt service
routine via the interrupt vector, which holds addresses
of all the service routines.
Interrupt system must save the address of the
interrupted instruction.
Incoming interrupts are disabled while another
interrupt is being processed to prevent conflicts (lost
interrupt).
A trap is a software-generated interrupt, triggered by
an error or user request.
24
Interrupt Handling
The operating system preserves the CPU state by
storing registers and the program counter when an
interrupt occurs.
Specific code segments determine what action
should be taken for each type of interrupt
These codes are accessed through interrupt vector
– the interrupt vector contains the addresses of
where these codes are located in memory

25
Interrupt Timeline

26
I/O Structure
Synchronous I/O - After I/O starts, control returns to user
program only after I/O completion
 CPU waits in idle (using a wait instruction) or enters a wait loop
until the next interrupt.
 Only one I/O request can be processed at a time (no
simultaneous I/O).
Asynchronous I/O - After I/O starts, Control returns to the
user program immediately after I/O starts, without waiting
for completion.
 System call – request to the operating system to allow user to wait
for I/O completion if needed.
Device-status table contains entry for each I/O device
indicating its type, address, and state
 Operating system use the table to check device status and
27 updates it when an interrupt occurs
Direct Memory Access (DMA) Structure
DMA allows certain hardware components to access
system memory directly, bypassing the CPU.
Used for high-speed I/O devices that transmit data at
rates near memory speed.
The device controller transfers entire blocks of data
from its buffer directly to main memory without
needing CPU intervention.
Only one interrupt is generated per block of data,
instead of generating one interrupt for each byte.

28
Storage Structure
Main memory – the only large storage media that the
CPU can access directly
Secondary storage – an extension of main memory that
provides large nonvolatile storage capacity
Magnetic disks – composed of rigid metal or glass
platters covered with magnetic recording material
 Disk are divided into tracks, further subdivided into
sectors.
The disk controller manages the logical interaction
between the storage device and the computer
29
Storage Hierarchy
Storage systems organized in hierarchy
Speed
Cost
Volatility
Caching – copying information into a faster storage
system to speed up access.
Main memory can be viewed as the final cache for
secondary storage

30
Storage-Device Hierarchy
Price:
Speed: Fast

volatile
Expensive

nonvolatile
Speed: Slow Price: Cheap
31
Caching (Video)
A key principle applied at various levels in a computer
(in hardware, operating system, software)
Temporary copy of data from slower to faster storage
Faster storage (cache) checked first:
 If data is found, it's used directly from the cache (fast
access).
 If not, data is copied to the cache and used from there.
Cache is smaller than storage being cached
Cache management is crucial:
 Focus on cache size and replacement policy

32
Computer-System Architecture
Most systems use a single general-purpose processor (PDAs
through mainframes)
 Most systems have special-purpose processors as well
Multiprocessors systems is growing in use and importance.
 Also known as parallel systems or tightly-coupled systems
 Advantages include
1. Increased throughput
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
 Types of Multiprocessing
1. Asymmetric Multiprocessing
2. Symmetric Multiprocessing

33
How a Modern Computer Works

34
Symmetric Multiprocessing Architecture

A multiprocessor system
where multiple
processors share a
single, main memory and
have equal access to all
Key Characteristics:
I/O
•All devices.
processors run the same operating system
instance.
•Processors are peer-level, meaning no
35
master/slave relationship exists.
•Each processor can perform tasks independently or
A Dual-Core Design

A type of CPU architecture


featuring two independent
processing units (cores) within
a single chip.
Key Characteristics:
•Each core can execute instructions and manage
tasks simultaneously, effectively functioning as two
separate processors.
•Shares resources such as cache, memory, and I/O
36
interfaces, enhancing efficiency.
37
Clustered Systems
Similar to multiprocessor systems, but involves multiple
computers working together, often sharing storage via a
Storage-Area Network (SAN).
Provides a high-availability service that can survive system
failures.
Types of Clustering:
Asymmetric clustering has one machine in hot-standby mode
Symmetric clustering has multiple nodes running applications,
monitoring each other
Some clusters are designed for high-performance computing
(HPC), where applications (code & algorithm) must support
parallelization to fully utilize the system’s capabilities.
38
Operating System Structure
Multiprogramming needed for efficiency by
increasing CPU utilization.
Single program cannot keep both CPU and I/O
devices busy at all times.
How it Works:
 Organizes jobs (code and data) so CPU always has a task to
execute.
A subset of total jobs is kept in memory, allowing quick switching
between jobs.
One job is selected and run via job scheduling
When a job is waiting (for I/O for example), OS
switches to another job, maximizing CPU usage.
39
Memory Layout for Multiprogramme
System (Job Pool)

OS picks and
begins to execute
one of the jobs

40
Operating System Structure (Cont…)
Timesharing (multitasking) is logical extension in which CPU
switches jobs so frequently that users can interact with each job
while it is running, creating interactive computing.
 Ideally, the system Response time should be less than (<) 1
second.
 Each user has at least one program executing in memory –
process.
 If several jobs are ready to run at the same time - CPU
scheduling decides which one to execute.
 If processes don’t fit in memory, process swapping (RAM <->
Secondary Storage) moves them in and out to run.(reasonable
response time).
 Virtual memory allows the execution of processes that are not
entirely loaded in memory - enhancing system efficiency.
41
User Interaction and Processes:
User Instructions:
Users give commands to the Operating System (OS) or a
program directly through input devices like the keyboard.
The user then waits for immediate results on output
devices (e.g., monitor, printer).
Process:
A program that has been loaded into memory and is
currently executing is called a process.

42
Operating-System Operations
Interrupt driven by hardware occur when the system needs to
handle events outside of the normal program flow.
When Software encounters an error or request that it cannot handle,
it triggers an exception or trap.
 This means that the normal flow of the program is interrupted, and the
software must handle the exceptional condition to prevent the program
from crashing
 Other process problems include infinite loop or processes modifying
each other or the operating system, requires careful handling by the OS
itself.
Dual-mode operation allows OS to protect itself and other system
components
 Two modes: User mode and kernel mode, distinguished by a mode bit in
hardware.
 The mode bit allows the OS to distinguish between these two modes,
controlling what level of access a process has.
 Privileged instructions can only be executed in kernel mode for security.
 System calls switch the mode to kernel mode; while returning from the call it’ll resets it to
user mode.
43
Transition from User to Kernel Mode
A timer is set to ensure that no user process runs for
too long (i.e., prevents infinite loops) or consumes
excessive resources (CPU time).
A time generate an interrupt after specific period.
The timer decrements the counter as the process
executes.
When counter is zero, an interrupt is triggered.
Set up before scheduling process to regain control or
terminate program that exceeds allotted time

44
Process Management
A process is an active entity representing a program in
execution and it is dynamic, performing tasks within the
system. While a program is a passive entity (just code).
Process needs resources to accomplish its task:
 CPU (processing power)
 Memory (to store the process in RAM)
 I/O devices (for input/output operations)
 Files (data used or generated during execution)
 Initialization data (specific data needed to start the
process)
When a process completes, the operating system reclaims
any reusable resources (e.g., memory, CPU time) so they can
be assigned to other processes.

45
Process Initialization and System Calls
in OS
Initialization Data: Various inputs or configurations
provided when a process starts. These allow the
process to perform its intended task.
Example:
 A process designed to display the status of a file on the
screen would require:
 File name as input (passed when the process is initiated).
 Execution: The process then follows instructions to read and display
the file status (such as size, permissions, or last modified date).
 System Calls: The process uses system calls to interact with the OS,
obtaining and displaying the necessary file information on the
screen.

46
Process Management (Cont…)
Single-threaded process contains one program counter to
track the next instruction to execute.
Process executes instructions sequentially, one at a time,
until complete.
Multi-threaded process has one program counter per
thread, allowing multiple threads within the same process
to execute independently.
The system typically runs many processes simultaneously,
some belonging to users, others being part of the
operating system.
Concurrency is achieved by multiplexing the CPU(s) between
processes and threads, allowing for efficient multitasking.
47
Multithreaded Process
Contains multiple program counters.
Each program counter points to the next instruction to
execute for its corresponding thread, allowing for
independent execution of multiple threads within the
same process.

48
Process Vs Thread
Thread is smaller than a process.
Uses fewer resources than process creation.

Criteria Process Threads


Unit of Independent instance A lightweight unit of
Execution of a running program. execution within a
process.
Memory Each process has its Threads share the same
Space & own memory space, memory space and
Resource resources, and resources as the process
Allocation execution state. they belong to.
Manageme Managed by the Managed within the
49 nt operating system context of the process
Process Management Activities
The operating system is responsible for the following
activities in connection with process management:
Creating and deleting both user and system
processes
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication
Providing mechanisms for deadlock handling

50
Memory Management
All data must be loaded into memory before and after
processing.
All instructions must reside in memory to execute.
Memory management determines what is in memory when
 Optimizing CPU utilization and enhance computer response
time for users
Memory management activities
 Keeping track of which parts of memory segments are in use
and by which processes
 Deciding which processes (or parts thereof) and data to move
in or out of memory.
 Allocate memory space as required and reclaims it when no
longer needed.
51
Storage Management
 OS provides a consistent and logical view of information storage
 Abstracts physical properties into logical storage unit is called as file
 Each storage medium (i.e., disk drive, tape drive) is managed by a
corresponding device
 Storage media differ in access speed, capacity, data-transfer rate, and
access method (sequential or random)
 File-System management
 Files are typically organized into directories for easier access and
management.
 Most systems implemented access controls to determine user permissions
for file access.
 OS activities includes:
 Creating and deleting files and directories.
 Providing primitives to manipulate files and directories.
 Mapping files onto secondary storage
52
 Backup files onto stable (non-volatile) storage media
Protection and Security
 Protection – Mechanism for controlling access of processes or users to system
resources – More towards human modification (Setting up password, PIN etc..)
 Security – involves defense of the system against internal and external attacks
 Huge range, including denial-of-service, worms, viruses, identity theft, theft of
service. (Install antivirus, enable firewall, etc..)
 Systems distinguish among users to determine permissions.
 User Identifier:
 User identities (user IDs, security IDs) - Unique identifiers with each user (name and number)
 Each user’s UID is linked to all their files and processes for access control.
 Group Identifier:
 Group identifier (group ID) allows set of users to be defined, enabling group-level control.
 Each process and file can also be associated with a GID for access management.
Privilege escalation - A security mechanism that allows a user to change
their effective ID to gain enhanced rights or permissions.

53
UNIX (Privileges)

Setuid (Set User ID) - A special permission in UNIX that


allows a program to run with the privileges of the file owner.
Functionality:
 When a user executes a program with the setuid bit set, the
process temporarily adopts the user ID (UID) of the file's
owner.
 This enables users to perform tasks that require higher
privileges than their own.
Common Use Cases:
 Running administrative tasks without requiring the user to
have root access.
54
End of Lecture 1

Slides adapted from the book:

Abraham Silberschatz, Peter Baer Galvin, Greg


Gagne, “Operating System Concepts”, 8/E, John
Wiley & Sons, 2010. (ISBN: 978-0-470-23399-3)

You might also like