Operating System
What is Operating System? Needs/goals of OS and Main Two parts of OS (Shell & Kernel)

Operating System (OS)
An Operating System is a System Software that acts as an interface between the user and computer hardware. It works as a communication medium that allows users to interact with hardware components.

It is also called a Resource Manager because it manages both hardware and software resources such as:
• Memory
• Files
• Disk
• Input-Output Devices
• CPU Scheduling

The OS ensures that these resources are used efficiently and properly.

Goals / Need of Operating System:
• Provides a user-friendly interface
• Manages hardware and software resources
• Improves system performance and optimization
• Ensures system security and control
• Uses hardware resources efficiently

Parts of Operating System
An Operating System has two main parts:

1) Kernel:
The Kernel is the core component of the OS. It directly interacts with hardware and manages system resources like CPU, memory, and devices.

2) Shell:
The Shell acts as a Command Interpreter. It takes user commands, interprets them, and communicates with the Kernel to perform required tasks. It is responsible for user interaction.

Interaction Flow:
User ↔ Shell ↔ Kernel ↔ Hardware

• The user interacts with the Shell through commands or applications.
• The Shell communicates instructions to the Kernel.
• The Kernel interacts with hardware to execute tasks.

Operating System (OS)
Operating System হলো একটি System Software যা user এবং computer hardware-এর মধ্যে interface হিসেবে কাজ করে। এটি communication মাধ্যম হিসেবে কাজ করে যাতে user hardware-এর সাথে যোগাযোগ করতে পারে।

এটিকে Resource Manager ও বলা হয়, কারণ এটি hardware ও software resource পরিচালনা করে, যেমন:
• Memory
• Files
• Disk
• Input-Output Device
• CPU Scheduling

OS এই resource গুলো দক্ষভাবে ব্যবহারের নিশ্চয়তা দেয়।

Operating System-এর লক্ষ্য / প্রয়োজনীয়তা:
• User-এর জন্য সহজ interface প্রদান করা
• Hardware ও software resource পরিচালনা করা
• System-এর performance ও optimization বৃদ্ধি করা
• System security ও control নিশ্চিত করা
• Hardware resource দক্ষভাবে ব্যবহার করা

Operating System-এর অংশ
Operating System-এর দুটি প্রধান অংশ রয়েছে:

1) Kernel:
Kernel হলো OS-এর মূল অংশ। এটি সরাসরি hardware-এর সাথে কাজ করে এবং CPU, memory ও device management পরিচালনা করে।

2) Shell:
Shell একটি Command Interpreter হিসেবে কাজ করে। এটি user-এর command গ্রহণ করে, ব্যাখ্যা করে এবং Kernel-কে প্রয়োজনীয় কাজ সম্পাদনের নির্দেশ দেয়। এটি user interaction পরিচালনা করে।

Interaction Flow:
User ↔ Shell ↔ Kernel ↔ Hardware

• User command বা application-এর মাধ্যমে Shell-এর সাথে যোগাযোগ করে।
• Shell নির্দেশ Kernel-এ পাঠায়।
• Kernel hardware-এর সাথে কাজ করে নির্দিষ্ট কাজ সম্পন্ন করে।

🎥 Video Solution: What is Operating System? Needs/Goals of OS, Part of OS (Shell & kernel)

Types of Operating system

Operating System (OS) is system software that controls and manages the hardware and software of a computer.

It works as a bridge between the user and the computer, helping the computer run smoothly and properly.

Different types of Operating System are designed for different purposes. Some OS can perform only one task at a time, while others can handle many users or real-time tasks at the same time.

In short, an Operating System makes the computer easy and efficient to use.

Operating System (OS) হলো একটি System Software যা কম্পিউটারের Hardware ও Software নিয়ন্ত্রণ ও পরিচালনা করে।

এটি User এবং Computer-এর মধ্যে Bridge হিসেবে কাজ করে এবং কম্পিউটারকে সঠিকভাবে ও মসৃণভাবে পরিচালনা করতে সহায়তা করে।

বিভিন্ন ধরনের Operating System বিভিন্ন প্রয়োজন পূরণ করে। কিছু OS এক সময়ে একটি কাজ করে, আবার কিছু OS একাধিক User বা Real-time Task একসাথে পরিচালনা করতে পারে।

সারসংক্ষেপে, Operating System কম্পিউটারকে সহজ ও কার্যকরভাবে ব্যবহার করতে সাহায্য করে।

Different Types of Operating System:
1. Batch OS
2. Multi-programming Os
3. Multitasking OS
4. Multiprocessing OS
5. Time Sharing OS
6. Distributed OS
7. Network OS
8. Mobile OS

Types of OS: Batch operating system

[urcr_restrict]

Batch Operating System is a type of Operating System designed to process a large number of similar jobs efficiently. In this system, users do not interact directly with the computer. Jobs are collected, grouped into batches by an operator, and executed automatically one after another.

It executes a group of similar jobs automatically in batches without user interaction.

Advantages of Batch Operating System:

1. Minimal Idle Time: Jobs are processed continuously without human intervention, reducing idle time.

2. Handling Repetitive Tasks: Suitable for large and repetitive tasks such as payroll and billing systems.

3. Improved Throughput: Can process a high volume of jobs, increasing overall system throughput.

Disadvantages of Batch Operating System:

1. Inefficient CPU Utilization: CPU remains idle when waiting for I/O operations.

2. Increased Response Time: Output takes longer because jobs are processed sequentially.

3. Lack of Real-Time Feedback: Users cannot interact with the system during execution.

In conclusion, Batch Operating System is suitable for large repetitive processing tasks but not ideal for interactive or real-time applications.

Batch Operating System হলো এমন একটি Operating System যা একই ধরনের বিপুল সংখ্যক Job দক্ষতার সাথে Processing করার জন্য তৈরি। এখানে User সরাসরি Computer-এর সাথে Interaction করতে পারে না। Job গুলো Operator সংগ্রহ করে Batch আকারে সাজিয়ে একটির পর একটি স্বয়ংক্রিয়ভাবে Execute করে।

এটি User Interaction ছাড়া একই ধরনের Job গুলোকে Batch আকারে স্বয়ংক্রিয়ভাবে Execute করে।

Batch Operating System-এর সুবিধাসমূহ:

১. Minimal Idle Time: Human Intervention ছাড়া ধারাবাহিকভাবে Job Processing হওয়ায় Idle Time কম হয়।

২. Handling Repetitive Tasks: Payroll, Billing-এর মতো বড় ও Repetitive Task পরিচালনার জন্য উপযোগী।

৩. Improved Throughput: একসাথে অনেক Job Processing করে System Throughput বৃদ্ধি করে।

Batch Operating System-এর অসুবিধাসমূহ:

১. Inefficient CPU Utilization: I/O Operation-এর সময় CPU Idle থাকে।

২. Increased Response Time: ধারাবাহিকভাবে Job Execute হওয়ায় Output পেতে বেশি সময় লাগে।

৩. Lack of Real-Time Feedback: Execution চলাকালীন User Real-time Interaction করতে পারে না।

সারসংক্ষেপে, Batch Operating System বড় ও Repetitive Processing কাজের জন্য উপযুক্ত হলেও Interactive বা Real-time Application-এর জন্য উপযোগী নয়।

[/urcr_restrict]

Types of OS: Multiprogramming operating system

[urcr_restrict]

Multi-Programming Operating System is a type of Operating System where multiple programs are kept in memory at the same time. The CPU switches from one program to another so that it remains busy and overall system performance improves.It runs multiple programs in memory at the same time to maximize CPU usage.

Advantages of Multi-Programming Operating System:

1. Better CPU Utilization: CPU switches to another job during I/O wait and stays busy.

2. Improved Throughput: Multiple jobs run concurrently, increasing work done per unit time.

3. Efficient Resource Use: CPU, memory, and I/O devices are shared effectively among processes.

Disadvantages of Multi-Programming Operating System:

1. Complex Design: Requires advanced memory management and CPU scheduling.

2. Security Issues: More programs in memory increase the risk of unauthorized access.

3. High Memory Requirement: Requires more memory.

In conclusion, Multi-Programming Operating System improves CPU utilization and performance but requires complex management and more memory.

Multi-Programming Operating System হলো এমন একটি Operating System যেখানে একাধিক Program একই সময়ে Memory-তে সংরক্ষিত থাকে। CPU একটি Program থেকে অন্য Program-এ Switch করে, ফলে CPU Busy থাকে এবং System Performance বৃদ্ধি পায়।

এটি একই সময়ে একাধিক Program Memory-তে চালিয়ে CPU Usage সর্বোচ্চ করে।

