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

Chapter 9 Complete

Uploaded by

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

Chapter 9 Complete

Uploaded by

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

Introduction to

Operating Systems
Introduction to Operating
Systems

SLOs 9.1.1 – 9.1.2

Learning Outcomes

After this lecture students will be able:


• Define Software Application and System
Software (OS)
• Identify the commonly used operating systems;
• List the tasks performed by an operating
system;
Software
Software refers to a set of instructions, data, or
programs that are used to operate computers and
execute specific tasks.

Types of Software
1. System Software (Operating System)
2. Application Software
Operating System (System
Software)
An operating system (OS) is the most fundamental
software that runs on a computer. It acts as an
intermediary between the computer hardware and the
user, as well as other software applications. The OS
manages the computer's resources, such as the central
processing unit (CPU), memory, storage, and input/output
devices, and provides services for other programs to run.
Commonly Used
Operating Systems
Operating Systems and its types vary depending on
device type:
For Desktops and Laptops:

1. Microsoft Windows: The most popular OS for


personal computers, known for its user-friendly
interface and wide range of software compatibility.
2. macOS: The operating system for Apple's Mac
computers, known for its sleek design, user-
friendliness, and integration with other Apple devices.
3. Linux: An open-source OS that is highly customizable
and often used in servers, embedded systems, and
high-performance computing.
Commonly Used
Operating Systems
For Mobile Devices (Smartphones and
Tablets):

1. Android: The most widely used mobile OS


globally, developed by Google and used in a
wide range of devices from various
manufacturers.
2. iOS: The mobile OS for Apple's iPhones and
iPads, known for its smooth performance,
intuitive interface, and strong security features
Tasks of Operating Systems

Some of the most important tasks performed by operating systems are:


1. Process Management
a. Allocating resources (CPU time, memory) to processes
b. Terminating processes when they are finished

2. Memory Management:
a. Allocating and deallocating memory to processes.
b. Keeping track of used and free memory
Tasks of Operating Systems

3. File 4. Device
Management
Providing operations for creating,
Management:
Managing input/output operations with
reading, writing, and deleting files. various devices (keyboard, mouse,
Managing file permissions and access monitor, etc.)
control Providing device drivers for hardware
Keeping track of file attributes (size, interaction.
date, etc.) Allocating and deallocating devices to
processes.
Tasks of Operating
Systems

5. User Interface:
a. Providing a graphical user
interface (GUI) or command-line
interface (CLI)
b. Managing user input and output
c. Displaying information and error
messages
Introduction to Operating
System

SLO: 9.1.3
Objectives:
Students will be able to:
1. Differentiate between command line interface and graphical user interface of an operating system;
2. Identify the core advantages and disadvantages of each interface type.
How many of you prefer using
apps with icons and windows
versus typing commands?

How do we interact with the OS?


Interface
An interface defines how a user
interacts with an operating
system or a software application.

There are two types of


interfaces:
1. GUI (Graphical User
Interfaces)
2. CLI (Command Line
Interfaces)
Graphical User
Interface

A Graphical User Interface (GUI),


pronounced "gooey," is a type of user
interface that allows users to interact
with electronic devices like computers,
smartphones, and tablets through
visual elements like icons, windows,
menus, and pointers.
Examples

Desktop Operating Systems


(Windows)
Examples

Desktop Operating Systems


(macOS)
Examples
Desktop Operating
Systems
(Linux)
Examples
Mobile Apps
(WhatsApp)
• User-Friendliness: GUIs are intuitive Pros of GUIs
and easy to learn, even for beginners.
Visual elements like icons and menus
guide users through interactions,
eliminating the need to memorize
complex commands.
• Visual Appeal: GUIs are aesthetically
pleasing and engaging. The use of
colors, images, and animations makes
the user experience more enjoyable.
• Efficiency for Common Tasks: GUIs
streamline common tasks with point-
and-click interactions, making them
faster than typing commands for
everyday use.
Multitasking: GUIs facilitate
multitasking by allowing
users to easily switch
between different Pros of GUIs
applications and windows.

