Operating System Notes

C
DSA
Software Engineering
Software Architecture
Operating System
Big Data
Data Mining and Warehousing
TOC
Ada
CPP
DBMS

All Topics (15)

  • 1. Definition of Operating System
  • 2. Primary Objectives of an Operating System
  • 3. Functions of an Operating System
  • 4. Services of an Operating System
  • 5. Types of Operating System
  • 6. Serial Processing System / Bare Machine
  • 7. Simple Batch System
  • 8. Multiprogramming Operating System
  • 9. Time Sharing System / Multitasking System
  • 10. Multiprocessor System
  • 11. Network Operating System (NOS)
  • 12. Real-Time Operating System (RTOS)
  • 13. System Calls
  • 14. Utility Programs
  • 15. File Management

6. Serial Processing System / Bare Machine

Serial Processing System is the earliest type of computer system used in the 1950s.
In this system, all instructions are executed in sequential order (one by one), therefore it is called Serial Processing.

It is also known as a Bare Machine because there was no operating system available in the computer.

Definition

A system in which jobs are executed one after another in FIFO order (First In First Out) without using an operating system is called a Serial Processing System.

Working of Serial Processing System

  1. Programmer writes the program.
  2. Program is converted into punch cards.
  3. Punch cards are inserted into the computer.
  4. Computer executes instructions one by one.
  5. After completion of one job, the next job starts manually.

FIFO Concept

FIFOFIFOFIFO

FIFO means First In First Out.

  • The job which enters first will execute first.
  • The next job waits until the first job finishes.

Example of Serial Processing System

Suppose there are 3 jobs:

Job Time Required
Job A 1 Hour
Job B 30 Minutes
Job C 45 Minutes

Execution Process

  • First Job A executes completely.
  • Then Job B starts.
  • Finally Job C executes.

The system cannot execute multiple jobs together.

Real Life Example

Imagine a railway ticket counter with only one clerk.

  • First person in line gets service first.
  • Others must wait until the first person finishes.

Similarly, in serial processing:

  • One job executes at a time.
  • Other jobs remain waiting.

Features

  • No operating system.
  • One user at a time.
  • Sequential execution.
  • Uses punch cards.
  • Programmer directly interacts with hardware.
  • Manual job setup required.

Program Execution Steps

A program execution generally involves 3 steps:

1. Loading Compiler and Source Program into Memory

The compiler and source code are loaded into memory.

2. Saving the Compiled Program (Object Code)

The source program is translated into machine language and saved.

3. Loading and Linking Object Program

The object program is loaded and linked for execution.

If an error occurs, the user must repeat the whole setup process again.

Drawbacks / Disadvantages

1. Low Productivity

Resources are dedicated to a single program until completion.

2. Expensive Machines

Computers were very costly.

3. Large Setup Time

A lot of time was spent in preparing and loading jobs.

4. CPU Idle Time

CPU remains idle during input/output operations.

5. No Scheduling

No automatic job scheduling was available.

6. Manual Reservation

Users had to reserve machine time using sign-up sheets.

7. Error Handling Problem

If an error occurred, the entire setup sequence had to restart.

8. Wastage of Time

After job completion, extra machine time was often wasted.

7. Simple Batch System

Simple Batch System was developed to improve the utilization of computer resources.
Early computers were very expensive, so it was important to maximize CPU utilization.

In this system, similar jobs are collected together and executed as a group called a Batch.

Definition

A system in which multiple jobs having similar requirements are grouped together and executed automatically one after another is called a Batch Processing System.

Working of Batch System

  1. User writes the program on punch cards or magnetic tapes.
  2. User submits the job to the computer operator.
  3. Operator groups similar jobs into batches.
  4. The batch is loaded into the computer.
  5. A special program called Monitor controls job execution.
  6. Jobs are executed sequentially in FCFS order.

Diagram of Batch System

User → Operator → Batch → Monitor → CPU → Output

Role of Monitor

The Monitor is a program that controls the execution of jobs.

Functions of Monitor:

  • Selects jobs from the batch.
  • Loads jobs into memory.
  • Executes jobs one by one.
  • Starts the next job automatically after completion.

FCFS Scheduling

FCFSFCFSFCFS

FCFS means First Come First Serve.

  • The job that arrives first executes first.
  • Other jobs wait in queue.

Example of Batch Processing System

Suppose a company has 3 programming jobs:

Job Language
Job 1 C++
Job 2 C
Job 3 Pascal