Multi-Programming Operating System-এর সুবিধাসমূহ:

১. Better CPU Utilization: একটি Job I/O অপেক্ষায় থাকলে CPU অন্য Job-এ Switch করে Busy থাকে।

২. Improved Throughput: একাধিক Job একসাথে Concurrently চলায় প্রতি একক সময়ে কাজের পরিমাণ বৃদ্ধি পায়।

৩. Efficient Resource Use: CPU, Memory এবং I/O Device কার্যকরভাবে Process-এর মধ্যে ভাগ করা হয়।

Multi-Programming Operating System-এর অসুবিধাসমূহ:

১. Complex Design: উন্নত Memory ManagementCPU Scheduling প্রয়োজন।

২. Security Issues: বেশি Program Memory-তে থাকলে Unauthorized Access-এর ঝুঁকি বাড়ে।

৩. High Memory Requirement: বেশি Memory প্রয়োজন।

সারসংক্ষেপে, Multi-Programming Operating System CPU Utilization ও System Performance বৃদ্ধি করে, তবে জটিল ব্যবস্থাপনা ও বেশি Memory প্রয়োজন।

[/urcr_restrict]

Types of OS: Multiprocessing operating system

[urcr_restrict]

Multi-Processing Operating System is a type of Operating System in which more than one CPU is used to execute processes. It improves the throughput and overall performance of the system.

It uses two or more CPUs simultaneously to increase speed and reliability.

Advantages of Multi-Processing Operating System:

1. Faster Processing: Multiple CPUs work at the same time, increasing system speed.

2. High Reliability: If one processor fails, other processors continue working (fault tolerance).

3. Supports Heavy Tasks: Suitable for computation-intensive applications such as scientific and industrial tasks.

Disadvantages of Multi-Processing Operating System:

1. High Cost: Multiple processors and complex hardware increase the system cost.

2. Complex Design: Requires advanced OS support for communication and task distribution.

3. Not Always Efficient: Poor task distribution may cause idle processors and waste resources.

Examples:

• UNIX

• Linux (Ubuntu, Red Hat, Debian)

• macOS

In conclusion, Multi-Processing Operating System increases speed and reliability but requires high cost and complex management.

Multi-Processing Operating System হলো এমন একটি Operating System যেখানে একাধিক CPU ব্যবহার করে Process Execute করা হয়। এটি System-এর Throughput ও সামগ্রিক Performance বৃদ্ধি করে।

এটি একই সময়ে দুই বা ততোধিক CPU ব্যবহার করে Speed ও Reliability বৃদ্ধি করে।

Multi-Processing Operating System-এর সুবিধাসমূহ:

১. Faster Processing: একাধিক CPU একসাথে কাজ করে System Speed বৃদ্ধি করে।

২. High Reliability: একটি Processor ব্যর্থ হলেও অন্য Processor কাজ চালিয়ে যেতে পারে (Fault Tolerance)।

৩. Supports Heavy Tasks: Scientific বা Industrial-এর মতো Computation-intensive Application-এর জন্য উপযোগী।

Multi-Processing Operating System-এর অসুবিধাসমূহ:

১. High Cost: একাধিক Processor ও Complex Hardware ব্যবহারের কারণে System Cost বেশি।

২. Complex Design: Communication ও Task Distribution-এর জন্য উন্নত OS Support প্রয়োজন।

৩. Not Always Efficient: সঠিক Task Distribution না হলে Processor Idle থাকতে পারে এবং Resource অপচয় হয়।

উদাহরণ:

• UNIX

• Linux (Ubuntu, Red Hat, Debian)

• macOS

সারসংক্ষেপে, Multi-Processing Operating System Speed ও Reliability বৃদ্ধি করে, তবে এর Cost বেশি এবং ব্যবস্থাপনা জটিল।

[/urcr_restrict]

Types of OS: Multiprocessing operating system

Multi-Tasking Operating System is a type of multiprogramming system where multiple tasks are executed by the CPU in a round-robin manner. Each task is given a fixed time slice called a Time Quantum.

When the time quantum expires, the Operating System switches to the next task. This rapid switching allows multiple tasks—whether from a single user or multiple users—to run smoothly on the same system.

It allows multiple tasks to run by giving each a small time slice for shared and smooth system use.

Advantages of Multi-Tasking Operating System:

1. Equal CPU Access: Each task gets a fair share of CPU time.

2. Reduced Software Duplication: Multiple users can use the same software without separate copies.

3. Low CPU Idle Time: Efficient scheduling keeps the CPU busy.

Disadvantages of Multi-Tasking Operating System:

1. Lower Reliability: System failure can affect all running tasks.

2. Security Concerns: Multiple users increase risks to data integrity and privacy.

3. Communication Issues: Data sharing between users may cause conflicts.

Examples:

• IBM VM/CMS

• TSO (Time Sharing Option)

• Windows Terminal Services

Multi-Tasking Operating System হলো এমন একটি Multiprogramming System যেখানে একাধিক Task Round-Robin পদ্ধতিতে Execute হয়। প্রতিটি Task একটি নির্দিষ্ট সময় পায়, যাকে Time Quantum বলা হয়।
Time Quantum শেষ হলে Operating System পরবর্তী Task-এ Switch করে। দ্রুত Switching-এর মাধ্যমে একই System-এ একাধিক User বা একাধিক Task একসাথে Smoothভাবে চলতে পারে।
এটি প্রতিটি Task-কে ছোট সময় ভাগ দিয়ে একাধিক Task চালানোর সুযোগ দেয়।

Multi-Tasking Operating System-এর সুবিধাসমূহ:

১. Equal CPU Access: প্রতিটি Task সমানভাবে CPU Time পায়।

২. Reduced Software Duplication: একাধিক User একই Software ব্যবহার করতে পারে।

৩. Low CPU Idle Time: কার্যকর Scheduling-এর কারণে CPU Idle কম থাকে।

Multi-Tasking Operating System-এর অসুবিধাসমূহ:

১. Lower Reliability: System Failure হলে সকল Task প্রভাবিত হতে পারে।

২. Security Concerns: একাধিক User থাকার কারণে Data Integrity ও Privacy ঝুঁকি থাকে।

৩. Communication Issues: Data Sharing-এর কারণে Conflict হতে পারে।

উদাহরণ:

• IBM VM/CMS

• TSO (Time Sharing Option)

• Windows Terminal Services

Types of OS: Time Sharing operating system

[urcr_restrict]

Time-Sharing Operating System is a type of Operating System that allows multiple users to use a computer system at the same time from different terminals. The processor time is divided and shared among users. This technique is also known as multitasking.

It is a logical extension of multiprogramming where the main objective is to minimize response time, unlike Multiprogrammed Batch Systems which aim to maximize CPU utilization.

The CPU switches between multiple jobs very frequently. Each user gets a small unit of CPU time called a Time Quantum. Because of this fast switching, users receive responses within a few seconds.

The Operating System uses CPU Scheduling and Multiprogramming to give each user a small portion of CPU time. Many batch systems were later modified into time-sharing systems.

Advantages of Time-Sharing Operating System:

1. Quick Response: Provides fast response to users.

2. Avoids Software Duplication: Multiple users can share the same software.

3. Reduces CPU Idle Time: CPU remains busy by switching between tasks.

Disadvantages of Time-Sharing Operating System:

1. Reliability Problem: System failure can affect all users.

2. Security Issues: Risk to user programs and data integrity.

3. Data Communication Problem: Requires proper communication management.

In conclusion, Time-Sharing Operating System provides fast response and better resource sharing but faces security and reliability challenges.

Time-Sharing Operating System হলো এমন একটি Operating System যেখানে একাধিক User বিভিন্ন Terminal থেকে একই সময়ে একটি Computer System ব্যবহার করতে পারে। Processor-এর সময় ভাগ করে User-দের মধ্যে বিতরণ করা হয়। এই পদ্ধতিকে Multitaskingও বলা হয়।

এটি Multiprogramming-এর একটি Logical Extension। এখানে মূল লক্ষ্য হলো Response Time কমানো, যেখানে Multiprogrammed Batch System-এর লক্ষ্য ছিল CPU Utilization বৃদ্ধি করা।

CPU খুব দ্রুত এক Job থেকে অন্য Job-এ Switch করে। প্রত্যেক User একটি নির্দিষ্ট সময় পায়, যাকে Time Quantum বলা হয়। দ্রুত Switching-এর কারণে User কয়েক সেকেন্ডের মধ্যেই Response পায়।