Accessibility: GUIs are


generally more accessible than
command-line interfaces,
especially for people with visual
impairments who may benefit
from screen readers and other
assistive technologies.

WYSIWYG (What You See Is


What You Get): GUIs provide
a visual representation of the
final output, making it easier
for users to understand the
impact of their actions.
Cons of GUIs

• Resource Intensive: GUIs consume more system resources


(CPU, memory, etc.) than command-line interfaces due to
their graphical nature. This can lead to slower performance
on less powerful devices.
• Less Efficient for Power Users: Experienced users who
are familiar with command-line interfaces might find GUIs
slower for certain tasks that require precise control or
repetitive actions.
• Limited Customization: While GUIs offer some
customization options, they are generally less flexible than
command-line interfaces, where users have more control
over the system's behavior.
Command Line Interface

CLI, or Command Line Interface, is like a way to talk to your computer


using text instead of clicking icons and buttons. Imagine it as a
conversation where you type commands and your computer responds by
doing what you asked.

For example, instead of clicking a folder icon to open it, you might type
"open folder_name" in a CLI. While it might seem old-fashioned compared
to fancy graphics, it's actually very powerful for technical tasks and can be
faster for experienced users.
(Desktop OS)

Examples Windows CMD and


Shell
(Desktop OS)
Examples Linux Terminal
(Mobile Apps)
Examples Termux
Pros of CLI
1. Speedy: CLIs can be lightning fast! Typing a few
letters can do the same thing as clicking through
multiple menus.
Pros of CLI

2. Powerful: CLIs let you do almost


anything on your computer. They're like
having a secret toolbox with tools you
can't find anywhere else
Pros of CLI

3. Lightweight: CLIs use less computer


power, so they're great for older or slower
machines.
Pros of CLI

4. Automation: CLIs can do boring,


repetitive tasks for you automatically, like
organizing files or sending emails.
5. Precise Control: CLIs let you be very
specific about what you want your
Pros of CLI computer to do.
6. Remote Access: CLIs are perfect for
controlling your computer from far away,
Pros of CLI like helping a friend troubleshoot their
computer over the internet.
CONS of CLI
1. Learning Curve: CLIs
can be tricky to learn at
first because you have to
memorize special words
(commands). It's like
learning a secret code
CONS of CLI
2. Plain Text: CLIs aren't
fancy. They don't have
colorful pictures or
buttons like regular apps.
CONS of CLI
3. Mistakes Matter: If
you make a typo, the
computer won't
understand you, and you
might accidentally mess
something up.
CONS of CLI

4. Not for Everything: CLIs are awesome for