Process

  • Operator groups similar jobs into batches.
  • Batch is submitted to the system.
  • Monitor executes jobs one after another automatically.

Example:

  • Batch 1 → C++ Jobs
  • Batch 2 → C Jobs
  • Batch 3 → Pascal Jobs

Real Life Example

Consider a laundry shop:

  • Clothes of similar type are collected together.
  • Washing is done in batches instead of washing one cloth at a time.

Similarly, in Batch Processing:

  • Similar jobs are grouped together.
  • System processes them automatically.

Features of Batch System

  • Jobs are grouped into batches.
  • No direct interaction between user and computer.
  • Uses monitor program.
  • Automatic job execution.
  • Jobs processed in FCFS order.
  • Uses punch cards and tapes.

Advantages of Batch Processing System

1. Better CPU Utilization

CPU works continuously with less idle time.

2. Reduced Operator Work

Most work is handled automatically by the computer.

3. Increased Performance

Next job starts automatically after previous job finishes.

4. Faster Processing

Batch execution saves setup time.

5. Less Manual Intervention

No need to load each job manually.

Disadvantages of Batch Processing System

1. Difficult to Debug

Errors are difficult to find and correct.

2. No User Interaction

Users cannot interact directly during execution.

3. Infinite Loop Problem

A faulty job may enter an infinite loop.

4. Lack of Protection

One batch job can affect other pending jobs.

5. CPU Idle During I/O

CPU remains idle during input/output operations.

6. Memory Wastage

Large memory may remain unused.

8. Multiprogramming Operating System

Multiprogramming is a type of operating system in which two or more programs reside in memory at the same time and share the CPU.

The main goal of multiprogramming is to increase CPU utilization by keeping the CPU busy all the time.

Definition

A system in which multiple programs are loaded into memory simultaneously and the CPU switches between them for execution is called a Multiprogramming Operating System.

Working of Multiprogramming System

  1. Multiple jobs are loaded into memory.
  2. CPU starts executing one job.
  3. When the job needs an I/O operation, it goes into waiting state.
  4. Operating System switches CPU to another job.
  5. CPU continues processing another program.
  6. This process continues until all jobs are completed.

CPU Scheduling

CPU SchedulingCPU\ SchedulingCPU Scheduling

The Operating System uses CPU Scheduling Algorithms to decide:

  • Which job should execute next.
  • How CPU time is shared among programs.

Example of Multiprogramming

Suppose there are 3 programs in memory:

Program State
Program 1 Running
Program 2 Waiting for I/O
Program 3 Ready

Process

  • CPU executes Program 1.
  • Program 1 requests I/O and goes to waiting state.
  • OS immediately switches CPU to Program 3.
  • CPU never remains idle.

Real Life Example

Imagine a teacher checking notebooks.

  • While one student is writing corrections,
  • Teacher checks another student's notebook.

Similarly:

  • When one program waits for I/O,
  • CPU executes another program.

States in Multiprogramming

State Meaning
Running Program is executing
Waiting Program waiting for I/O
Ready Program ready for execution

Features of Multiprogramming System

  • Multiple jobs in memory simultaneously.
  • CPU switches between programs.
  • Improves CPU utilization.
  • Reduces CPU idle time.
  • Uses CPU scheduling.
  • Requires memory management.

Advantages of Multiprogramming System

1. High CPU Utilization

CPU remains busy most of the time.

2. Efficient Memory Utilization

Memory is used effectively by multiple programs.

3. Increased Throughput

More jobs are completed in less time.

4. Reduced Idle Time

CPU does not remain idle during I/O operations.

Disadvantages of Multiprogramming System

1. CPU Scheduling Required

Complex scheduling algorithms are needed.

2. Memory Management Required

Operating System must manage multiple jobs in memory.

3. Complex Operating System

System design becomes complicated.

4. Security and Protection Problems

One program may affect another if protection is weak.

9. Time Sharing System / Multitasking System

Time Sharing System is a logical extension of Multiprogramming Operating System.
In this system, CPU time is shared among multiple users and processes.

Each process gets CPU for a fixed small amount of time called Time Quantum.

Definition

A system in which CPU time is divided among multiple users/processes for a fixed time interval is called a Time Sharing Operating System.

It is also known as:

  • Multitasking System
  • Fair Share Operating System

Time Quantum

Time QuantumTime\ QuantumTime Quantum