Operating System CPU Scheduling এবং Multiprogramming ব্যবহার করে প্রত্যেক User-কে অল্প সময়ের CPU ভাগ দেয়। অনেক Batch System পরবর্তীতে Time-Sharing System-এ রূপান্তর করা হয়েছে।

Time-Sharing Operating System-এর সুবিধাসমূহ:

১. Quick Response: দ্রুত Response প্রদান করে।

২. Avoids Software Duplication: একাধিক User একই Software শেয়ার করতে পারে।

৩. Reduces CPU Idle Time: Task Switching-এর মাধ্যমে CPU Idle কম থাকে।

Time-Sharing Operating System-এর অসুবিধাসমূহ:

১. Reliability Problem: System Failure হলে সকল User প্রভাবিত হতে পারে।

২. Security Issues: User Program ও Data Integrity ঝুঁকিতে পড়তে পারে।

৩. Data Communication Problem: সঠিক Communication Management প্রয়োজন।

সারসংক্ষেপে, Time-Sharing Operating System দ্রুত Response ও উন্নত Resource Sharing নিশ্চিত করে, তবে Security ও Reliability সংক্রান্ত কিছু চ্যালেঞ্জ রয়েছে।

[/urcr_restrict]

What is Kernel? User Space and Kernel Space

[urcr_restrict]

Kernel
Kernel is the core component (heart) of an Operating System. It is responsible for managing all major functions of the OS, including CPU management, memory management, device management, and process control. It acts as a communication bridge between user applications and hardware.

When the operating system boots, the kernel is the first component loaded into memory and it remains active until the system is shut down.

User Space and Kernel Space
When an application or program runs, its execution happens in two separate areas:

1) User Space:
This is the area where user-level applications run, such as Browser, Media Player, Text Editor, etc. Programs in user space cannot directly access hardware; they must request services from the kernel.

2) Kernel Space:
This is the protected area where the kernel operates. It has full access to system resources such as CPU, Memory, Network, and Hardware Devices. All critical system operations are performed in kernel space.

Thus, the separation between user space and kernel space ensures system stability and security.

Kernel
Kernel হলো Operating System-এর মূল অংশ (heart)। এটি OS-এর সকল গুরুত্বপূর্ণ কাজ পরিচালনা করে, যেমন CPU management, memory management, device management এবং process control। এটি user application এবং hardware-এর মধ্যে communication bridge হিসেবে কাজ করে।

System চালু হলে kernel সর্বপ্রথম memory-তে load হয় এবং system shutdown না হওয়া পর্যন্ত সক্রিয় থাকে।

User Space এবং Kernel Space
যখন কোনো application বা program চলে, তখন তার কার্যপ্রক্রিয়া দুইটি আলাদা অংশে সম্পন্ন হয়:

1) User Space:
এখানে user-level application চলে, যেমন Browser, Media Player, Text Editor ইত্যাদি। User space-এর program সরাসরি hardware access করতে পারে না; kernel-এর মাধ্যমে service নিতে হয়।

2) Kernel Space:
এটি একটি সুরক্ষিত এলাকা যেখানে kernel কাজ করে। এখানে CPU, Memory, Network এবং Hardware Device-এর পূর্ণ নিয়ন্ত্রণ থাকে। সকল গুরুত্বপূর্ণ system operation kernel space-এ সম্পন্ন হয়।

এইভাবে user space এবং kernel space-এর পৃথকীকরণ system-এর স্থিতিশীলতা ও নিরাপত্তা নিশ্চিত করে।

Diagram of kernel and user space architecture[/urcr_restrict]

Types of Kernel: Monolithic/Macro Kernel

Monolithic Kernel
The Monolithic Kernel is the earliest type of kernel architecture used in operating systems. In this architecture, all operating system services are combined and executed in the same memory area called Kernel Space.

In this structure, the User Space contains only user applications. All major components such as Virtual File System, System Call Interface, Inter-Process Communication (IPC), File System, Scheduler, Device Drivers, and other services are placed together inside the Kernel Space.
Working Principle
Since all services are integrated into one large module, the kernel becomes large in size but performs faster.
• Larger in size – because all services are included inside Kernel Space.
• Faster execution – because there is no need for switching between spaces, which reduces overhead.
Problems with Monolithic Kernel
• Low stability – If any single service crashes, the entire operating system crashes.
• Difficult maintenance and debugging – The kernel becomes very large and complex, making bug detection difficult.
• Adding new services requires modifying and recompiling the whole kernel.
Advantages
• High speed
• Good performance
Disadvantages
• Less stable
• Complex and hard to maintain

Monolithic Kernel
Monolithic Kernel হলো Operating System-এর প্রাচীনতম kernel architecture। এই পদ্ধতিতে সব operating system service একই memory area অর্থাৎ Kernel Space-এ একসাথে কাজ করে।

এই গঠনে User Space-এ শুধুমাত্র user application থাকে। আর Virtual File System, System Call Interface, Inter-Process Communication (IPC), File System, Scheduler, Device Driver এবং অন্যান্য service সব Kernel Space-এর ভেতরে অবস্থান করে।
কার্যপ্রণালী (Working Principle)
সব service একত্রে একটি বড় module-এ থাকায় kernel আকারে বড় হয় কিন্তু execution দ্রুত হয়।
• আকারে বড় – কারণ সব service Kernel Space-এ থাকে।
• দ্রুত execution – কারণ space পরিবর্তন বা switching প্রয়োজন হয় না।
Monolithic Kernel-এর সমস্যা
• স্থিতিশীলতা কম – একটি service crash করলে পুরো Operating System crash করে।
• Maintenance ও debugging কঠিন – kernel বড় ও জটিল হওয়ায় bug খুঁজে বের করা কঠিন।
• নতুন service যোগ করতে পুরো kernel modify ও recompile করতে হয়।
সুবিধা
• উচ্চ গতি
• ভালো performance
অসুবিধা
• কম স্থিতিশীল
• জটিল ও রক্ষণাবেক্ষণ কঠিন

Types of Kernel: Micro Kernel

[urcr_restrict]

Microkernel
The Microkernel is a modern kernel architecture that follows a modular design approach. Unlike the Monolithic Kernel, only essential services run in the Kernel Space, while other services run in the User Space.

Components in Kernel Space
Only core services remain inside the kernel:
• Memory Management
• Process Scheduling
• Inter-Process Communication (IPC)

All other services such as File System, Device Drivers, Networking, and system services operate in User Space.

Working Principle
Since only essential services are kept in Kernel Space:

• Smaller in size – because limited components are inside the kernel.
• Modular design – services are separate and independent.
• Easier debugging and maintenance – new services can be added without modifying the entire kernel.

If a user-space service fails, the operating system continues running without crashing. This structure improves system security and stability because faults in User Space cannot directly affect the kernel.

Advantages
• Stable
• Secure
• Easy to maintain
• Fault-tolerant (failure of one service does not crash OS)

Disadvantages
• Slower execution compared to Monolithic Kernel due to communication overhead between User Space and Kernel Space

Microkernel
Microkernel হলো একটি আধুনিক kernel architecture যা modular design অনুসরণ করে। Monolithic Kernel-এর বিপরীতে, এখানে শুধুমাত্র প্রয়োজনীয় service Kernel Space-এ থাকে এবং অন্যান্য service User Space-এ পরিচালিত হয়।

Kernel Space-এ থাকা Component
শুধুমাত্র মূল service গুলো kernel-এর অংশ:
• Memory Management
• Process Scheduling
• Inter-Process Communication (IPC)

File System, Device Driver, Networking এবং অন্যান্য system service User Space-এ কাজ করে।

কার্যপ্রণালী (Working Principle)
Kernel Space-এ সীমিত service রাখার ফলে:

• আকারে ছোট – কারণ কম component kernel-এর ভেতরে থাকে।
• Modular design – প্রতিটি service আলাদা ও স্বাধীন।
• Debugging ও maintenance সহজ – নতুন service যোগ করতে পুরো kernel পরিবর্তন করতে হয় না।

যদি কোনো User Space service ব্যর্থ হয়, তবুও Operating System crash করে না। এই নকশা বেশি security ও stability প্রদান করে, কারণ User Space-এর ত্রুটি সরাসরি kernel-কে প্রভাবিত করতে পারে না।

সুবিধা
• স্থিতিশীল
• নিরাপদ
• রক্ষণাবেক্ষণ সহজ
• Fault-tolerant (একটি service ব্যর্থ হলেও OS crash করে না)

অসুবিধা
• Monolithic Kernel-এর তুলনায় execution ধীর, কারণ User Space ও Kernel Space-এর মধ্যে communication overhead থাকে