some tasks, but not so great for others. They're
not the best for drawing pictures or editing
videos.
Introduction to Operating
System
SLO 9.1.4
Learning Objectives
After the lecture student will be able to:
1. Define Single-User Operating system and Multi-user Operating
system
2. Differentiate between single user operating system and multiuser
operating system;
Single User Operating System
A Single-User Operating System (OS) is a type of
operating system designed to be used by one person at a
time on a single computer or device. It manages the
computer's resources (like memory, processor, and
storage) exclusively for that user, providing a
personalized computing experience.
Key Characteristics
• One User at a Time: Only a single user can access
and operate the system at any given moment. This
means that while the system might support multiple
user accounts, only one account can be actively used at
once.
Key Characteristics
• Dedicated Resources: All system resources are
allocated solely to the active user, ensuring optimal
performance for their tasks. This includes processing
power, memory, and access to peripherals
Key Characteristics
• Performance: Often faster and more responsive than
multi-user systems, as resources are not being shared
among multiple users.
Key Characteristics
• Cost-Effective: Typically, less expensive due to their
simpler design and lower hardware requirements
Disadvantages
• Limited Collaboration: Not suitable for environments
where multiple users need to work simultaneously on
the same system.
• Lower Resource Utilization: Resources may not be
used efficiently when the single user is not actively
using the system.
Examples
• Personal Computers
• Smartphones and Tablets
• Laptops
Multiuser Operating System
A Multi-User Operating System (OS) is a type of
operating system designed to allow multiple users to
access and use a computer system simultaneously. It
manages and allocates system resources (like CPU time,
memory, and storage) among different users, ensuring
that each user can work independently while sharing the
same hardware and software resources.
Key Characteristics
• Multiple Concurrent Users: Allows two or more users
to interact with the system simultaneously, each from
their own terminal or workstation.
Key Characteristics
• Resource Management: Includes mechanisms to
allocate and manage system resources (CPU time,
memory, disk space) among different users fairly and
efficiently.
Key Characteristics
• Increased Productivity: Multiple users can work
simultaneously, improving overall efficiency and
productivity.
Key Characteristics
• Efficient Resource Utilization: Resources are shared
among users, preventing underutilization and
maximizing the value of expensive hardware
Key Characteristics
• Collaboration: Enables users to share files, data, and
resources, facilitating collaboration and teamwork.
Disadvantages
• Complexity: Multi-user OSes are more complex than
single-user systems due to the need for resource
management, user isolation, and security mechanisms
Disadvantages
• Overhead: Managing multiple users and resources
introduces some overhead, which may slightly impact
system performance.
Disadvantages
• Security Risks: With multiple users accessing the
system, the risk of unauthorized access and data
breaches increases, requiring robust security measure.
Examples
Windows Server
Mainframe Operating Systems
Linux Based Workstation and Servers
SLO 9.1.5
Objectives
After the lecture students will be able to:
• Compare different types of operating system.
Types of Operating System
Multiprogramm Multitasking Distributed
Simple Batch
ing Batch Operating Operating
System
System System System

Parallel
Real-time Multiprocessor Embedded
Processing
Operating Operating Operating
Operating
System System System
System

Time-sharing
Operating
System;
1. Simple Batch System
Batch processing is a type of operating system that processes similar types of
jobs into a batch. In the batch processing operating system, multiple jobs of
similar types are converted into a batch and sent to the CPU for execution.

Simple batch systems were among the earliest operating systems used in
computers, particularly in the 1950s and 1960s. These systems were designed
to execute jobs in a sequential, non-interactive manner.

Some early systems that were based on simple batch processing include:
• IBM 701 (1952)
• IBM 1401 (1959)
• UNIVAC I (1951)
Key Features
• No Direct User Interaction: Users don't interact with the computer directly. Instead,
they submit their jobs (programs or tasks) to an operator, often using punched cards or
tapes.
• Batch Processing: The operator collects similar jobs into batches and submits them to
the computer. The jobs within a batch are executed sequentially without any user
intervention.
• Monitor Program: A special program called the monitor manages the execution of
jobs. It loads each job into memory, runs it, and then moves on to the next job in the
batch.
• No Multiprogramming: Only one job is in memory and executed at a time. This
means the CPU might sit idle while waiting for slow input/output operations to
complete.
2. Multiprogramming Batch System
A multiprogramming batch system is an extension of simple batch systems that
improves CPU utilization by executing multiple jobs simultaneously. It was introduced to
overcome the inefficiencies of simple batch systems, where the CPU would often remain
idle while waiting for I/O operations to complete.

Example:
Multiprogramming batch systems were common in large mainframes in the 1960s and
1970s, such as IBM's OS/360 and DEC's TOPS-10. These systems ran multiple jobs
concurrently, significantly improving performance over simple batch systems.
Key Features

• Job Pool: A collection of jobs waiting to be executed is stored in a job pool.


