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

Lecture 3 Os

The document discusses two types of operating systems: hardware-dependent, which is tailored for specific hardware, and hardware-independent, which can operate across various platforms. It also covers dual-mode operation, kernel data structures, and the services provided by operating systems, including user interface, program execution, and resource allocation. Additionally, it explains the differences between uni-programming and multiprogramming, as well as multitasking features and types.

Uploaded by

Ch Gulfam
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)
4 views

Lecture 3 Os

The document discusses two types of operating systems: hardware-dependent, which is tailored for specific hardware, and hardware-independent, which can operate across various platforms. It also covers dual-mode operation, kernel data structures, and the services provided by operating systems, including user interface, program execution, and resource allocation. Additionally, it explains the differences between uni-programming and multiprogramming, as well as multitasking features and types.

Uploaded by

Ch Gulfam
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/ 30

Operating Systems

Lecture 3
Hardware Dependent OS

• A hardware-dependent OS is specifically designed to run on a


particular type of hardware or architecture. It cannot function on a
different system without significant modifications.
• It is optimized to give the best performance on that particular
hardware.
Example:
• Embedded OS in devices like washing machines, ATMs, or routers.
Hardware Independent OS

• A hardware-independent OS is designed to work across multiple


hardware platforms with minimal modifications. It is not restricted to a
specific architecture.
Example:
• Linux – It can run on PCs, servers, mobile devices, and more.
• Dual-mode operation helps the OS to protect itself and other
system components
• There are two modes: User Mode and Kernel Mode.
A special bit called the mode bit is used to switch between
these modes. 1=User mode and 0=Kernal Mode

• User Mode
• The system is in user mode when it runs normal user applications
like a text editor, browser, or game.
• In this mode, the program cannot access hardware directly or
perform critical system tasks.
Operating- • If a user program needs OS help (e.g., saving a file), it makes a
system call or interrupt, and the mode switches to kernel
System mode.

Operations • The mode bit is set to 1 in the user mode. It is changed from 1 to
0 when switching from user mode to kernel mode.
• Kernel Mode
• The system starts in kernel mode during boot-up and when the OS is in
control.
• In this mode, the system can directly access hardware, memory, and
execute privileged instructions (like I/O operations, interrupts, etc.).
• The mode bit is set to 0 in the kernel mode. It is changed from 0
to 1 when switching from kernel mode to user mode.
• If a user program tries to run privileged instructions in user mode, it
causes a trap (error), protecting the system.
Operating-System Operations
(cont.)
• Mode bit
Transition from User to Kernel Mode
Kernel Data Structures

• Many similar to standard programming data structures


• Singly linked list

• Doubly linked list

• Circular linked list


Kernel Data Structures

• Binary search tree


left <= right
• Search performance is O(n)
• Balanced binary search tree is O(lg
n)
Kernel Data Structures

• Hash function can create a hash map

• Bitmap – string of n binary digits representing the status of n


items
• Linux data structures defined in include files
<linux/list.h>, <linux/kfifo.h>, <linux/rbtree.h>
Shell

• A shell is a command-line interface (CLI) that allows users to interact with an operating
system by executing commands. It serves as a bridge between the user and the OS kernel.

• Bourne Shell (sh)


• Bash (Bourne Again Shell)
• Korn Shell (ksh)
• C Shell (csh)
• Z Shell (zsh)
• Fish (Friendly Interactive Shell)
Operating System Services

Operating systems are like the managers of a computer. They help programs run and make
sure everything works smoothly for both users and the computer.

• One set of operating-system services provides functions that are helpful to the user:

1.User Interface (UI): This is how users interact with the computer. Some systems use a
command-line interface (CLI), where you type commands. Others use a graphical
user interface (GUI), with windows, icons, and buttons. Some systems even use batch
processing, where tasks are run automatically without user input.

2.Program Execution: The operating system helps start and manage programs. It loads
programs into the computer’s memory and makes sure they run. If something goes wrong,
it can stop the program and show an error.

3.I/O Operations: When a program needs to read or write data (like opening a file or
printing something), the operating system handles it. It makes sure the program can talk
to the necessary devices, like printers, hard drives, or screens.

UFCPIERDAP
Operating System Services (Cont.)
4. File-System Manipulation: This is about managing files and folders (directories) on the computer. The operating
system allows programs to:
• Read and write files (open, save, modify).
• Create and delete files and directories.
• Search for files or directories.
• List information about files, like size, creation date, etc.
• Manage permissions, deciding who can access or modify files.
5. Communications: Sometimes, different programs (called processes) need to talk to each other. This could happen
within the same computer or over a network (like the internet). Communication can be:
• Shared memory, where multiple programs can access the same area of memory to exchange information.
• Message passing, where information is sent in packets (small data chunks) from one program to another, sometimes
across different computers.
6. Error Detection: The operating system always monitors for potential errors. These errors could be:
• In hardware, like problems with the CPU or memory.
• In I/O devices, like printers or hard drives failing.
• In user programs, if something goes wrong during the program's execution. The OS has to detect these errors and
decide what to do about them to keep the system running smoothly.
7. Debugging Facilities: The OS often includes tools that help debug programs. These tools help developers find and fix
issues in their programs, making the whole process of using and programming the system more efficient.
Operating System Services (Cont.)

Resource Allocation: When multiple users or programs (jobs) are running at the same time, the
operating system must manage and distribute the system's resources (like CPU power, memory,
storage, and I/O devices) fairly. This ensures that each user or program gets the resources they need to
function properly without interfering with others.

Accounting: The operating system keeps track of how much and what type of resources each user or
program is using. This helps with resource management and can also be useful for billing, auditing, or
ensuring fair usage.

Protection and Security:


• Protection: In a multi-user system, one user’s activities should not affect another user’s work. The
operating system ensures that each process or user is isolated from others, preventing them from
interfering with each other’s resources or data.
• Security: The operating system ensures that only authorized users can access certain information or
resources. It requires user authentication (like passwords or biometrics) to make sure only the right
people can access the system. It also defends against unauthorized access from outsiders and
protects external devices from malicious attempts to access them.
A View of Operating System Services
Computer-System Architecture
• Single General-Purpose Processor: Most systems have a single general-purpose processor (CPU) that handles most tasks.
It can run a variety of applications, from word processors to web browsers.
• Special-Purpose Processors: In addition to the general-purpose processor, many systems also include special-purpose
processors. These are designed to handle specific tasks more efficiently, like graphics (GPU), networking, or sound processing.

• Multiprocessor Systems: More and more systems are using multiprocessors, which involve multiple processors working
together. These are also known as Parallel Systems or tightly-coupled systems. The key benefits of having multiple
processors are:
• Increased throughput: More processors mean more work can be done at the same time, leading to faster overall performance.
• Economy of scale: It's often cheaper to use multiple processors than to use a single, extremely powerful one.
• Increased reliability: If one processor fails, the system can still work using the remaining ones. This is called graceful degradation or fault
tolerance.

Two Types of Multiprocessing:


• Asymmetric Multiprocessing (AMP): In this system, each processor has a specific task assigned to it. One processor usually
acts as the "master," managing the overall system and assigning tasks to other processors.
• Symmetric Multiprocessing (SMP): In this system, all processors are equal, and they all share the work. Each processor can
perform any task and communicate with the others to divide the workload.
Single Processor

• One processor for processing


• Throughput of single processor systems is less
• Single processor systems cost is more
• Easy to design
• Single processor system is less reliable
Multi Processor

• contains two or more processors for processing


• Throughput of Multiprocessor systems is greater
• Multiprocessor systems cost less
• difficult to design
• Multiprocessor system is more reliable
A Dual-Core Design

• Multi-chip and multicore


• Systems containing all chips
• Chassis containing multiple separate systems
Types of Multiprocessors
Two types:
1. Asymmetric Multiprocessing – each processor is
assigned a specie task.
2. Symmetric Multiprocessing – each processor performs
all tasks
BASIS FOR SYMMETRIC ASYMMETRIC
COMPARISO MULTIPROCESSI MULTIPROCESSI
N NG NG
Basic Each processor run the Only Master processor run

Types of
tasks in Operating the tasks of Operating
System. System.
Process Processor takes processes Master processor assign

Multiprocesso from a common ready


queue, or there may be a
private ready queue for
processes to the slave
processors, or they have
some predefined

rs Architecture
each processor.
All processor in
Symmetric
processes.
All processor in
Asymmetric
Multiprocessing has the Multiprocessing may have
same architecture. same or different
architecture.
Communication All processors Processors need not
communicate with communicate as they are
BPACF another processor by a controlled by the master
shared memory. processor.
Failure If a processor fails, the If a master processor fails,
computing capacity of the a slave is turned to the
system reduces. master processor to
continue the execution. If
a slave processor fails, its
task is switched to other
processors.
Symmetric Multiprocessing Architecture
Multiprocess Architecture – Chrome Browser

• Many web browsers ran as single process (some still do)


• If one web site causes trouble, entire browser can hang or crash

• Google Chrome Browser is multiprocess with 3 different types of processes:


• Browser process manages user interface, disk and network I/O
• Renderer process renders web pages, deals with HTML, Javascript. A new renderer
created for each website opened
• Runs in sandbox restricting disk and network I/O, minimizing effect of security exploits
• Plug-in process for each type of plug-in
Uni-Programming
In a uni-programming system, jobs are processed one at a time and 1–by-1.
Here's a short summary:
1.Users submit jobs to the operator.
2.The operator groups similar jobs into batches.
3.The first job in the batch is submitted for processing.
4.The job uses the CPU and I/O resources until it's completed.
5.While Job1 is running, no other job can use the CPU.
6.Once Job1 finishes, Job2 is loaded into memory and processed.
• In short, it's a sequential processing system where only one job runs at a time.
Multiprogramming
• Multiprogramming: This is when the system has multiple processes ready to run at the same time.
The operating system switches between them to keep the CPU busy, ensuring better resource utilization.

Types of Multiprogramming:
• Pre-emption (Time Sharing or Multitasking): In this type, the operating system forcefully removes a
process from the CPU after a set amount of time, allowing other processes to use the CPU. This is
common in systems where multiple users or tasks need to be handled simultaneously.
• Non-pre-emption: In this type, once a process starts using the CPU, it cannot be removed until it
finishes. This is used in systems where processes need to run to completion without interruption.

Degree of Multiprogramming: This refers to the maximum number of processes that can be in the ready
state (waiting to be processed) at once. For example, if the degree of multiprogramming is 100, it means
that the system can have up to 100 processes waiting to be executed at the same time.
Unitasking

• perform a single task at a time


• Slow
• bad user experience
Multitasking

• It means running multiple applications at the same time without


slowing down the system.
• Each process is assigned specific length of time
• Memory management is well-defined
Features of Multi-Tasking

• Time Sharing: CPU time is divided among processes.


• Context Switch: Switching from one process to another.
• Multi-Threading: A single program can have multiple tasks (threads) running.
• Hardware Interrupts: Hardware can interrupt running tasks to handle
urgent events.
Types of Multi-Tasking Operating System

• Pre-emptive Multitasking:
• OS forces switching from one process to another.
• Ensures fair sharing of CPU time.

• Non Pre-emptive Multitasking:


• also known as cooperative multitasking
• The running process decides when to give control to another.
• Less control by the OS.
Multitasking in Mobile Systems

You might also like