BASICS ON OPERATING SYSTEM AND ITS FUNCTIONS, Lecture notes of Operating Systems

INTRODUCTION TO OPERATING SYSTEMS FOR BEGINNERS. CONTAINS UNDERSTANDABLE ENGLISH, AND PICTORIAL REPRESENTATIONS (IMAGES)FOR NETTER UNDERSTANDING.

Typology: Lecture notes

2025/2026

Available from 06/26/2026

shay-75
shay-75 🇮🇳

6 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UNIT - I
Operating System
An Operating System (OS) is an interface between user and computer
system. It is system software that manages a computer's hardware and software
resources and provides common services for computer programs.
Functions of an Operating System:
1. Process Management – Handles creation, scheduling, and termination of
processes.
2. Memory Management – Allocates and manages the computer’s RAM among
various programs.
3. File System Management – Manages data storage, retrieval, and
organization of files on storage devices.
4. Device Management – Controls and coordinates the use of hardware devices
like printers, disks, and keyboards.
5. User Interface – Provides a way for users to interact with the computer, either
via a command-line interface (CLI) or graphical user interface (GUI).
6. Security and Access Control – Ensures authorized access to data and
system resources.
Here are some common examples of operating systems:
For Personal Computers:
Windows – Developed by Microsoft (e.g., Windows 10, Windows 11)
macOS – Developed by Apple for Mac computers (e.g., macOS Sonoma)
Linux – Open-source OS with many distributions (e.g., Ubuntu, Fedora,
Debian)
For Mobile Devices:
Android – Developed by Google, used in most smartphones and tablets
iOS – Developed by Apple for iPhones and iPads
___________________________________________________________________
Computer-System Organization
Computer-System Organization refers to the structural design and interaction of the
various components that make up a computer system. It describes how hardware
components like the CPU, memory, input/output (I/O) devices, and storage work
together under the control of the operating system.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download BASICS ON OPERATING SYSTEM AND ITS FUNCTIONS and more Lecture notes Operating Systems in PDF only on Docsity!

UNIT - I

Operating System

An Operating System (OS) is an interface between user and computer system. It is system software that manages a computer's hardware and software resources and provides common services for computer programs. Functions of an Operating System:

  1. Process Management – Handles creation, scheduling, and termination of processes.
  2. Memory Management – Allocates and manages the computer’s RAM among various programs.
  3. File System Management – Manages data storage, retrieval, and organization of files on storage devices.
  4. Device Management – Controls and coordinates the use of hardware devices like printers, disks, and keyboards.
  5. User Interface – Provides a way for users to interact with the computer, either via a command-line interface (CLI) or graphical user interface (GUI).
  6. Security and Access Control – Ensures authorized access to data and system resources. Here are some common examples of operating systems: For Personal Computers:Windows – Developed by Microsoft (e.g., Windows 10, Windows 11)  macOS – Developed by Apple for Mac computers (e.g., macOS Sonoma)  Linux – Open-source OS with many distributions (e.g., Ubuntu, Fedora, Debian) For Mobile Devices:Android – Developed by Google, used in most smartphones and tablets  iOS – Developed by Apple for iPhones and iPads ___________________________________________________________________

Computer-System Organization

Computer-System Organization refers to the structural design and interaction of the various components that make up a computer system. It describes how hardware components like the CPU, memory, input/output (I/O) devices, and storage work together under the control of the operating system.

Key Components of Computer-System Organization:

  1. Central Processing Unit (CPU) o Executes instructions and performs calculations. o Contains the Arithmetic Logic Unit (ALU) and Control Unit (CU). o Often includes registers and cache memory for fast access.
  2. Main Memory (RAM) o Temporarily stores data and instructions that the CPU needs while running programs. o Volatile, meaning contents are lost when power is off.
  3. Secondary Storage o Permanent storage for data and programs (e.g., hard drives, SSDs). o Slower but larger than main memory.
  4. Input/Output (I/O) Devices o Allow interaction with the system (e.g., keyboard, mouse, printer, monitor). o Managed by I/O controllers and device drivers.
  5. System Bus o Connects all major components and allows data transfer. o Includes:  Data bus (carries data)  Address bus (specifies memory locations)  Control bus (manages control signals)
  6. System Clock o Synchronizes operations within the CPU and other components.
  7. Interrupts and System Calls o Mechanisms for hardware/software to interact with the OS and CPU efficiently.

Arithmetic Logic Unit (ALU) : Performs arithmetic and logic operations.  Control Unit (CU) : Directs operations within the computer.  Registers : Small, fast memory used to store intermediate data and instructions.

  1. Memory Unit o Primary Memory (RAM) : Temporarily holds data and instructions during processing. o Secondary Memory : Stores data and programs permanently (e.g., HDD, SSD). o Cache Memory : High-speed memory that provides faster data access to the CPU.
  2. Input Devices o Devices like keyboard, mouse, scanner that allow users to enter data into the computer.
  3. Output Devices o Devices like monitor, printer, and speakers that deliver results to the user.
  4. System Bus o A set of electrical pathways used to connect the CPU, memory, and I/O devices. o Divided into:  Data BusAddress BusControl Bus