• Memory Allocation: The operating system loads several jobs from the job pool into
memory.
• Job Scheduling: A scheduler determines which job gets access to the CPU at any
given moment. This is usually based on factors like priority, resource requirements, or
estimated execution time.
• Context Switching: The operating system rapidly switches between jobs, giving each
a slice of CPU time. This switching, known as context switching, happens so quickly
that it appears as if the jobs are running simultaneously.
3. Multitasking Operating System
A multitasking operating system is a type of operating system that allows
multiple tasks (also known as processes) to run concurrently on a single
processor. This is achieved by rapidly switching the CPU between different
tasks, giving each task a slice of CPU time. The switching happens so fast that
it appears as if the tasks are running simultaneously, even though only one
task is running at any given moment.

Systems that use a multitasking operating system:


• Modern versions of Windows
• Linux
• Unix
• macOS
Key Concepts

• Process Management: Each running program is a process, with its own memory space and
resources. The operating system keeps track of all active processes.
• Time Sharing: The CPU (the brain of your computer) is rapidly shared among the processes. Each
process gets a small slice of time to execute, then the CPU switches to another process. This
switching happens so quickly that it creates the illusion of simultaneous execution.
• Scheduling: The operating system uses a scheduler to determine which process gets to use the
CPU and for how long. This can be based on priority, resource needs, or other factors.
• Context Switching: When switching between processes, the operating system saves the current
state of one process (its register values, program counter, etc.) and restores the state of the next
process. This allows the processes to resume execution seamlessly
4. Distributed Operating
System

A distributed operating system (DOS) is a software system that manages


a collection of independent computers, making them appear as a single
coherent system to the user. These computers, known as nodes, are
connected through a network and communicate with each other to
coordinate tasks and share resources.
Example:
In a real-world example, such as Google’s data centers:
 Users access Google services (e.g., search, Gmail, YouTube) from various
locations.
 Nodes are the machines across Google’s distributed infrastructure that
perform computations, store data, and process user requests.
 The DOS at Google manages these thousands of machines, distributing
workloads and resources effectively to provide a seamless experience for the
user
Key Characteristics
• Transparency: The distributed nature of the system is hidden
from the user, who interacts with it as if it were a single
computer.
• Resource Sharing: Nodes can share their resources, such as
processing power, storage, and peripherals, with other nodes in
the system.
• Scalability: The system can easily be expanded by adding
more nodes to the network.
• Fault Tolerance: The system can continue to operate even if
some nodes fail, as tasks can be redistributed to other nodes.
• Concurrency: Multiple tasks can be executed simultaneously
on different nodes, improving overall performance.
Class Activity
Explain the advantages and disadvantages of:

A. Simple batch system


B. Multiprogramming batch system
C. Multitasking operating system
D. Distributed operating system
5. Real-Time Operating System
A real-time operating system (OS) can react fast enough to events in the outside
world to control an output. The length of time between the input and the output is
called latency.

For example, the engine management system within a car uses a real-time
operating system to react to feedback from sensors placed throughout the engine.
The OS will then immediately inform the driver if action is to be taken (e.g., oil
needs topped up or brake pads need changed). Another example would be a point-
of-sale system in a shop that reacts quickly to sales, warning if stock of any item
sold is getting low and reordering it.

The main goal of an RTOS is to perform critical tasks on time. It ensures that certain
processes are finished within strict deadlines, making it perfect for situations where
timing is very important. It is also good at handling multiple tasks at once.
Real-Time Operating System
Uses:
• Defense systems like RADAR.
• Air traffic control system.
• Stock trading applications.
• Used to control nuclear centrifuges.
Real-Time Operating System
Characteristics:

1. Precise Timing: It ensures that critical tasks, such as adjusting the speed
of the centrifuge or monitoring its state, happen exactly when they are
supposed to, with minimal delay.
2. Safety: The RTOS prioritizes essential safety-related functions, ensuring
that if something goes wrong, the system responds immediately to prevent
accidents.
3. Reliability: In an environment like a nuclear facility, the system must be
highly reliable, predictable, and capable of handling multiple tasks
simultaneously without errors
Parallel Processing Operating System:
A Parallel Processing Operating System helps manage multiple processors
working together at the same time. Its main goal is to split big tasks into smaller
pieces, so each processor can work on a part of the task simultaneously. This
speeds up the overall process and makes the system more efficient.