[/urcr_restrict]

Difference Between Molothic/Macro Kernel Vs Micro Kernel

What is Process?

Process is a program that is currently under execution. It is an active entity of a program. When a program is loaded into memory and executed by the CPU, it becomes a process.

A process is more than just program code. It includes the Program Counter, Registers, Process Stack, and other resources. The information about a process is stored in a data structure called PCB (Process Control Block).

A process can create another process known as a Child Process, while the creating process is called the Parent Process. Each process has its own memory space and does not share memory with other processes.

Advantages of Process:

1. Independent Execution: Works independently in separate memory, improving security.

2. Efficient Resource Allocation: CPU and memory resources are managed efficiently.

3. Task Prioritization: Processes can be prioritized for better management.

Disadvantages of Process:

1. Context Switching Overhead: Frequent context switching may reduce system speed.

2. Deadlock Risk: Improper resource handling may cause deadlock.

3. High Memory Usage: Too many processes increase memory usage and management overhead.

In conclusion, a Process is an active program with its own memory and resources, managed by the Operating System for efficient execution.

Process হলো এমন একটি Program যা বর্তমানে Execution অবস্থায় আছে। যখন একটি Program Memory-তে লোড হয়ে CPU দ্বারা Execute হয়, তখন সেটি Process এ পরিণত হয়।

Process শুধু Program Code নয়; এতে Program Counter, Registers, Process Stack এবং অন্যান্য Resource অন্তর্ভুক্ত থাকে। একটি Process-এর সকল তথ্য PCB (Process Control Block)-এ সংরক্ষিত থাকে।

একটি Process অন্য Process তৈরি করতে পারে, যাকে Child Process বলা হয় এবং যে Process তৈরি করে তাকে Parent Process বলা হয়। প্রতিটি Process-এর নিজস্ব Memory Space থাকে এবং এটি অন্য Process-এর সাথে Memory শেয়ার করে না।

Process-এর সুবিধাসমূহ:

১. Independent Execution: আলাদা Memory-তে কাজ করে, ফলে Security বৃদ্ধি পায়।

২. Efficient Resource Allocation: CPUMemory কার্যকরভাবে ব্যবস্থাপনা করা যায়।

৩. Task Prioritization: প্রয়োজন অনুযায়ী Process-কে Priority দেওয়া যায়।

Process-এর অসুবিধাসমূহ:

১. Context Switching Overhead: ঘন ঘন Context Switching হলে System Speed কমতে পারে।

২. Deadlock Risk: ভুল Resource Management-এর কারণে Deadlock হতে পারে।

৩. High Memory Usage: বেশি Process হলে বেশি Memory প্রয়োজন হয় এবং Management জটিল হয়।

সারসংক্ষেপে, Process হলো একটি Active Program যা নিজস্ব Memory ও Resource ব্যবহার করে Operating System-এর নিয়ন্ত্রণে কার্য সম্পাদন করে।

Explain Process state transition diagram

Process State Diagram shows the different states of a process and how it moves from one state to another during execution in an Operating System.

Main States of a Process:

1. New: A process is created (job is entered into the system) but not yet ready to run.

2. Ready: The process is in main memory and waiting for CPU. It is ready to execute.

3. Running: The process is currently executing on the CPU.

4. Waiting (Blocked): The process cannot continue until an I/O operation or an event completes.

5. Terminated: The process finishes execution and exits from the system.

Process State Diagram দেখায় একটি Process কী কী State-এ থাকে এবং Execution চলাকালীন এক State থেকে আরেক State-এ কীভাবে Move করে।

Process-এর প্রধান States:

১. New: নতুন Process তৈরি হয়, কিন্তু এখনো CPU-তে চলার জন্য Ready নয়।

২. Ready: Process Main Memory-তে আছে এবং CPU পাওয়ার জন্য Ready Queue-তে অপেক্ষা করে।

৩. Running: Process এখন CPU-তে Execute হচ্ছে।

৪. Waiting (Blocked): I/O বা কোনো Event শেষ না হওয়া পর্যন্ত Process চলতে পারে না।

৫. Terminated: কাজ শেষ হলে Process Exit করে এবং শেষ হয়ে যায়।

What is Thread?

[urcr_restrict]

Thread is called a lightweight process because it shares some features of a process but is smaller and faster. Every thread belongs to a specific process and cannot exist independently.

A thread has its own Registers, Program Counter, and Stack, but it shares Memory, Data Segment, Code Segment, and other resources with other threads of the same process.

Unlike processes, threads do not isolate memory. Therefore, an error in one thread may affect other threads. A thread takes less time to create and terminate compared to a process.

Example:

In a mobile banking app, multiple threads work together. One thread loads account balance, another handles user input, and another loads images. Because threads run simultaneously, the app remains smooth and responsive.

Advantages of Thread:

1. Improved Performance: Tasks run in parallel, especially useful for I/O operations.

2. Fast Creation and Termination: Threads are faster to create and destroy than processes.

3. Multitasking Support: Allows applications to perform multiple tasks at the same time.

Disadvantages of Thread:

1. Shared Memory Risk: Error in one thread can affect others.

2. Resource Conflict: Shared resources may cause conflicts and unexpected behavior.

3. Performance Issue: Too many threads may reduce performance and consume more memory.

In conclusion, a Thread is a lightweight execution unit within a process that improves performance but requires proper synchronization and management.

Thread কে Lightweight Process বলা হয়, কারণ এটি Process-এর কিছু বৈশিষ্ট্য শেয়ার করলেও আকারে ছোট ও দ্রুত। প্রতিটি Thread একটি নির্দিষ্ট Process-এর অংশ এবং আলাদাভাবে থাকতে পারে না।

Thread-এর নিজস্ব Registers, Program Counter এবং Stack থাকে, তবে একই Process-এর অন্যান্য Thread-এর সাথে Memory, Data Segment, Code Segment ও Resource শেয়ার করে।

Process-এর মতো Thread Memory আলাদা করে না (Isolation নেই)। তাই একটি Thread-এ Error হলে অন্য Thread-এ প্রভাব ফেলতে পারে। Process-এর তুলনায় Thread তৈরি ও Terminate করতে কম সময় লাগে।

উদাহরণ:

Mobile Banking App-এ একাধিক Thread একসাথে কাজ করে। একটি Thread Balance লোড করে, অন্যটি User Input পরিচালনা করে, আরেকটি Image লোড করে। ফলে App Smooth ও Responsive থাকে।

Thread-এর সুবিধাসমূহ:

১. Improved Performance: বিশেষ করে I/O Operation-এ Parallelভাবে কাজ করে Performance বাড়ায়।

২. Fast Creation and Termination: Process-এর তুলনায় দ্রুত তৈরি ও Terminate করা যায়।

৩. Multitasking Support: একই সময়ে একাধিক Task সম্পাদন করা যায়।

Thread-এর অসুবিধাসমূহ:

১. Shared Memory Risk: একটি Thread-এর Error অন্য Thread-এ প্রভাব ফেলতে পারে।

২. Resource Conflict: Shared Resource-এর কারণে Conflict হতে পারে।

৩. Performance Issue: অতিরিক্ত Thread হলে Performance কমতে পারে এবং বেশি Memory ব্যবহার হয়।

সারসংক্ষেপে, Thread হলো একটি Lightweight Execution Unit যা Process-এর ভেতরে কাজ করে Performance বৃদ্ধি করে, তবে সঠিক Synchronization প্রয়োজন।

[/urcr_restrict]