___________________________________________________________________

__

Operating System Services

Operating system (OS) provides a set of essential services that enable both users and programs to interact with the hardware and other software components efficiently and safely. These services fall into various categories based on the functionality they provide.

1. User Interface Services These services provide ways for users to interact with the system:  Command-Line Interface (CLI): Allows users to type commands (e.g., Unix shell).  Graphical User Interface (GUI): Offers visual interaction with icons, windows, and menus (e.g., Windows, macOS). 2. Program Execution The OS provides services to load programs into memory and execute them. It manages:  Memory allocation  Process scheduling  Program termination 3. I/O Operations For programs that need to perform input and output, the OS provides:  Interfaces to hardware devices (keyboard, mouse, printers)  Abstracts hardware differences for ease of programming

System calls are classified into the following categories:  File System : Used to create, open, read, write, and manage files and directories.  Process Control : Used to create, execute, synchronize, and terminate processes.  Memory Management : Used to allocate, deallocate, and manage memory for processes.  Interprocess Communication (IPC) : Used for data exchange and communication between different processes.  Device Management : Used to request and release devices, and to perform read/write operations on them.

__

Process Concept

A process in is a program in execution, an active instance of a software program that the operating system manages, distinguishing it from a program file. It includes the program code, its current activity (program counter, registers), data, and resources like memory, with its state tracked in a Process Control Block (PCB) , allowing multitasking through scheduling and context switching

Process states

Process states describe a process's current activity, typically moving through New, Ready, Running, Waiting/Blocked, and Terminated, plus suspended states as it's created, executes, waits for resources (like I/O), or finishes, managed by the OS for efficient multitasking. Here are the states:  New (or Created): The process is being created, but not yet ready for execution.  Ready: The process is loaded into main memory, prepared to run, and waiting for the CPU to be assigned.  Running: The CPU is currently executing the process's instructions.  Waiting (or Blocked): The process is paused, waiting for an event, like an I/O operation to complete or a signal to arrive.  Terminated (or Completed): The process has finished execution and is being removed from the system.

__

Operations on Processes

The operating system provides several operations to manage processes during their lifecycle.

1. Process Creation  A process can create a new process using a system call (e.g., fork() in Unix).  The parent process creates child processes , forming a process tree.

What is a Thread?

In an Operating System (OS), a thread is the smallest unit of execution within a process, allowing a single program to perform multiple tasks concurrently (like running different browser tabs or handling text input and background saving in a word processor). Threads are called "lightweight processes" because they share the process's resources (memory, files) but have their own program counter, registers, and stack, making them faster to create and switch between than separate processes.

What is Multicore Programming?

In an OS, Multicore Programming involves designing software to run on processors with multiple execution "cores" (mini-processors on one chip) to achieve true parallelism, executing different tasks or parts of a single task simultaneously for significant performance gains, improved efficiency, and scalability, overcoming single- core speed limits. It requires the OS to schedule threads across cores and programmers to write multithreaded code that can be broken down into independent, concurrent operations, managing shared memory. How it Works in an OSHardware : A single CPU chip contains two or more independent processing units (cores) that can fetch and execute instructions simultaneously.  OS Role : The operating system's scheduler assigns different threads (lightweight processes) to different cores, keeping them busy and maximizing CPU utilization, which is crucial for performance.

Concurrency & Parallelism: It enables true parallelism , where multiple instructions run at the exact same instant, unlike single-core multitasking (concurrency) which rapidly switches between tasks. _____________________________________________________________

Multithreading Models

Multithreading models in an Operating System (OS) define the relationship between user-level threads (managed by the application) and kernel-level threads (managed by the OS) and include three main types: Many-to-One (many user threads to one kernel thread), One-to-One (each user thread maps to a unique kernel thread), and Many-to-Many (multiplexes many user threads to a smaller or equal number of kernel threads). These models dictate concurrency, performance, and resource utilization, with Many-to-Many generally offering the best balance by allowing parallelism.

1. Many-to-One ModelDescription: Multiple user threads are mapped to a single kernel thread.  Pros: Thread management is efficient as it's done in user space.  Cons: A blocking system call by one thread blocks all others; cannot utilize multiple CPU cores for true parallelism. 2. One-to-One ModelDescription: Each user thread is directly mapped to a separate kernel thread.  Pros: Allows true parallelism on multi-core processors; if one thread blocks, others can still run.  Cons: High overhead due to creating many kernel threads; can limit the number of threads.  Examples: Windows XP, Linux (threads are tasks). 3. Many-to-Many ModelDescription: Multiplexes many user threads to a smaller or equal number of kernel threads.  Pros: Combines benefits, avoiding the limitations of the other two; good concurrency and efficient blocking.  Cons: More complex to implement.  Examples: Solaris, modern Linux (threads are tasks).

Thread Pools: Managing a fixed number of threads to avoid resource exhaustion from creating too many threads for concurrent requests, as seen in web servers.