Uses:

• Supercomputing: Used for tasks like scientific research and climate modeling
where large amounts of data are processed quickly.
• Graphics Processing: Helps in rendering images and videos by working on
many pixels at the same time.
• Machine Learning: Speeds up training of complex models by processing
large datasets in parallel.
Features of Parallel Processing:
1. Faster Execution: By splitting a task across multiple
processors, the system can complete tasks more quickly.
2. Efficiency: It allows for better use of resources, especially in
systems with many processors or cores.
3. Scalability: As more processors are added, the system can
handle larger and more complex tasks.
Embedded Operating System

An embedded operating system is a special type of operating


system made to run on devices that aren't typical computers, like
microwaves, washing machines, or smart TVs. It is designed to
control the device's specific functions and usually runs a single
task or a few tasks at a time. These operating systems are small,
fast, and use less power compared to regular computer operating
systems like Windows or macOS. They are built into the device and
help it work smoothly.
Features of Embedded Operating
System
• Small Size: It is lightweight and takes up less space because it is
designed for specific devices.
• Fast and Efficient: It runs quickly and uses very little power,
which is important for devices like washing machines or cameras.
• Real-Time Processing: It can handle tasks right away (in real-
time), which is crucial for things like medical devices or
automatic controls in cars.
• Single-Purpose: It is built to perform specific tasks for the
device, unlike regular operating systems that handle many things
at once.
Features of Embedded Operating
System
• Low Power Consumption: It uses very little energy to keep the
device running efficiently.
• Limited User Interface: Often, it doesn't have a complex
interface like a computer but instead simple controls or buttons
for users to interact with.
Time Sharing Operating System
A time-sharing operating system allows multiple users or programs to use a
computer at the same time by quickly switching between them. It divides the
computer's time into small slices and allocates these slices to different tasks.
This makes it seem like everything is running simultaneously, even though
the CPU is actually working on one task at a time, just switching very quickly
between them.

Examples:

1. Windows Server Family


2. Unix/Linux-Based Servers
3. IBM AIX
Features
1. Multi-user: Many users can access the system at once, sharing
its resources like memory and processing power.
2. Fast Switching: The system quickly moves from one task to
another, giving each task a small amount of processing time
(called a time slice).
3. Efficient Resource Use: Time-sharing ensures that no single
task or user monopolizes the system, making better use of
resources.
4. Interactive: Users can interact with their programs in real-time
because the system constantly switches between tasks to
respond to input quickly.
SLO 9.2.1
Objectives
After the lecture students will be able to:
1. Describe the main functions of operating system, i.e. (Understanding)
i. Process Management,
ii. Memory Management,
iii. File Management,
iv. I/ O System Management,
v. Secondary Storage Management,
vi. Protection System,
vii. Interrupt Handling,
viii. Network Management,
ix. Command-interpreter;
1. Process Management

In a multi-programming environment, the OS decides the order in which


processes have access to the processor, and how much processing time each
process has. This function of OS is called Process Scheduling.

An operating system manages the processor’s work by allocating various jobs


to it and ensuring that each process receives enough time from the processor
to function properly.

It keeps track of what each program is doing. The program that does this is
called a Scheduler. It gives the CPU to a program when needed and takes it
back when the program is finished.
Process Management Example
In this example there are three processes A, B and C will manage the CPU time as
follows. ready for execution. The OS will manage CPU time as follow:

Process A has CPU cycle (ta = 5 milli sec)


Process B has CPU cycle (tb = 2 milli sec)
Process C has CPU cycle (tc = 1 milli sec)

Case 1: When the 3 processes become ready in the order of ABC, the total execution
time will be:
τ = (5+7+8)/3 = 6.67 milli sec
Case 2: When the 3 processes become ready in the order of BCA, the total execution
time will be:
τ = (2+3+8)/3 = 4.33 milli sec
In the above example, in Case2, the OS is managing the processes more efficiently.
The execution time in Case 2 is less as compared to Case 1.
2. Memory Management