Time Quantum means:

  • Fixed amount of CPU time given to each process.
  • After completion of the time slice, CPU switches to another process.

Working of Time Sharing System

  1. Multiple users access the system simultaneously through terminals.
  2. CPU allocates a small time slice to each process.
  3. After one process uses its time quantum, CPU switches to another process.
  4. Switching happens very fast.
  5. Users feel that they are using the system alone.

Features of Time Sharing System

  • Multiple users can access the system simultaneously.
  • CPU time is shared among users.
  • Uses CPU Scheduling and Multiprogramming.
  • Provides direct user interaction.
  • Fast switching between processes.
  • Supports multitasking.

Example of Time Sharing System

Suppose 3 users are using a computer:

User Work
User 1 Typing document
User 2 Listening music
User 3 Printing file

Process

  • CPU gives a few milliseconds to User 1.
  • Then switches to User 2.
  • Then switches to User 3.
  • This switching is so fast that all users feel their work is running continuously.

Real Life Example

Imagine one teacher helping many students.

  • Teacher gives a few minutes to one student,
  • then moves to another student quickly.

Similarly:

  • CPU gives small time slices to each process one by one.

Examples of Time Sharing Operating Systems

  • UNIX
  • MULTICS

Advantages of Time Sharing System

1. Quick Response Time

Users get fast responses from the system.

2. Efficient CPU and Memory Utilization

Resources are utilized effectively.

3. User Interaction Possible

Users can directly interact with the computer.

4. Less Chance of Software Duplication

Programs and resources can be shared.

5. Equal Opportunity

Each process gets equal CPU time.

Disadvantages of Time Sharing System

1. Security and Integrity Problems

User data protection becomes difficult.

2. Reliability Issues

Failure of one part may affect others.

3. Data Communication Problems

Communication errors may occur.

4. Complex Design

Requires advanced programming and security.

5. Context Switching Overhead

Frequent CPU switching reduces efficiency.

6. Priority Problems

High-priority processes may not execute first because equal time is given to all.

10. Multiprocessor System

Multiprocessor System is also known as:

  • Parallel System
  • Tightly Coupled System

In this system, multiple processors (CPUs) work together and share common resources like:

  • Main Memory
  • Computer Bus
  • System Clock
  • Input/Output Devices

Examples:

  • Dual Core Processor
  • Quad Core Processor
  • Octa Core Processor

Definition

A system that contains two or more processors connected closely together and working under a single operating system is called a Multiprocessor System.

Working of Multiprocessor System

  1. Multiple CPUs are connected through a fast communication network.
  2. All processors share the same memory and resources.
  3. The Operating System controls all processors.
  4. Different processors execute different tasks simultaneously.
  5. User sees the whole system as a single powerful computer.

Shared Memory Concept

Shared MemoryShared\ MemoryShared Memory

In Multiprocessor Systems:

  • All CPUs access the same memory.
  • Resources are shared among processors.

Example of Multiprocessor System

Suppose a computer has 4 processors:

Processor Task
CPU 1 Playing Video
CPU 2 Running Browser
CPU 3 Downloading Files
CPU 4 Antivirus Scan

All tasks execute simultaneously.

Real Life Example

Imagine 4 workers building one house together.

  • One worker paints walls.
  • One installs doors.
  • One fixes electricity.
  • One arranges furniture.

Work finishes faster because tasks are divided.

Similarly:

  • Different CPUs execute different subtasks in parallel.

Features of Multiprocessor System

  • Multiple CPUs in one system.
  • Shared memory and resources.
  • Single Operating System controls all processors.
  • Parallel execution of tasks.
  • High-speed communication between processors.
  • Tightly coupled architecture.

Advantages of Multiprocessor System

1. Increased System Throughput

Multiple tasks execute simultaneously.

2. Faster Execution

Large tasks are divided into subtasks and processed in parallel.

3. Cost Effective

Shared resources reduce overall cost.

4. High Reliability

Failure of one processor does not stop the whole system.

5. Better Performance

System works faster than single processor systems.

Disadvantages of Multiprocessor System

1. Complex Process Synchronization

Processors must coordinate with each other.

2. Difficult Task Scheduling

Operating System must assign tasks carefully.

3. Complex Memory Management

Shared memory management becomes difficult.

4. Security and Protection Problems

Multiple CPUs sharing memory may create protection issues.

5. Limited Scalability

Adding more CPUs is difficult after a limit.

Page 2 of 3