What is CPU Scheduling?

CPU Scheduling is the mechanism the operating system uses to decide which of the many ready processes gets to use the CPU next, maximizing CPU utilization, throughput, and fairness while minimizing waiting and response times, essential for multitasking by efficiently allocating the single (or limited) CPU among competing processes. It involves algorithms (like FCFS, SJF, Round Robin) and managing queues (ready, waiting) to switch between processes when one waits for I/O or completes, creating the illusion of simultaneous execution. Key Concepts:Purpose: To keep the CPU busy, efficiently manage resources, and provide good user experience in multitasking systems.  Scheduler: The short-term scheduler (CPU Scheduler) makes the decision of which process to run next from the ready queue.  Queues: Processes move between Ready Queue (processes waiting for CPU), Running State, and Waiting Queue. (for I/O).  Context Switching: The process of saving the state of one process and loading the state of another, facilitated by the scheduler. Types of Scheduling:Non-Preemptive: A process runs until it finishes or blocks (e.g., for I/O).  Preemptive: The OS can interrupt a running process to allocate the CPU to a higher-priority process or for time-slicing (e.g., Round Robin). Common Algorithms:First-Come, First-Served (FCFS): Processes run in the order they arrive.  Shortest Job First (SJF): Runs the process with the smallest execution time next.  Round Robin (RR): Gives each process a small time slice (quantum) in turns.  Priority Scheduling: Assigns priorities, running higher-priority processes first.

Goals (Criteria):  Maximize CPU Utilization & Throughput (jobs completed per unit time).  Minimize Turnaround Time (total time in system), Waiting Time, and Response Time (time to first response).

CPU Scheduling Criteria

CPU scheduling criteria in an OS are metrics used to decide process execution order, focusing on maximizing CPU utilization, throughput (processes/time), and minimizing turnaround time (submission to completion), waiting time (in ready queue), and response time (request to first output) for efficient, fair, and responsive system performance. Key CPU Scheduling Criteria:

  1. CPU Utilization: Aims to keep the CPU as busy as possible (ideally 40-90% in real systems) by minimizing idle time.
  2. Throughput: Measures the number of processes completed per unit of time, indicating overall work done.
  3. Turnaround Time: Total time from process submission to completion (Arrival Time to Completion Time).
  4. Waiting Time: Time a process spends in the ready queue, waiting for CPU access (Turnaround Time - Burst Time).
  5. Response Time: Time from request submission to the first response/output, crucial for interactive systems.

o It is simple and easy to understand.

o It can be easily implemented using queue data structure.

o It does not lead to

starvation.

Disadvantages-

o It does not consider the priority or burst time of the processes.

o It suffers from convoy effect i.e. processes with higher burst time

arrived before the processes with smaller burst time.

2.Shortest Job First (SJF):

o Process which have the shortest burst time are scheduled first.

o If two processes have the same bust time, then FCFS is used to

break the tie.

o This is a pre-emptive scheduling algorithm. o Best approach to minimize waiting time. o Easy to implement in Batch systems where required CPU time is known in advance. o The processer should know in advance how much time process will take.

o Pre-emptive mode of Shortest Job First is called as Shortest

Remaining Time First (SRTF).

Advantages-

o SRTF is optimal and guarantees the minimum average waiting

time.

o It provides a standard for other algorithms since no other

algorithm performs better than it.

Disadvantages-

o It leads to starvation for processes with larger burst time.

o Priorities can not be set for the processes.

o Processes with larger burst time have poor response time.

Consider the set of 5 processes whose arrival time and burst time

are given below-

Process Id Arrival time Burst time P1 3 1 P2 1 4 P3 4 2 P4 0 6 P5 2 3

If the CPU scheduling policy is SJF pre-emptive, calculate the

average waiting time and average turnaround time.

Solution-

Gantt Chart-

Process Id Exit time Turn Around time Waiting time P1 4 4 – 3 = 1 1 – 1 = 0

2. Preemptive Scheduling

These algorithms allow the OS to pause a running process to allocate the CPU to a higher-priority task or for time-sharing.  Round Robin (RR): Each process is allocated a fixed time slice called a quantum. Once the time is up, the process is moved to the back of the queue.

o CPU is assigned to the process on the basis of FCFS for a fixed

amount of time.

o This fixed amount of time is called as time quantum or time slice.

o After the time quantum expires, the running process is preempted

and sent to the ready queue.

o Then, the processor is assigned to the next arrived process.

o It is always preemptive in nature.

Advantages-

o It gives the best performance in terms of average response time.

o It is best suited for time sharing system, client server

architecture and interactive system.

Disadvantages-

o It leads to starvation for processes with larger burst time as they

have to repeat the cycle many times.

o Its performance heavily depends on time quantum.

o Priorities can not be set for the processes.

Consider the set of 5 processes whose arrival time and burst time are given

below-

Process Id Arrival time Burst time

P1 0 5

P2 1 3

P3 2 1

P4 3 2

P5 4 3