The operating system controls the computer's main memory, which is the
quick-access storage used by the CPU. When a program needs to run, it has
to be loaded into this main memory first. The operating system handles the
job of giving memory to different programs and taking it back when they're
done, making sure that one program doesn’t use the memory reserved for
another.
Memory Management Cont.

One method of memory management is known as paging. Memory is broken


up into fixed-size blocks, known as pages.
Different operating systems allocate their own size to pages. For example,
memory pages in modern operating systems are typically 4 kilobytes (KB) in
size.
When a program is run, it is loaded into memory. The operating system
determines how much memory the program requires and allocates enough
pages to hold it and its documents. When the program is closed, the allocated
pages are freed up for use by other programs.
The pages a program occupies may or may not be contiguous, but this does
not matter. The operating system knows what each page occupies and
fetches the data held in them when needed
An Operating System performs the following activities for Memory
Management:

1. Allocates and deallocates the memory.


2. Keeps a record of which part of primary memory is used by whom and how
much.
3. Distributes the memory while multiprocessing.
4. In multiprogramming, the operating system selects which processes
acquire memory when and how much memory they get
4. I/ O System Management
I/O Device Management refers to the way an operating system
(OS) handles communication between the computer and its
input/output (I/O) devices. Efficient I/O management improves the
performance of a computer system.

Input and output devices, which are also known as peripherals, are
hardware devices connected to a computer, such as a screen,
printer, keyboard or camera.

To operate a peripheral, the operating system uses a program called


a device driver. Device drivers contain instructions on how to control
a device. Each connected device has its own driver.
I/ O System Management Example

Imagine you are typing a document and decide to print it. Here's how
I/O system management works in this scenario:
Input: Your keyboard inputs the text you type, which the OS processes
and displays on the screen.
Output: When you click "Print," the OS sends the document data to
the printer using a specific driver.
Buffering: If the printer is slow, the OS may use a buffer to store the
document until the printer is ready.
Error Handling: If the printer runs out of ink, the OS will alert you and
pause the printing process until you replace the ink cartridge.
Secondary Storage refers to non-volatile storage, meaning the data is
retained even when the computer is turned off. Examples include
hard drives, SSDs, CDs, USB drives, etc.

The OS is responsible for organizing and controlling how data is


stored and retrieved from secondary storage devices. This involves
several key tasks:
5.
Secondary  Storage Allocation: The OS decides where to store files on the
secondary storage. It needs to allocate space efficiently so that
Storage data can be stored and retrieved quickly.
 Free Space Management: The OS keeps track of the free space
Managemen available on the secondary storage. It needs to ensure that there is
enough space for new files and that space is utilized efficiently.
t
 Disk Scheduling: The OS decides the order in which
read/write requests are processed on the disk. Since
multiple requests can be made at once.
 Defragmentation: The OS may run a defragmentation
Secondary process to rearrange the files so that they are stored in
contiguous spaces, which improves access speed.
Storage
Manageme
nt
A protection system in an operating
system (OS) is a fundamental
component designed to safeguard the
computer’s resources and data from
unauthorized access, misuse, and
potential threats. It ensures that only
6. authorized users and processes can
Protection access or modify system resources,
System maintaining the system's integrity,
confidentiality, and availability.
A protection system in an operating
system performs the following tasks:

The protection system ensures that only


authorized programs and users can access
Taks certain resources, such as files, memory, and
CPU time.
Performed The OS uses access control mechanisms to
determine who can access what resources.
by The system verifies the identity of users

Protection through authentication methods like


passwords, biometrics, or security tokens.
System The protection system ensures that data is
not altered in unauthorized ways.
The OS employs various techniques, such as
encryption, firewalls, and secure
communication protocols, to prevent
unauthorized access from both within and
outside the system.
Interrupt Handling

An interrupt is like a signal sent to the CPU, indicating that