Process VS Thread
What is Multithreading? Write Advantages and Disadvantages of Multithreading ( SBL, ADA-20

[urcr_restrict]

Multithreading is a technique in which multiple threads are created within a single process and executed concurrently. It allows a program to perform multiple tasks at the same time using shared resources.In multithreading, threads share the same Memory, Data, and Resources of the process, but each thread has its own Registers, Program Counter, and Stack. It improves system performance and responsiveness, especially in modern multi-core systems.

Advantages of Multithreading:

1. Improved Performance: Tasks run in parallel, increasing overall system speed.

2. Better Responsiveness: Applications remain responsive while performing background tasks.

3. Efficient Resource Sharing: Threads share memory and resources, reducing overhead.

4. Economical: Creating and managing threads is cheaper than processes.

Disadvantages of Multithreading:

1. Synchronization Problem: Requires proper synchronization to avoid data inconsistency.

2. Security Risk: Shared memory may cause security vulnerabilities.

3. Complex Debugging: Multithreaded programs are difficult to debug and maintain.

4. Deadlock Risk: Improper resource sharing may cause deadlocks.

In conclusion, Multithreading increases performance and responsiveness but requires careful synchronization and management.

Multithreading হলো এমন একটি পদ্ধতি যেখানে একটি Process-এর মধ্যে একাধিক Thread তৈরি করে একই সাথে (Concurrently) Execute করা হয়। এটি একটি Program-কে একই সময়ে একাধিক Task সম্পাদন করতে সহায়তা করে।

Multithreading-এ সকল Thread একই Memory, Data এবং Resource শেয়ার করে, তবে প্রতিটি Thread-এর নিজস্ব Registers, Program Counter এবং Stack থাকে। এটি বিশেষ করে Multi-core System-এ Performance ও Responsiveness বৃদ্ধি করে।

Multithreading-এর সুবিধাসমূহ:

১. Improved Performance: Parallelভাবে Task Execute করে System Speed বৃদ্ধি করে।

২. Better Responsiveness: Background Task চললেও Application Responsive থাকে।

৩. Efficient Resource Sharing: একই Memory ও Resource ব্যবহার করায় Overhead কম হয়।

৪. Economical: Process-এর তুলনায় Thread তৈরি ও পরিচালনা কম ব্যয়বহুল।

Multithreading-এর অসুবিধাসমূহ:

১. Synchronization Problem: সঠিক Synchronization না হলে Data Error হতে পারে।

২. Security Risk: Shared Memory কারণে Security ঝুঁকি থাকে।

৩. Complex Debugging: Multithread Program Debug করা কঠিন।

৪. Deadlock Risk: ভুল Resource Sharing-এর কারণে Deadlock হতে পারে।

সারসংক্ষেপে, Multithreading Performance ও Responsiveness বৃদ্ধি করে, তবে সঠিক Synchronization ও Management অত্যন্ত গুরুত্বপূর্ণ।

[/urcr_restrict]

Process Scheduling

You must subscribe & Login to view more.

Don’t have an account? Register

Or your subscription is under review by admin. Please message on WhatsApp / Telegram.

You must subscribe & Login to view more.

Don’t have an account? Register

Or your subscription is under review by admin. Please message on WhatsApp / Telegram.

Paging, Page Table, page Fault in OS

Paging in Operating System

Paging is a memory management technique where physical memory (RAM) is divided into fixed-size blocks called Frames and logical memory is divided into equal-sized blocks called Pages.

When a process executes, its pages are loaded into available frames in RAM. Paging helps efficient memory utilization and supports virtual memory.

Page Table

A Page Table is a data structure maintained by the operating system that stores the mapping between logical addresses (pages) and physical addresses (frames).

The operating system uses the page table to determine where a page is located in physical memory.

Page Fault

A Page Fault occurs when a process tries to access a page that is not currently available in physical memory (RAM).

In this situation:

  • The operating system checks the page table.
  • The required page is loaded from the hard disk into RAM.
  • The page table is updated.
  • Then the CPU continues execution.

Operating System-এ Paging

Paging হলো একটি memory management technique যেখানে physical memory (RAM)-কে fixed-size block-এ ভাগ করা হয়, যেগুলোকে Frames বলা হয় এবং logical memory-কে একই আকারের block-এ ভাগ করা হয়, যেগুলোকে Pages বলা হয়।

Process execute হওয়ার সময় এর pages available frame-এ load করা হয়। Paging efficient memory utilization এবং virtual memory support করতে সাহায্য করে।

Page Table

Page Table হলো একটি data structure যা operating system দ্বারা maintain করা হয় এবং logical address (page) ও physical address (frame)-এর mapping সংরক্ষণ করে।

Operating system page table ব্যবহার করে নির্ধারণ করে pageটি physical memory-এর কোন স্থানে রয়েছে।

Page Fault

Page Fault তখন ঘটে যখন কোনো process এমন একটি page access করতে চায় যা বর্তমানে physical memory (RAM)-এ নেই।

এই অবস্থায়:

  • Operating system page table পরীক্ষা করে।
  • প্রয়োজনীয় page hard disk থেকে RAM-এ load করা হয়।
  • Page table update করা হয়।
  • এরপর CPU পুনরায় execution চালিয়ে যায়।
Page Replacement Algorithm

A Page Replacement Algorithm is a technique used by the operating system to decide which page should be removed from physical memory (RAM) when a new page needs to be loaded and no free frame is available.

When a process requests a page that is not present in RAM, a Page Fault occurs. In this situation, the operating system must replace an existing page with the required new page.

The main goal of page replacement algorithms is to reduce the number of page faults and improve system performance

Examples of Page Replacement Algorithms

FIFO (First-In-First-Out) Page Replacement

In FIFO, the page that entered RAM first is removed first. It is simple and easy to implement.

LRU (Least Recently Used) Page Replacement

In LRU, the page that has not been used for the longest time is replaced. It gives better performance than FIFO in many cases.

LFU (Least Frequently Used) Page Replacement

In LFU, the page with the lowest usage frequency is removed. Frequently used pages are kept in memory.

Optimal Page Replacement

In Optimal algorithm, the page that will not be used for the longest future time is replaced.It produces the minimum number of page faults.

Page Replacement Algorithm হলো একটি technique যা operating system ব্যবহার করে নির্ধারণ করতে কোন page-টি physical memory (RAM) থেকে সরানো হবে, যখন নতুন page load করার জন্য কোনো free frame available থাকে না।

যখন কোনো process এমন page access করতে চায় যা RAM-এ নেই, তখন Page Fault ঘটে। এই অবস্থায় operating system-কে পুরোনো কোনো page remove করে নতুন page load করতে হয়।

Page replacement algorithm-এর মূল উদ্দেশ্য হলো page fault কমানো এবং system performance উন্নত করা।

Page Replacement Algorithm-এর উদাহরণ

FIFO (First-In-First-Out) Page Replacement

FIFO-তে যে page প্রথম RAM-এ প্রবেশ করে, সেটি প্রথম remove করা হয়। এটি simple এবং implement করা সহজ।

LRU (Least Recently Used) Page Replacement

LRU-তে যে page দীর্ঘ সময় ব্যবহার হয়নি সেটি replace করা হয়।অনেক ক্ষেত্রে এটি FIFO-এর তুলনায় ভালো performance দেয়।

LFU (Least Frequently Used) Page Replacement

LFU-তে সবচেয়ে কম ব্যবহৃত page remove করা হয়।যেসব page বেশি ব্যবহৃত হয় সেগুলো memory-তে রাখা হয়।

Optimal Page Replacement

Optimal algorithm-এ ভবিষ্যতে দীর্ঘ সময় ব্যবহার হবে না এমন page replace করা হয়।

এটি সর্বনিম্ন page fault তৈরি করে।

Consider page reference string 1, 3, 0, 3, 5, 6, 3 with 3-page frames. Find the number of page faults using FIFO Page Replacement Algorithm.

  • Initially, all memory slots are empty. So when pages 1, 3, and 0 arrive, they are loaded into the empty slots. Therefore, 3 Page Faults occur.
  • When page 3 arrives again, it is already present in memory. Therefore, 0 Page Fault occurs.
  • Then page 5 arrives. Since it is not available in memory, it replaces the oldest page, which is page 1. Therefore, 1 Page Fault occurs.
  • Next, page 6 arrives. It is also not available in memory, so it replaces the oldest page, which is page 3. Therefore, 1 Page Fault occurs.
  • Finally, page 3 arrives again. Since it is not present in memory, it replaces page 0. Therefore, 1 Page Fault occurs.
  • শুরুতে সব memory slot খালি থাকে। তাই যখন page 1, 3 এবং 0 আসে, তখন সেগুলো empty slot-এ load করা হয়। ফলে 3টি Page Fault ঘটে।
  • যখন আবার page 3 আসে, তখন এটি আগে থেকেই memory-তে থাকে। তাই 0টি Page Fault ঘটে।
  • এরপর page 5 আসে। যেহেতু এটি memory-তে নেই, তাই এটি সবচেয়ে পুরোনো page অর্থাৎ page 1-কে replace করে। ফলে 1টি Page Fault ঘটে।
  • এরপর page 6 আসে। এটিও memory-তে নেই, তাই এটি সবচেয়ে পুরোনো page অর্থাৎ page 3-কে replace করে। ফলে 1টি Page Fault ঘটে।
  • সবশেষে page 3 আবার আসে। যেহেতু এটি memory-তে নেই, তাই এটি page 0-কে replace করে। ফলে 1টি Page Fault ঘটে।
Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3 with 4-page frame. Find number of page fault using Optimal Page Replacement Algorithm.

  • Initially, all memory slots are empty. So when pages 7, 0, 1, and 2 arrive, they are loaded into the empty slots. Therefore, 4 Page Faults occur.
  • When page 0 arrives again, it is already present in memory. Therefore, 0 Page Fault occurs.
  • When page 3 arrives, it is not available in memory. According to the Optimal Page Replacement algorithm, page 7 is replaced because it will not be used for the longest duration in the future. Therefore, 1 Page Fault occurs.
  • When page 0 arrives again, it is already available in memory. Therefore, 0 Page Fault occurs.
  • When page 4 arrives, it replaces page 1 according to the optimal replacement rule. Therefore, 1 Page Fault occurs.
  • For the remaining page references, the required pages are already available in memory. Therefore, 0 Page Fault occurs.

Note:

Optimal Page Replacement gives the best possible result by producing the minimum number of page faults. However, it is not practically possible because the operating system cannot predict future page requests.

This algorithm is mainly used as a benchmark to compare the performance of other page replacement algorithms.

  • শুরুতে সব memory slot খালি থাকে। তাই যখন page 7, 0, 1 এবং 2 আসে, তখন সেগুলো empty slot-এ load করা হয়। ফলে 4টি Page Fault ঘটে।
  • যখন page 0 আবার আসে, তখন এটি আগে থেকেই memory-তে থাকে। তাই 0টি Page Fault ঘটে।
  • যখন page 3 আসে, তখন এটি memory-তে available থাকে না। Optimal Page Replacement algorithm অনুযায়ী page 7 replace করা হয়, কারণ ভবিষ্যতে এটি সবচেয়ে দীর্ঘ সময় ব্যবহার হবে না। ফলে 1টি Page Fault ঘটে।
  • যখন page 0 আবার আসে, তখন এটি আগে থেকেই memory-তে available থাকে। তাই 0টি Page Fault ঘটে।
  • যখন page 4 আসে, তখন optimal replacement rule অনুযায়ী এটি page 1-কে replace করে। ফলে 1টি Page Fault ঘটে।
  • পরবর্তী page reference-গুলোর জন্য প্রয়োজনীয় page আগে থেকেই memory-তে available থাকে। তাই 0টি Page Fault ঘটে।

Note:

Optimal Page Replacement সর্বনিম্ন page fault তৈরি করে সবচেয়ে ভালো result প্রদান করে। তবে বাস্তবে এটি implement করা সম্ভব নয়, কারণ operating system ভবিষ্যতের page request আগে থেকে জানতে পারে না।

এই algorithm মূলত অন্যান্য page replacement algorithm-এর performance তুলনা করার benchmark হিসেবে ব্যবহৃত হয়।

Consider the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3 with 4-page frames. Find number of page faults using LRU Page Replacement Algorithm.

  • Initially, all frames are empty. When pages 7, 0, 1, and 2 arrive, they are loaded into the empty frames. Therefore, 4 Page Faults occur.
  • When page 0 arrives again, it is already present in memory. Therefore, a Hit occurs and there is 0 Page Fault.
  • When page 3 arrives, it is not available in memory. According to the LRU algorithm, page 7 is replaced because it was the least recently used page. Therefore, 1 Page Fault occurs.
  • When page 0 arrives again, it is already available in memory. Therefore, a Hit occurs and there is 0 Page Fault.
  • When page 4 arrives, it is not available in memory. According to the LRU algorithm, page 1 is replaced because it was the least recently used page. Therefore, 1 Page Fault occurs.
  • For the remaining page references (2, 3, 0, 3, 2, 3), all pages are already available in memory. Therefore, only Hits occur and no additional page faults are generated.

Total Page Faults = 6

  • শুরুতে সব frame খালি থাকে। যখন page 7, 0, 1 এবং 2 আসে, তখন সেগুলো empty frame-এ load করা হয়। ফলে 4টি Page Fault ঘটে।
  • যখন page 0 আবার আসে, তখন এটি আগে থেকেই memory-তে থাকে। তাই একটি Hit ঘটে এবং 0টি Page Fault হয়।
  • যখন page 3 আসে, তখন এটি memory-তে available থাকে না। LRU algorithm অনুযায়ী page 7 replace করা হয়, কারণ এটি সবচেয়ে দীর্ঘ সময় ব্যবহার হয়নি। ফলে 1টি Page Fault ঘটে।
  • যখন page 0 আবার আসে, তখন এটি আগে থেকেই memory-তে available থাকে। তাই একটি Hit ঘটে এবং 0টি Page Fault হয়।
  • যখন page 4 আসে, তখন এটি memory-তে available থাকে না। LRU algorithm অনুযায়ী page 1 replace করা হয়, কারণ এটি সবচেয়ে কম recently used page ছিল। ফলে 1টি Page Fault ঘটে।
  • পরবর্তী page reference (2, 3, 0, 3, 2, 3)-গুলোর জন্য সব page আগে থেকেই memory-তে available থাকে। তাই শুধুমাত্র Hit ঘটে এবং নতুন কোনো page fault হয় না।

মোট Page Fault = 6

Topic Wise Question Bank
Operating System

You must subscribe & Login to view more.

Don’t have an account? Register

Or your subscription is under review by admin. Please message on WhatsApp / Telegram.

📘 Basic
1. What is an Operating System?
2. Which of the following is NOT a primary function of an Operating System?
3. To access operating system services applications primarily use _____________.
4. The main function of the command interpreter (shell) is _____________.
5. Which resource management techniques are used by an Operating System?
6. If a process terminates abnormally the operating system typically records the error in a _____________.
7. A process consists of _____________.
8. Which of the following is NOT stored in a process control block (PCB)?
9. A process may terminate because of _____________.
10. A process waiting for an event such as I/O completion is in the ____________ state."
11. Interprocess Communication (IPC) refers to _____________.
12. A set of processes is deadlocked when _____________.
13. Which system call waits for a child process to terminate?
14. The program counter contains _____________.
15. When a process issues an I/O request it is usually moved to the _____________.
16. Which scheduler selects processes from the job pool and loads them into memory?
17. Which scheduler selects the next process to execute on the CPU?
18. The primary function of the medium-term scheduler is _____________.
19. In a time-sharing system after its time quantum expires a running process moves to the ____________ state."
20. Multiprogramming means _____________.
21. After an I/O operation completes a blocked process moves to the ____________ state."
22. Which of the following does NOT directly interrupt a running process?
23. When multiple processes access shared data concurrently and the result depends on execution order it is called _____________.
24. Which state transition is NOT directly possible in the basic process state model?
25. A process that can affect or be affected by other executing processes is called a _____________.
26. A semaphore is a shared integer variable that ____________.
27. Process synchronization can be implemented using ____________.
28. A monitor is a synchronization construct that encapsulates ____________.
29. A reusable resource is a resource that ____________.
30. Which of the following is NOT one of the four necessary conditions for deadlock?
31. For maximum protection deadlock detection should be performed ____________.
32. An uninterruptible operation is called ____________.
33. Virtual memory allows memory to be shared among ____________.
34. The pager manages ____________.
35. Swap space is located in ____________.
36. A cache is primarily used to ____________.
37. Programs normally generate ____________.
38. Which memory management unit translates logical addresses into physical addresses?
39. Which memory management technique transfers pages between disk and RAM only when needed?
40. File system fragmentation occurs when ____________.
41. The ________ register is read by the host to receive input from an I/O device."
42. The ________ register is written by the host to send data to an output device."
43. The hardware mechanism that allows an I/O device to notify the CPU is called ____________."
44. Belady's Anomaly is associated with which operating system concept?
45. Which type of semaphore allows multiple processes to access a limited number of identical resources?
46. Which of the following are the three requirements for solving the Critical Section Problem?
47. Which memory is accessed fastest by the processor?
48. Which of the following is considered a system utility?
49. When a computer starts which loader is executed first?
50. Which type of operating system is designed for applications where response time is critical?
51. Which memory allocation strategy always allocates the largest available memory block?
52. What is the Working Set concept primarily used for?
53. What information is stored in a page table?
54. Memory compaction is used to ____________."
55. What is dispatch latency?
56. A page fault occurs when ____________."
📘 CPU Scheduling
57. CPU scheduling decisions may take place under which of the following circumstances?
58. Under non-preemptive scheduling once the CPU has been allocated to a process the process keeps the CPU until __________.
59. An I/O-bound program typically has __________.
60. A CPU-bound program typically has __________.
61. Whenever the CPU becomes idle the operating system selects a process from the __________.
62. The module that transfers CPU control to the process selected by the short-term scheduler is called the __________.
63. The time required for the dispatcher to stop one process and start another is called __________.
64. Which of the following are standard criteria for evaluating CPU scheduling algorithms?
65. We want to keep the CPU as busy as possible. This objective refers to maximizing __________.
66. The number of processes completed per unit time is called __________.
67. The interval from process submission to process completion is called __________.
68. The total time a process spends waiting in the ready queue is called __________.
69. The time from submitting a request until the first response is produced is called __________.
70. The primary objective of CPU scheduling is to __________.
71. Which CPU scheduling algorithm allocates the CPU to the process that arrives first?
72. Which of the following CPU scheduling algorithms is inherently non-preemptive?
73. Which scheduling algorithm may result in the convoy effect leading to long average waiting time?
74. Which scheduling algorithm selects the process with the shortest predicted CPU burst?
75. If two processes have the same predicted CPU burst in SJF scheduling the tie is usually broken using __________.
76. Which scheduling algorithm is also known as the shortest-next CPU-burst algorithm?
77. The Shortest Job First (SJF) scheduling algorithm can be __________.
78. Which scheduling algorithm is commonly used in long-term scheduling because it favors short jobs?
79. Which scheduling algorithm is provably optimal for minimizing average waiting time when CPU burst times are known?
80. Shortest Remaining Time First (SRTF) is the __________ version of SJF scheduling.
81. If the next CPU burst of a newly arrived process is shorter than the remaining burst of the currently running process which scheduling algorithm preempts the current process?
82. The __________ scheduling algorithm is a special case of the Priority Scheduling algorithm.
83. In which scheduling algorithm is a priority assigned to each process with the CPU allocated to the highest-priority process?
84. In Priority Scheduling processes with equal priority are usually scheduled using __________.
85. In Priority Scheduling based on CPU burst prediction which statement is correct?
86. The Priority Scheduling algorithm can be __________.
87. In preemptive Priority Scheduling the CPU is preempted when __________.
88. In non-preemptive Priority Scheduling a newly arrived process is placed at the __________.
89. Starvation (indefinite blocking) is a major drawback of which scheduling algorithm?
90. Which scheduling algorithm may leave low-priority processes waiting indefinitely?
91. What technique is commonly used to prevent starvation in Priority Scheduling?
92. Which statement correctly describes Aging?
93. Which scheduling algorithm is specifically designed for time-sharing systems?
94. The Round Robin (RR) scheduling algorithm is __________.
95. In Round Robin Scheduling a newly arrived process is inserted at the __________.
96. In which scheduling algorithm is the ready queue treated as a circular FIFO queue?
97. In Round Robin Scheduling if a process completes its CPU burst before the time quantum expires then __________.
98. In Round Robin Schedulingif a process does not finish before its time quantum expires then __________.
99. The performance of which scheduling algorithm depends heavily on the size of the time quantum?
📘 Deadlock
100. What is a reusable resource?
101. Which of the following conditions is required for a deadlock to be possible?
102. A system is in a safe state if ____________."
103. The circular wait condition can be prevented by ____________."
104. Which one of the following is a deadlock avoidance algorithm?"
105. What is the drawback of Banker's Algorithm?"
106. For an effective operating system when should deadlock detection be performed?"
107. A problem encountered in multitasking when a process is perpetually denied necessary resources is called ____________."
108. Which one of the following is a graphical method to determine deadlock occurrence?"
109. To avoid deadlock ____________."
110. The number of resources requested by a process ____________."
111. The request and release of resources are performed using ____________."
112. What are multithreaded programs with respect to deadlocks?"
113. For a deadlock to arise which of the following conditions must hold simultaneously?
114. For mutual exclusion to prevail in the system ____________."
115. For the Hold and Wait condition to prevail ____________."
116. Deadlock prevention is a set of methods ____________."
117. For non-shareable resources like a printer mutual exclusion ____________."
118. For shareable resources mutual exclusion ____________."
119. To ensure that the Hold and Wait condition never occurs ____________."
120. The disadvantage of allocating all required resources before execution is ____________."
121. The No Preemption condition can be prevented by ____________."
122. One way to ensure that the Circular Wait condition never holds is to ____________."
123. Each request requires that the system consider the ____________ before granting it."
124. Given prior knowledge of the ____________ resource requirements of each process deadlock avoidance algorithms can guarantee safety."
125. A deadlock avoidance algorithm dynamically examines the ____________."
126. A state is safe if ____________.
127. A system is in a safe state only if there exists a ____________.
128. All unsafe states are ____________.
129. If no cycle exists in the Resource Allocation Graph then ____________.
130. The Resource Allocation Graph algorithm is not applicable to a resource allocation system ____________.
131. The Banker's Algorithm is _____________ than the Resource Allocation Graph algorithm.
132. The data structures used in the Banker's Algorithm are ____________.
133. The content of the Need matrix is ____________.
134. The Wait-for Graph is applicable when ____________.
135. If the Wait-for Graph contains a cycle then ____________.
136. If deadlocks occur frequentlythe detection algorithm should be invoked ____________.
137. What is the disadvantage of invoking the deadlock detection algorithm for every resource request?
138. A deadlock eventually cripples system throughput and causes CPU utilization to ____________.
139. m' processes share 'n' identical resources. If the maximum need of each process does not exceed 'n' and the sum of all maximum needs is less than m + n then deadlock ____________.
140. A deadlock can be broken by ____________.
141. Which method is used to eliminate deadlock by aborting processes?
142. When selecting a process to abort during deadlock recovery preference should be given to the process whose termination ____________.
143. The process to be aborted during deadlock recovery is chosen based on ____________.
144. Cost factors for selecting a process for termination include ____________.
145. If a resource is preempted from a process the process must be ____________.
146. If resources are always preempted from the same process ____________ may occur.
147. What is the solution to starvation caused by repeated rollbacks?
148. A deadlock situation can arise if which of the following conditions hold simultaneously?
149. The condition where only one process can use a resource at a time is called ____________.
150. A process holding at least one resource while waiting for additional resources satisfies which deadlock condition?
151. The condition where resources cannot be forcibly taken from a process is called ____________.
152. A set of processes waiting in a circular chain for one another's resources represents ____________.
153. Deadlocks can be represented using a directed graph known as a ____________.
154. Deadlock prevention works by ____________.
155. Which protocol is used to eliminate the No Preemption condition?
156. A deadlock avoidance algorithm requires each process to declare the ____________ resources it may need.
157. A deadlock avoidance algorithm dynamically examines the ____________.
158. The resource allocation state consists of ____________.
159. A deadlock avoidance algorithm considers which information before granting a resource request?
📘 Must Read Memory Management
160. What memory management technique involves dividing the main memory into fixed-size partitions to accommodate multiple processes?
161. Which memory management technique involves moving entire processes between main memory and disk?
162. Which memory management technique uses logical division of memory into segments of variable sizes?
163. Which memory management technique involves breaking down processes into fixed-size blocks called pages?
164. What memory management technique combines features of both segmentation and paging?
165. Which technique allows execution of large programs by dividing them into smaller modules loaded into memory only when needed?
166. What technique involves linking libraries dynamically during program execution rather than at compile time?
167. What is the fundamental concept behind virtual memory?
168. Which technique involves loading pages into memory only when they are needed during program execution?
169. What is the primary advantage of partitioning in memory management?
170. Which memory management technique suffers from external fragmentation?
171. Which technique allows multiple processes to share the same memory space without interfering with each other?
172. Which memory management technique allows for efficient allocation of memory by dividing processes into equal-sized blocks?
173. What is the purpose of using overlays in memory management?
174. Which memory management technique requires moving processes between main memory and disk to balance system load?
175. What is the primary disadvantage of using dynamic linking and loading?
176. Which technique aims to reduce the initial loading time of large programs by loading only necessary portions into memory initially?
177. What is the key benefit of using virtual memory?
178. Which memory management technique involves dividing memory into variable-sized partitions based on program requirements?
179. What is a drawback of using overlays in memory management?
180. What is the purpose of a page table in paging?
181. Which type of fragmentation occurs in paging?
182. What is thrashing in virtual memory?
183. Which page replacement algorithm replaces the page that has not been used for the longest period?
184. What is the main advantage of the Optimal page replacement algorithm?
185. What does the Translation Lookaside Buffer (TLB) store?
186. Which page replacement algorithm may suffer from Belady's Anomaly?
187. What is internal fragmentation?
188. What is external fragmentation?
189. Which memory allocation strategy allocates the first free block that is large enough?
📘 Page Replacement Technique
190. When using counters to implement the LRU page replacement algorithm which page is replaced?
191. In the stack implementation of the LRU algorithm, which page is located at the bottom of the stack?
192. Which class of page replacement algorithms can never exhibit Belady's Anomaly?
193. Applying the LRU page replacement algorithm to the given reference string, how many page faults occur?
194. Increasing the RAM of a computer typically improves performance because ____________.
195. The essential content in each page table entry is the ____________.
196. The minimum number of page frames that must be allocated to a running process is determined by the ____________.
197. What is the rationale behind the LFU (Least Frequently Used) page replacement algorithm?
198. What is the rationale behind the MFU (Most Frequently Used) page replacement algorithm?
199. Why are the LFU and MFU page replacement algorithms rarely used in practice?
200. According to the optimal page replacement policy,which page should be replaced?
201. Which page replacement algorithm produces the minimum possible number of page faults?
202. In which page replacement algorithm is the page that entered memory first replaced first?
203. To implement the FIFO page replacement algorithm, the operating system must keep track of ____________.
204. To implement the Optimal page replacement algorithm, the operating system must know ____________.
205. To implement the LRU page replacement algorithm, the operating system must keep track of ____________.
206. Which page replacement algorithm is based on the principle of locality of reference?
207. To avoid Belady's Anomaly, a page replacement algorithm should satisfy the ____________.
208. Which page replacement algorithm satisfies the stack property?
209. Belady's Anomaly is associated with which page replacement algorithm?
210. Which statement correctly describes Belady's Anomaly?
211. Increasing the number of allocated page frames is most effective in reducing thrashing when using which page replacement algorithm?
212. Which page replacement algorithm uses a reference bit to determine whether a page has been recently accessed?
📘 Memory Management
213. What is address binding?
214. At which stage can instruction and data addresses be bound to memory?
215. If a process can be moved during execution from one memory location to another address binding must be ____________.
216. What is dynamic loading?
217. What is the main advantage of dynamic loading?
218. What is the primary purpose of overlays?
219. Who is responsible for designing and implementing the overlay structure?
220. Which operating system component is responsible for swapping processes in and out of memory?
221. What is the swapping technique called when a low-priority process is swapped out to allow a higher-priority process to execute?
222. If address binding is performed at assembly or load time, the process ____________ after being swapped out and back in.
223. In a system that does not support swapping the compiler normally binds symbolic addresses to ____________.
224. Which statement about overlays is correct?
225. The address generated by the CPU is called a ____________.
226. The address actually sent to memory hardware is called a ____________.
227. Which hardware component performs run-time address translation from logical to physical addresses?
228. The base register is also known as the ____________.
229. Without overlays or virtual memory the size of a process is limited by the size of ____________.
230. If execution-time binding is used a process ____________ be relocated after being swapped.
231. Swapping requires a ____________.
232. The backing store is typically ____________.
233. The ____________ contains all processes that are in memory or in the backing store and are ready to execute.
234. Which operation introduces significant overhead during swapping?
235. The largest portion of swapping time is usually spent on ____________.
236. Swapping ____________ be performed when a process has pending I/O operations directed to its own memory space.
237. Swap space is typically allocated ____________.
238. CPU fetches the next instruction according to the value of the ____________.
239. A memory buffer used to bridge the speed difference between the CPU and main memory is called ____________.
240. Which type of address is generated by the CPU?
241. Run-time mapping from logical addresses to physical addresses is performed by the ____________.
242. Which memory management technique retrieves pages from secondary storage into main memory when needed?
243. Which register stores the starting address of the page table?
244. A program normally works with ____________.
245. What information is primarily stored in a page table entry?
246. What is compaction?
247. The operating system maintains a separate page table for ____________.
248. The main memory accommodates ____________.
249. Where is the operating system typically located in memory?
250. In contiguous memory allocation ____________.
251. The relocation register helps in ____________.
252. With relocation and limit registers every logical address must be ____________ the value in the limit register.
253. The operating system and other processes are protected because ____________.
254. What is transient operating system code?
255. Using transient code ____________ the size of the operating system in memory during execution.
256. In fixed-size partition memory allocation each partition can contain ____________.
257. In fixed partition allocation the degree of multiprogramming is limited by ____________.
258. First Fit Best Fit and Worst Fit are strategies used to select a ____________.
259. In internal fragmentation the unused memory inside an allocated partition ____________.
260. What is the primary solution to external fragmentation?
261. Another solution to external fragmentation is to ____________.
262. If relocation is static and performed at assembly or load time compaction __________.
263. What is the main disadvantage of compaction?
264. Which memory allocation strategy is generally faster than Best Fit and Worst Fit?
265. When does external fragmentation occur?
266. Which allocation method completely avoids external fragmentation?
267. Sometimes the overhead of maintaining information about a memory hole may be __________.
268. When allocated memory is slightly larger than the process requirement __________ occurs.
269. Physical memory is divided into fixed-size blocks called __________.
270. Logical memory is divided into fixed-size blocks called __________.
271. A logical address generated by the CPU consists of __________.
272. The __________ is used as an index into the page table.
273. The __________ table contains the base address of each page in physical memory.
274. The size of a page is typically __________.
275. Paging eliminates __________ fragmentation.
276. The operating system maintains a __________ table to track allocated and free frames.
277. Paging increases the __________ overhead.
278. Small page tables are typically implemented using a set of __________.
279. The page table registers should be implemented using __________.
280. For large page tables stored in main memory a __________ points to the page table.
281. Each process has its own __________.
282. Accessing memory through the Page Table Base Register (PTBR) makes memory access __________.
283. Each entry in a Translation Lookaside Buffer (TLB) contains a __________.
284. If a requested page number is not found in the TLB it is called a __________.
285. An __________ uniquely identifies the address space of a process.
286. The percentage of page references found in the Translation Lookaside Buffer (TLB) is called ____________.
287. Memory protection in a paging system is implemented using ____________.
288. When the valid-invalid bit is set to valid it indicates that the associated page ____________.
289. Illegal memory addresses are detected using the ____________ bit.
290. For a very large logical address space which paging technique is most suitable?
291. In a paged memory system, the TLB hit ratio is 0.35. Memory access time is 10 ns, and a TLB miss requires an additional 100 ns. What is the effective memory access time?
292. Dynamic loading allows a routine to be loaded only when it is called. Which statement is correct?
293. If the page size is increased in a paging system, internal fragmentation generally ____________.
294. In segmentation, each logical address consists of ____________.
295. In paging, the CPU generates ____________, which the hardware divides into ____________ and ____________.
296. Each entry in a segment table contains a ____________.
297. The segment base contains the ____________.
298. The segment limit specifies the ____________.
299. The offset in a segmented address must be ____________.
300. If the offset is valid, it is ____________.
301. When two processes have segment table entries pointing to the same physical memory location, the segments are ____________.
302. The protection bit in a segment or page table typically determines whether access is ____________.
303. If there are 32 segments, each of size 1 KB, how many bits are required for the logical address?
304. A computer has 8 MB main memory and a 128 KB direct-mapped cache with a block size of 4 KB. How many main memory blocks map to a single cache block?
305. Why are multilevel page tables preferred over single-level page tables?
📘 Thrasing
306. A process is said to be thrashing if ____________.
307. Thrashing ____________ CPU utilization.
308. What is a locality in virtual memory?
309. When a subroutine is called, ____________.
310. A program is generally composed of several different localities, which ____________.
311. In the working-set model, if Δ = 10, what is the working set at time t₁ (…7 5 1) for the given reference string?
312. The accuracy of the working-set model depends on the selection of ____________.
313. If the working-set window is too small, ____________.
314. If the working-set window is too large, ____________.
315. If the sum of the working-set sizes exceeds the total number of available page frames, ____________.
📘 Process and Thread
316. What is a process?
317. What is a thread?
318. Which component of a process stores local variables and function calls?
319. Which memory area is shared among threads of the same process?
320. Which of the following is NOT shared among threads of the same process?
321. Who is responsible for creating a new process in Unix/Linux?
322. Which system call replaces the current process image with a new program?
323. Which system call waits for a child process to terminate?
324. What is the Process Control Block (PCB)?
325. Which process state indicates that a process is waiting for an event?
326. What is context switching?
327. Which scheduler selects the next process to run on the CPU?
328. Which scheduler controls the degree of multiprogramming?
329. What is multithreading?
330. What is the main advantage of multithreading?
331. Which of the following is true about processes and threads?
332. What happens when the main thread of a process terminates?
333. Which thread model allows many user-level threads to map to one kernel thread?
334. What is the main disadvantage of the Many-to-One thread model?
335. Which thread model is used by most modern operating systems?
WhatsApp Telegram Messenger