something needs urgent attention. This could be anything
from a hardware issue (like a key press on the keyboard) to
a software request.

Interrupts allow the CPU to deal with important tasks


immediately without waiting for the current process to
finish. This ensures that the system remains responsive to
user inputs and other critical events.
Role of OS in Interrupt Handling
The OS constantly monitors for interrupts from hardware devices or software.
When an interrupt occurs, the CPU is notified to pause its current task and
handle the interrupt.

The OS uses a specific set of instructions, called the Interrupt Service Routine
(ISR), to address the interrupt. The ISR is a special function designed to handle
particular types of interrupts.

When an interrupt occurs, the OS saves the current state of the CPU, including
the contents of registers and the program counter. This is called context saving.

After handling the interrupt, the OS restores the saved state so the CPU can
resume the interrupted task as if nothing happened.
Example

Imagine you’re typing on your keyboard. Each time you press a key,
the keyboard sends an interrupt to the CPU to process the input. The
OS interrupts whatever task the CPU was performing, processes the
key press using the ISR, and then returns to the original task.
Network Management

Network management is a critical function of an operating


system (OS) that ensures the efficient and reliable operation of
network connections. It involves various tasks aimed at
monitoring, configuring, and troubleshooting network
components to maintain optimal performance.
Network Management
Role of OS in Network Management:

1. The OS assigns IP addresses to network interfaces enabling devices to


communicate on the network. It also configure the DNS servers.
2. The OS tracks network traffic, including inbound and outbound data, to
identify potential issues.
3. The OS often includes a built-in firewall to control incoming and outgoing
network traffic, protecting the system from unauthorized access.
4. The OS supports various network protocols, including TCP/IP and OSI
enabling communication with different devices and networks.
Command-Interpreter

A command interpreter, often referred to as a shell, is a


fundamental component of an operating system (OS) that acts
as a user interface between the user and the computer. It
provides a way for users to interact with the OS by executing
commands and programs.
Command-Interpreter

1. Receives input from the user, usually in the form of text commands.
2. Analyzes the input to identify the command and its associated
arguments.
3. Locates the corresponding program or executable file on the system.
4. Loads the program into memory and start the execution of the program.
5. Detects and reports errors that may occur during command execution.
6. Maintains information about the current environment, such as the
working directory
9.3 Process Management

SLO 9.3.1
Learning Objective:
After the lecture students will be able to:
1. Determine the sequence of execution of processes to get
the minimum execution time; (Application)
Determine The Sequence Of Execution Of Processes To Get The
Minimum Execution Time
In this example there are three processes A, B and C will manage the CPU time as
follows. ready for execution. The OS will manage CPU time as follow:

Process A has CPU cycle (ta = 5 milli sec)


Process B has CPU cycle (tb = 2 milli sec)
Process C has CPU cycle (tc = 1 milli sec)

Case 1: When the 3 processes become ready in the order of ABC, the total
execution time will be:
τ = (5+7+8)/3 = 6.67 milli sec
Case 2: When the 3 processes become ready in the order of BCA, the total
execution time will be:
τ = (2+3+8)/3 = 4.33 milli sec
In the above example, in Case2, the OS is managing the processes more
efficiently. The execution time in Case 2 is less as compared to Case 1.
9.3 Process Management

SLO 9.3.2
Learning Objective:
After the lecture students will be able to:
1. Explain the process state diagram including new, running,
waiting/ blocked, ready and terminated states of a process;
(Understanding)
States of Process
A process is an instance of a program in execution, and as it runs,
it transitions through different states depending on the conditions
and actions it encounters. The process state diagram is a
fundamental concept in operating systems that illustrates the
various states a process can be in during its lifecycle
States of Process
1. New State: When a process is first created, it enters the New state. This
happens when the operating system recognizes the need to create a
process, such as when a user launches a program. The process remains in
this state while the operating system prepares it for execution. This
preparation might involve allocating memory.
2. Ready State: In the Ready state, the process is fully prepared and
waiting to be assigned to the CPU. It has all the necessary resources
except for the CPU. When the CPU becomes available, the scheduler
selects one of the ready processes to execute next.
3. Running State: The Running state is when the process is actively
executing instructions on the CPU. It's the only state during which the
process is doing actual work. A process will remain in the Running state
until one of the following events occurs:
1. The process completes its task and transitions to the Terminated state.
2. The process needs to perform an input/output (I/O) operation and thus moves to
the Waiting/Blocked state.
4. Waiting/Blocked State: A process enters the Waiting (or Blocked) state
when it cannot proceed until some external event occurs, such as the
completion of an I/O operation or the availability of a resource. While in
this state, the process is not using the CPU. Instead, it waits for the event
to complete.
5. Terminated State: The Terminated state is the final state of a process.
When a process finishes its execution, it enters this state. In this state, the
operating system deallocates the resources associated with the process,
such as memory and process control blocks.
9.3 Process Management
SLO 9.3.3
Learning Objective:
After the lecture students will be able to:
1. Differentiate between thread and process; (Understanding)
Differentiate Between Thread And Process
Process Thread
1. A process is an independent 1. A thread is a smaller, lightweight
program in execution. unit of execution within a process.
2. Each process has its own memory 2. Threads share the same memory
space, and operating system space and resources of the
resources (like file handles, process they belong to but can
network connections, etc.). execute independently within that
shared environment.
3. Any change in the process does
not change the behavior of other 3. Any change in the thread may
processes. change the behavior of other
threads in the same process.
4. Threads share the same memory
space and resources of the 4. Threads are best for tasks that
process they belong to but can can be divided into smaller,
execute independently within that parallel subtasks that need to
shared environment. share common data.
Example
Process: Running a word processor and a web browser
simultaneously involves two separate processes, each with its own
memory space and resources.

Thread: Within the web browser process, multiple threads might


be used:
One thread for rendering the webpage, another for downloading
content, and another for handling user inputs, all sharing the same
process memory space.
9.3 Process Management
SLO 9.3.4
Learning Objective:
After the lecture students will be able to:
1. Differentiate among multithreading, multitasking, multiprogramming and
multiprocessing. (Understanding)
Multi Threading
Multithreading refers to the ability of a single process to manage the
execution of multiple threads concurrently. Threads are smaller units within a
process that can run independently while sharing the same resources like
memory and file handles.

Multiple threads of the same process can run in parallel, especially on multi-
core CPUs.
Threads share the same memory space within a process, making them
lightweight.
Used in scenarios where tasks within the same program can be divided into
smaller, parallelizable components, like in web browsers, where different
tabs may be handled by different threads.
Multitasking
Multitasking is the ability of an operating system to execute multiple tasks (or
processes) at the same time. These tasks might be part of different programs
or the same program.

The CPU switches rapidly between tasks, giving the illusion that they are
running simultaneously.
The OS decides when the CPU should switch from one task to another to
give them proper time.
Common in modern operating systems (like Windows, macOS, Linux) where
users can run multiple applications at the same time (e.g., a web browser,
text editor, and music player).
Multiprocessing
Multiprocessing refers to the use of two or more CPUs (or cores) within a
single computer system to execute multiple processes simultaneously.

Multiprocessing refers to the use of two or more CPUs (or cores) within a
single computer system to execute multiple processes simultaneously.
Each CPU or the Core of CPU can execute multiple processes at the same
instant of time.
Common in high-performance computing, servers, and modern desktop
systems where workloads can be distributed across multiple processors for
faster performance.
Multiprogramming
Multiprogramming is an approach where multiple programs are loaded into
memory at the same time, and the CPU switches between them to maximize
resource utilization.

Multiprogramming is one of the earliest forms of task management,


predating modern multitasking.
Only one program is executed by the CPU at any given moment, but the
CPU switches between them to minimize idle time.
Used to keep the CPU busy by loading several programs into memory and
switching between them.

You might also like