Autumn 2026 All AIOU Solved Assignments, Key Books & 8613 Projects Live!
100% Free Online Reading • Copy & Download Disabled
AIOU LIBRARY KEY BOOK Course Code 3400 • BS Computer Science (BSCS) 🇬🇧 English Medium

AIOU Code 3400: Introduction to Computing — Complete Helping Key Book & Exam Guide

Read chapter-by-chapter summaries, solved self-assessment exercises, past paper long questions, and solved MCQs directly on AIOU Library. Free of cost for all AIOU students.

Published Units: 9 / 9 Units
← Course Hub

AIOU LIBRARY • READ ONLY

AIOULIBRARY.COM • CODE 3400

AIOU LIBRARY • DO NOT COPY

Unit 5 of 9 • Verified Key Book Authored by AIOU Library Academic Engine • 9191 Words

Unit 5: Operating System Fundamentals and Process Management

Part 1: Comprehensive Unit Summary & Core Concepts

Easy Chapter Introduction & Learning Objectives

Welcome to Unit 5 of Course 3400: Introduction to Computing. In our previous units, you learned about hardware parts like the CPU, RAM, and hard drives, as well as how application software helps us type documents or browse the internet. But have you ever wondered how all these hardware parts and software programs talk to each other without crashing? Who decides which program gets to use the processor first when you open five apps at the same time on your mobile phone or laptop? The answer is the Operating System (OS).

Think of the operating system as the chief manager or headmaster of a large school. The students are the application programs (like Microsoft Word, VLC Player, or WhatsApp), and the school resources (classrooms, playground, teachers) are the computer hardware (CPU, RAM, printer). Without a headmaster to create timetables, assign rooms, and keep order, the school would fall into complete chaos. Similarly, a computer cannot function efficiently without an operating system.

By the end of this comprehensive study guide, distance-learning students will be able to:

  • Define what an operating system is and explain how it has evolved from early command-line systems to modern graphical and mobile interfaces.
  • List and explain the core services provided by an operating system and differentiate between various user interfaces.
  • Understand the concept of a "process," how the operating system tracks it, and the lifecycle of process states.
  • Analyze how the CPU schedules multiple tasks using various standard algorithms.
  • Identify the dangerous condition known as "deadlock" and understand how systems prevent or handle it.
  • Explain the basics of memory management, physical vs. logical memory, and virtual memory.
  • Memorize key computing terms using our simple, student-friendly glossary.

Detailed Explanation of Every Unit Topic

1. Introduction and Evolution of Operating Systems

An Operating System (OS) is a specialized collection of system software that manages computer hardware resources and provides common services for computer programs. It acts as an essential intermediary between the user of a computer and the computer hardware.

To truly understand today’s sleek Windows, macOS, Linux, Android, and iOS systems, we must look at how operating systems evolved over several decades:

  • First Generation (1940s - Vacuum Tubes): There were no operating systems at all. Programmers wrote raw machine code using switches, plugging wires directly into plugboards to execute simple calculations. It was extremely slow and tedious.
  • Second Generation (1950s - Transistors & Batch Systems): Computers were extremely expensive, so companies used "Batch Processing." Jobs with similar needs were batched together on punch cards. An operator would load a batch of cards into the computer, and they would run sequentially without human intervention during execution.
  • Third Generation (1960s - Integrated Circuits & Multiprogramming): This era introduced Multiprogramming. If one job had to wait for an I/O operation (like reading a punch card or writing to a slow printer), the CPU would switch to another job instead of sitting idle. This drastically increased efficiency and introduced the concept of time-sharing.
  • Fourth Generation (1970s to Present - Personal Computers & Networks): The invention of microprocessors led to personal computers (PCs). Command-line interfaces (like MS-DOS) gave way to Graphical User Interfaces (GUIs) pioneered by Xerox, Apple, and Microsoft. Today, we live in the post-PC era of mobile operating systems (Android, iOS) and cloud-based operating systems.

2. Operating System Services and User Interfaces

The operating system provides several vital services to ensure that programs run smoothly and users can interact with the machine comfortably. Let us look at these services one by one:

  • Program Execution: The OS loads a program from secondary storage (like a hard disk) into main memory (RAM) and allocates necessary CPU time for it to run.
  • Input/Output (I/O) Operations: A program may require input from a keyboard, mouse, or microphone, and output to a screen or printer. The OS provides device drivers to manage these hardware interactions safely.
  • File System Manipulation: The OS helps users and programs create, read, write, delete, and organize files and directories (folders) on storage drives.
  • Communications: Processes running on the same computer, or even on different computers connected over a network, need to exchange information. The OS provides shared memory and message-passing facilities.
  • Error Detection: The OS constantly monitors the system for errors—such as a printer running out of paper, a memory allocation failure, or a network cable getting disconnected—and takes corrective action.
  • Resource Allocation: When multiple users or multiple jobs are running concurrently, resources (like CPU cycles, main memory, and storage space) must be allocated fairly and efficiently.

User Interfaces (UI): How do humans communicate with the operating system? Through user interfaces, which fall primarily into three categories:

  • Command-Line Interface (CLI): Users type textual commands using a keyboard (e.g., MS-DOS, Linux Terminal). It is fast and powerful for expert programmers, but difficult for beginners.
  • Graphical User Interface (GUI): Uses windows, icons, menus, and pointers (WIMP). Examples include Microsoft Windows, macOS, and Ubuntu desktop. It is user-friendly and requires little technical training.
  • Touch-Screen and Voice Interfaces: Modern smartphones and smart home devices (like Google Assistant or Apple Siri) use touch gestures and natural human speech for seamless operation.

3. Process Management and Process States

In computing, a Program is a passive entity—just a file sitting quietly on your hard disk containing instructions (e.g., C:\Program Files\Microsoft Office\WinWord.exe). However, a Process is an active entity. A process is a program in execution. When you double-click Microsoft Word, the operating system loads its code into RAM, assigns it memory space, opens security files, and turns it into a living process.

To manage multiple processes, the OS uses a Process Control Block (PCB). Think of a PCB as an official identity card (CNIC) for every process. It stores crucial information including:

  • Process ID (PID) and current Process State.
  • CPU registers and program counter (where the process left off).
  • Memory limits and allocated files.

The Five Process States: As a process executes, it moves through different states:

  • New: The process is currently being created.
  • Ready: The process has all its required resources and is waiting patiently in the ready queue to be assigned to the CPU.
  • Running: The CPU is actively executing the instructions of this process.
  • Waiting (Blocked): The process cannot continue running because it is waiting for some external event to occur (e.g., waiting for the user to type something, or waiting for a file to download from the internet).
  • Terminated (Finished): The process has finished execution and its PCB is cleaned up by the operating system.

4. CPU Scheduling Algorithms

In a system with a single CPU (or even multi-core systems), many processes compete for processor time. CPU Scheduling is the method by which the operating system decides which process gets the CPU next, for how long, and when it must step aside. The goal is to maximize CPU utilization, throughput, and minimize waiting time.

Here are the common CPU scheduling algorithms used by operating systems:

  • First-Come, First-Served (FCFS): The simplest algorithm. Whichever process arrives first in the ready queue gets the CPU first, exactly like people standing in a line at a utility bill payment window (e.g., NBP or Easypaisa shop).
    Drawback: The "Convoy Effect"—if a long process arrives first, all subsequent short processes have to wait a very long time.
  • Shortest-Job-First (SJF): The process with the smallest execution time is scheduled next. If two processes have the same time, FCFS is used. This minimizes overall waiting time, but it is difficult for the OS to accurately predict the exact CPU burst time of a new process beforehand.
  • Round Robin (RR): Designed specifically for time-sharing systems. Each process is given a small, fixed unit of CPU time called a Time Quantum (e.g., 10 milliseconds). If the process finishes within that time, it terminates. If it doesn't, the CPU is forcefully taken away, and the process is sent to the back of the ready queue. This ensures fair treatment for all tasks.
  • Priority Scheduling: Every process is assigned a priority number. The CPU is allocated to the process with the highest priority (lowest number or highest rank).
    Drawback: "Starvation" or indefinite blocking—low-priority processes might wait forever if high-priority processes keep arriving. (Operating systems solve this using Aging, where the priority of waiting processes increases over time).

5. Deadlock Characterization and Handling

Imagine two cars driving on a narrow single-lane bridge from opposite directions. They meet right in the middle. Car A cannot move forward because Car B is blocking it, and Car B cannot move forward because Car A is blocking it. If neither car backs up, they will remain stuck there forever. This exact scenario in computing is called a Deadlock.

Formally, a Deadlock is a situation where a set of blocked processes each hold a resource and wait for another resource acquired by some other process in the set, creating a permanent standstill.

The Four Necessary Conditions for Deadlock: For a deadlock to happen, all four of the following conditions must occur simultaneously:

  • Mutual Exclusion: At least one resource must be held in a non-shareable mode. Only one process can use the resource at a time (e.g., a printer).
  • Hold and Wait: A process must be currently holding at least one resource while waiting to acquire additional resources that are currently being held by other processes.
  • No Preemption: Resources cannot be forcibly taken away from a process. A resource can only be released voluntarily by the process holding it after it finishes its task.
  • Circular Wait: A closed chain of processes exists, such that process $P_0$ is waiting for a resource held by $P_1$, $P_1$ is waiting for $P_2$, and $P_N$ is waiting for $P_0$.

How Operating Systems Handle Deadlocks:

  • Deadlock Prevention: Design the system rules in such a way that at least one of the four necessary conditions can never happen.
  • Deadlock Avoidance: The operating system checks resource requests dynamically using algorithms (like the famous Banker's Algorithm) to ensure the system never enters an unsafe state.
  • Detection and Recovery: Allow the deadlock to happen, run algorithms periodically to detect it, and then recover by either aborting deadlocked processes or rolling back their states.

6. Memory Management and Virtual Memory Basics

The CPU cannot execute programs or read data directly from the hard disk or SSD; data must be loaded into the Main Memory (RAM) first. Memory Management is the operating system's responsibility to keep track of every byte in RAM, allocate memory space when a new program starts, and free up that space when the program closes.

Logical vs. Physical Address Space:

  • Logical Address (Virtual Address): Generated by the CPU; it is the address that the user program sees and refers to.
  • Physical Address: The actual physical location in the RAM memory chips where data is stored.
    Note: A hardware device called the Memory Management Unit (MMU) translates logical addresses into physical addresses on the fly.

Virtual Memory Basics: What happens when your computer has 4GB of RAM, but you open a heavy video editing software and multiple web browser tabs that require 6GB of memory combined? Does the computer crash? No! Thanks to Virtual Memory.

Virtual memory is a memory management technique where the operating system makes a portion of secondary storage (hard disk or SSD) look and act like extra RAM. This allocated disk space is often called the Page File (in Windows) or Swap Space (in Linux).

  • Memory is divided into fixed-size blocks called Pages (in logical memory) and Frames (in physical RAM).
  • When RAM is full, the OS moves inactive pages of a program out of RAM and onto the hard disk. This process is called Paging or Swapping Out.
  • When the CPU needs those inactive pages again, the OS brings them back into RAM (Swapping In). If the CPU requests a page that is not currently in RAM, a Page Fault occurs, prompting the OS to fetch it from disk storage.

Key Terms & Easy Glossary

  • Operating System (OS): A collection of system software that manages computer hardware, coordinates resource allocation, and provides common services for application programs. It acts as the primary bridge between human users and computer machinery.
  • Process: A program currently loaded into main memory and actively executing under the supervision of the operating system. Unlike a passive file stored on a hard drive, a process has a state, memory allocations, and CPU registers.
  • Process Control Block (PCB): A specialized data structure maintained by the operating system for every active process, storing vital details such as Process ID (PID), current process state, CPU registers, and memory limits.
  • Context Switching: The rapid procedure performed by the CPU where it saves the state (context) of a currently running process so it can be paused, and loads the saved state of another waiting process to resume its execution.
  • CPU Scheduling: The method and collection of algorithms used by an operating system to decide which process in the ready queue gets access to the processor next, maximizing system throughput and responsiveness.
  • Time Quantum: A small, fixed unit of time (typically measured in milliseconds) assigned to each process in a Round Robin scheduling algorithm before the operating system preempts it and assigns the CPU to another task.
  • Deadlock: An unfortunate system condition where two or more processes are permanently blocked because each holds a resource and waits for another resource held by another process in the group.
  • Banker’s Algorithm: A classic resource allocation and deadlock avoidance algorithm that tests safety states before granting resource requests, ensuring the system never falls into an unrecoverable deadlock.
  • Virtual Memory: A clever memory management scheme that bridges physical RAM and secondary storage (hard disk/SSD), allowing computers to run applications requiring more memory than is physically installed on the motherboard.
  • Page Fault: An interrupt or exception raised by hardware when a running program requests an address on a page that is not currently loaded into physical RAM, forcing the operating system to retrieve it from disk storage.
Part 2: Solved Self-Assessment & Short Questions

Q: Define an operating system and explain its primary dual role as a resource manager and extended machine.

Easy Answer: An Operating System (OS) is a critical piece of system software that acts as an intermediary between the computer hardware and the user applications. Without an OS, every software program would need to know the intricate details of how the hardware works, which would make programming nearly impossible. The operating system performs two main, fundamental roles: acting as a resource manager and functioning as an extended (or virtual) machine.

  • Role 1: The Resource Manager
    • Definition: A computer system possesses limited physical resources—such as CPU time, computer memory (RAM), storage space (Hard Disk/SSD), and input/output (I/O) devices like keyboards, mice, and printers.
    • Function: The OS manages these hardware resources fairly and efficiently. When multiple programs run at the same time, the OS decides which program gets access to the CPU, how much memory is allocated to each application, and manages data flow to peripheral devices to prevent conflicts.
    • Example: If Microsoft Word and Google Chrome both want to print a document at the same time, the OS resource manager intercepts both requests, places them in a print queue, and sends them to the printer one by one.
  • Role 2: The Extended (or Virtual) Machine
    • Definition: Raw computer hardware is extremely complex, requiring developers to write low-level machine instructions to control circuits, read disk sectors, or manage voltages.
    • Function: The OS hides this low-level complexity by providing a clean, simple, and abstract interface (the extended machine). It presents users and programmers with easy-to-use concepts, such as "files," "folders," and "windows," rather than raw memory addresses and disk tracks.
    • Example: To save a file, a programmer does not need to know the physical geometry of the hard disk or which magnetic sector to flip. They simply call a high-level OS command like save_file(), and the OS handles the complex hardware details behind the scenes.

Q: Differentiate between batch operating systems, time-sharing systems, and real-time operating systems.

Easy Answer: Operating systems have evolved over decades to meet different computing needs. Three major historical and functional categories are batch operating systems, time-sharing systems, and real-time operating systems.

  • 1. Batch Operating Systems
    • Concept: In early computing, jobs with similar needs were grouped together into "batches" and executed one after another without human interaction during processing. Users would submit punched cards to an operator, who loaded them into the computer.
    • Characteristics: There is no direct interaction between the user and the job while it is running. Turnaround time can be very long (hours or days).
    • Example: Payroll processing or large-scale billing systems run overnight in batches.
  • 2. Time-Sharing Systems (Multitasking)
    • Concept: Time-sharing is a logical extension of multiprogramming where the CPU switches rapidly among multiple users or programs based on small slices of time (time quanta).
    • Characteristics: Because the CPU switches so fast (in milliseconds), it creates an illusion to each user that they have the entire computer to themselves, allowing for interactive computing.
    • Example: Modern multi-user server environments or a desktop computer running multiple apps simultaneously (browsing the web while listening to music and typing).
  • 3. Real-Time Operating Systems (RTOS)
    • Concept: RTOS are used in specialized environments where data must be processed within a strict, predefined time constraint (deadlines). If the system misses the deadline, catastrophic failure can occur.
    • Characteristics: Highly deterministic response times. Divided into Hard Real-Time (missing a deadline is fatal) and Soft Real-Time (missing a deadline reduces performance but is tolerable).
    • Example: Air traffic control systems, anti-lock braking systems (ABS) in cars, and medical pacemakers.

Q: What are system calls? Explain how they act as an interface between user programs and the operating system.

Easy Answer: A system call is a programmatic method used by a running user application to request a service from the operating system kernel. Modern operating systems operate in two distinct CPU modes: User Mode (restricted access where user applications run) and Kernel Mode (privileged mode where core OS functions run). User programs cannot directly access hardware or critical system resources; they must use system calls to bridge this gap.

  • How System Calls Act as an Interface:
    • Step 1 (User Request): A user application needs to perform a privileged operation, such as reading a file from the hard disk, sending data over a network, or allocating memory. The application invokes a high-level function (e.g., `open()`, `read()`, `fork()`).
    • Step 2 (Mode Switch): The programming language library puts the parameters of the request into specific CPU registers and triggers a software interrupt (often called a trap or system call instruction). This forces the CPU to switch from User Mode to Kernel Mode.
    • Step 3 (Kernel Execution): The OS kernel receives the request, examines the parameters, and performs the requested operation safely on behalf of the user program (since the kernel has full hardware access).
    • Step 4 (Return to User): Once the operation is complete, the kernel places the results in registers, clears the privileged state, switches the CPU back to User Mode, and returns control to the user program.
  • Categories of System Calls:
    • *Process Control:* Create/terminate processes (e.g., `exec()`, `exit()`).
    • *File Management:* Create, read, write, and delete files (e.g., `open()`, `read()`, `close()`).
    • *Device Management:* Request or release physical devices (e.g., `read()`, `write()`).
    • *Information Maintenance:* Get system data, time, or process attributes.

Q: Draw and explain the standard five-state process lifecycle model.

Easy Answer: In an operating system, a process is a program in execution. Throughout its lifetime, a process transitions through various distinct states managed by the OS scheduler. The standard five-state process model includes the New, Ready, Running, Waiting (Blocked), and Terminated states.

  • 1. New State
    • The process is currently being created, but it has not yet been admitted to the pool of executable processes by the operating system. Memory and resources are being allocated.
  • 2. Ready State
    • The process has been loaded into main memory and is fully prepared to execute. It is waiting for the CPU scheduler to assign it a processor core. Multiple processes can be in the ready state simultaneously.
  • 3. Running State
    • The CPU scheduler has selected the process, and its instructions are actively being executed by the CPU. (Note: In a single-core system, only one process can be in the running state at any given microsecond).
  • 4. Waiting (Blocked) State
    • A running process enters this state if it encounters an event that prevents it from continuing immediately, such as waiting for I/O completion (e.g., reading from a disk) or waiting for a hardware signal. Even if the CPU becomes free, the process cannot run until this event occurs.
  • 5. Terminated (Exit) State
    • The process has finished execution (either successfully or due to an error). The operating system deallocates its memory, releases its resources, and destroys its Process Control Block (PCB).
  • State Transitions Summary:
    • *New ➔ Ready:* Admitted by the OS.
    • *Ready ➔ Running:* Dispatched by the CPU scheduler.
    • *Running ➔ Ready:* Interrupt occurs (time slice expires) or preempted.
    • *Running ➔ Waiting:* I/O request or resource wait.
    • *Waiting ➔ Ready:* I/O completion or resource available.
    • *Running ➔ Terminated:* Program completion.

Q: Explain the concept of CPU scheduling and distinguish between preemptive and non-preemptive scheduling.

Easy Answer: CPU scheduling is the method by which the operating system decides which process gets control of the CPU when multiple processes are in the ready state. Because computer systems often run dozens of background and foreground tasks concurrently, but a CPU core can generally execute only one instruction stream at a time, efficient scheduling is vital to maximize system throughput, minimize response time, and ensure fairness.

  • Non-Preemptive Scheduling
    • Definition: Once the CPU has been allocated to a process, that process keeps the CPU until it voluntarily releases it—either by terminating or by switching to the waiting state (e.g., waiting for I/O).
    • Characteristics: The OS cannot forcibly take the CPU away from a running process. It is simple to implement and has low scheduling overhead.
    • Drawback: A long-running process can monopolize the CPU, causing poor response times for interactive user applications waiting in the queue.
    • Example Algorithm: First-Come, First-Served (FCFS) in its pure form.
  • Preemptive Scheduling
    • Definition: The operating system has the authority to forcibly suspend ("preempt") a currently running process and allocate the CPU to another process.
    • Characteristics: Processes are typically assigned a fixed time slice (quantum). When the time slice expires, a hardware timer interrupts the CPU, and the running process is moved back to the ready queue.
    • Advantage: Ensures fair sharing of the CPU and excellent responsiveness, making it essential for modern multi-tasking and interactive operating systems.
    • Example Algorithms: Round Robin (RR), Shortest Remaining Time First (SRTF).

Q: What is a deadlock? List the four necessary conditions required for a deadlock to occur.

Easy Answer: A deadlock is a permanent blocking situation in an operating system where a set of processes are indefinitely blocked because each process holds a resource and is waiting for another resource that is being held by another process in the same set. Since none of the processes can move forward, the system enters a freeze state for those tasks.

  • The Four Necessary Conditions for Deadlock:

    For a deadlock to occur, all four of the following conditions must hold simultaneously in the system:

    • 1. Mutual Exclusion: At least one resource must be held in a non-shareable mode. Only one process can use the resource at any given instant. If another process requests that resource, the requesting process must be delayed until the resource is released.
    • 2. Hold and Wait: A process must be currently holding at least one resource while simultaneously waiting to acquire additional resources that are currently being held by other processes.
    • 3. No Preemption: Resources cannot be forcibly taken away from a process. A resource can be released only voluntarily by the process holding it after that process has completed its task.
    • 4. Circular Wait: A closed chain of processes must exist, such that process $P_0$ is waiting for a resource held by $P_1$, $P_1$ is waiting for a resource held by $P_2$, and $P_n$ is waiting for a resource held by $P_0$.

Q: Define the term 'Operating System' in the context of computer hardware and software interaction.

Easy Answer: In the context of computer architecture, an Operating System (OS) is the master control program that bridges the gap between raw physical hardware (CPU, memory, storage devices) and user application software (browsers, word processors, games). Hardware provides the raw computing power, but it has no intelligence to execute user tasks on its own. The OS interacts directly with the hardware via device drivers and presents a simplified, secure, and abstract environment to software applications. It ensures that multiple software programs share hardware resources safely, preventing conflicts and system crashes.

Q: What is the difference between multi-programming and multi-tasking?

Easy Answer: Multi-programming and multi-tasking are both techniques to run more than one program, but they differ in objective and mechanism. Multi-programming focuses on CPU utilization; multiple jobs are loaded into memory so that when one process waits for I/O, the CPU switches to another process, preventing the CPU from sitting idle. Multi-tasking (also called time-sharing) is a logical extension of multi-programming designed for user interaction. It uses rapid context switching based on time slices (quanta) so that multiple programs appear to execute simultaneously, giving users real-time interactive control over each running application.

Q: List the major functions of an operating system kernel.

Easy Answer: The kernel is the core, foundational component of an operating system that runs in privileged mode (kernel mode) and has direct access to system hardware. Its major functions include:

  • Process Management: Creating, scheduling, suspending, and terminating processes and threads.
  • Memory Management: Allocating and deallocating RAM and managing virtual memory paging.
  • Device Management (I/O): Controlling hardware devices through device drivers.
  • File System Management: Organizing, reading, writing, and securing files on storage media.
  • Security and Access Control: Enforcing protection mechanisms and user permissions.

Q: What is a Process Control Block (PCB)? What essential information does it store?

Easy Answer: A Process Control Block (PCB)—also called a task control block—is a data structure maintained by the operating system for every active process. It serves as the "birth certificate" and repository for all information the OS needs to manage and track a specific process. Essential information stored in a PCB includes:

  • Process ID (PID): A unique identification number for the process.
  • Process State: Current status (Ready, Running, Waiting, etc.).
  • Program Counter (PC): The address of the next instruction to be executed for this process.
  • CPU Registers: Stored register values used when pausing and resuming execution.
  • Memory Management Information: Base/limit registers, page tables, or segment tables.
  • Accounting and I/O Status Information: CPU usage time, limits, and list of allocated I/O devices or open files.

Q: Define throughput and turnaround time in CPU scheduling.

Easy Answer:

  • Turnaround Time: This is the total time elapsed from the exact moment a process is submitted to the system until the time it completes execution. It includes time spent waiting in memory queues, waiting for I/O, and actual CPU execution time. Formula: $\text{Turnaround Time} = \text{Completion Time} - \text{Submission Time}$.
  • Throughput: This is a measure of system productivity defined as the total number of processes that complete their execution per unit of time (e.g., 50 processes per minute). A higher throughput indicates a more efficient CPU scheduling algorithm.

Q: What is context switching? Why does it incur overhead?

Easy Answer: A context switch is the mechanism where the operating system stops the currently running process, saves its current state (in its PCB), loads the saved state of a newly selected process, and resumes its execution.

Why it incurs overhead: Context switching requires pure system administration work rather than actual user computation. The CPU must save all register values, update memory pointers, manipulate queue structures, and flush or reload caches. During this time, the CPU cannot execute any useful application instructions, which consumes precious clock cycles and reduces overall system performance if done too frequently.

Q: Briefly explain the First-Come, First-Served (FCFS) scheduling algorithm.

Easy Answer: First-Come, First-Served (FCFS) is the simplest CPU scheduling algorithm. It operates strictly on a non-preemptive queue basis: the process that requests the CPU first is allocated the CPU first.

Key Characteristics:

  • Implemented easily using a First-In, First-Out (FIFO) queue.
  • Non-preemptive: Once a process gets the CPU, it runs to completion.
  • Major Drawback: Suffers from the Convoy Effect, where small, quick processes get stuck waiting behind a single large, CPU-bound process, resulting in poor average waiting times.

Q: What is the role of a short-term scheduler (CPU scheduler)?

Easy Answer: The short-term scheduler (commonly known as the CPU scheduler) is an operating system component that selects a process from the pool of ready-in-memory processes and allocates the CPU core to it. Its main responsibilities include:

  • Deciding which ready process should run next.
  • Executing frequently (milliseconds) because processes constantly transition between running, waiting, and ready states.
  • Maximizing CPU utilization and maintaining fair execution times across interactive and batch tasks.

Q: Differentiate between logical address space and physical address space.

Easy Answer:

  • Logical Address Space: This is the set of all virtual addresses generated by the CPU while a program is running. It is the view seen by the user application and programmer. Logical addresses do not represent actual physical RAM locations.
  • Physical Address Space: This refers to the actual, concrete set of physical memory addresses available in the computer's memory hardware (RAM chips).

    Difference: The operating system uses a hardware component called the Memory Management Unit (MMU) to translate logical addresses generated by the CPU into corresponding physical addresses in real-time during program execution.

Q: What is thrashing in virtual memory systems?

Easy Answer: Thrashing is a severe performance degradation state in a virtual memory operating system where the computer spends more time paging data in and out of secondary storage (swap space/disk) than it does executing actual application instructions.

Cause: It happens when the total memory requirement of active processes exceeds the actual physical RAM available. The OS constantly swaps pages back and forth, leading to high disk activity, unresponsive systems, and near-zero CPU productivity.

Part 3: Detailed Exam Long Questions (20-Marks Standard)

Long Question: Discuss in detail the evolution of operating systems from early batch systems to modern distributed and mobile operating systems, highlighting key architectural milestones.

An Operating System (OS) acts as an essential bridge between computer hardware and the end user. Over the past eight decades, computer hardware has evolved rapidly from room-filling vacuum-tube machines to lightning-fast multi-core smartphones. To keep pace with these hardware advances, operating systems have also undergone a massive evolutionary transformation. Understanding this evolution is crucial for grasping how modern computing environments manage complex resources, maintain security, and deliver seamless user experiences.

1. Serial Processing and Early Computers (1940s–1950s)

  • Direct Hardware Control: Early computers like the ENIAC had no operating systems. Programmers interacted directly with the raw hardware using mechanical switches, plugboards, and punched cards.
  • Single User Setup: Only one user could access the machine at a time, spending hours setting up wires and loading paper tapes.
  • Extreme Inefficiency: The CPU often sat idle for hours while human operators loaded cards or debugged physical wiring errors, leading to very low productivity.

2. Simple Batch Processing Systems (Mid-1950s–1960s)

  • Introduction of Monitors: To minimize human intervention, early computer scientists developed simple batch monitors—the earliest form of an OS.
  • Job Sequencing: Jobs with similar requirements (e.g., Fortran programs) were punched onto cards and stacked together as a "batch."
  • Automatic Job Transition: When one job finished execution, the monitor automatically loaded the next job from the batch into memory, drastically reducing setup time.

3. Multiprogrammed Batch Systems (1960s)

  • The CPU Idle Problem: Even in batch systems, the CPU often paused while waiting for slow mechanical I/O operations (like reading punched cards or writing to tape printers).
  • Memory Partitioning: Multiprogramming allowed multiple user jobs to reside in main memory simultaneously.
  • Resource Maximization: When one job requested an I/O operation, the OS quickly switched the CPU to execute another ready job, keeping processor utilization high.

4. Time-Sharing (Multitasking) Systems (1960s–1970s)

  • Interactive Computing: Time-sharing is a logical extension of multiprogramming where multiple users interact with the system simultaneously via dedicated terminals.
  • CPU Multiplexing: The OS allocates very small slices of CPU time (time quanta) to each user in rapid succession.
  • Illusion of Dedicated Access: Because the CPU switches between users in milliseconds, every user feels they have continuous, dedicated access to the computer system.

5. Personal Computer (PC) Operating Systems (1980s–1990s)

  • Rise of Microprocessors: Advances in silicon chips made affordable desktop computers (like the IBM PC and Apple Macintosh) widely available.
  • Graphical User Interfaces (GUIs): Command-line interfaces were replaced by intuitive windows, icons, menus, and pointers (WIMP).
  • Single-User Convenience: OS software shifted focus toward personal productivity applications, hardware peripheral plug-and-play support, and local file management.

6. Multiprocessor and Parallel Systems (1990s–Present)

  • Multiple Processing Cores: Modern computers feature systems with two, four, or dozens of CPU cores sharing physical memory and system bus lines.
  • Parallel Processing: Advanced operating systems can split a single heavy task into smaller threads and distribute them across multiple cores simultaneously.
  • Fault Tolerance: If one processor core fails, symmetric multiprocessing (SMP) operating systems can isolate the failure and reassign workloads to healthy cores.

7. Distributed Operating Systems (1990s–Present)

  • Autonomous Computers: Distributed systems connect independent, physically separate computers over local or wide-area networks (LAN/WAN).
  • Unified System Image: To the user, a distributed OS makes a collection of networked computers look like a single powerful virtual supercomputer.
  • Resource Sharing: Users can effortlessly share massive files, execute remote calculations, and balance workloads across data centers worldwide.

8. Real-Time Operating Systems (RTOS)

  • Strict Time Constraints: Unlike general-purpose OSs that prioritize throughput, an RTOS guarantees deterministic response times for critical tasks.
  • Hard vs. Soft Real-Time: Hard RTOS guarantees deadlines are never missed (used in pacemakers and aircraft flight controllers), while soft RTOS tolerates occasional minor delays (used in live video streaming).
  • Predictable Scheduling: Interrupt handling and priority inversion management are optimized for instantaneous, reliable execution.

9. Mobile Operating Systems (2000s–Present)

  • Handheld Revolution: Smartphones and tablets introduced unique hardware constraints, including limited battery life, restricted physical memory, and wireless connectivity.
  • Modern Examples: Android and iOS dominate the mobile landscape, providing robust touch-screen event handling and aggressive power management.
  • App Sandboxing: Mobile operating systems strictly isolate application memory spaces to enhance overall security, privacy, and system stability.

10. Cloud-Based and Virtualized Operating Systems

  • Virtualization: Hypervisors (Type-1 and Type-2) allow multiple guest operating systems to run concurrently on a single physical host server.
  • Cloud Computing: Modern OS architectures extend directly into elastic cloud clusters (e.g., AWS, Microsoft Azure), scaling computing resources dynamically on demand.
  • Containerization: Lightweight virtualization platforms like Docker share the host OS kernel while packaging application dependencies into isolated software containers.

Summary / Exam Conclusion

The evolution of operating systems is a remarkable story of continuous innovation driven by hardware advancements and changing user needs. From primitive serial switches in the 1940s to intelligent mobile platforms and distributed cloud systems today, operating systems have consistently evolved to make computing faster, safer, and more accessible. As emerging technologies like quantum computing and edge AI develop, operating systems will continue to transform, cementing their vital role in digital civilization.

Long Question: Explain the five-state process model with the help of a well-labeled diagram. Discuss all possible state transitions and the events that trigger them.

In operating systems, a process is defined as a program in execution. To manage multiple processes efficiently, the operating system tracks their exact lifecycle status using a standard model. The most widely adopted process model is the Five-State Process Model, which describes the distinct stages a process passes through from its initial creation until final termination. Understanding these states and their triggering events is fundamental to understanding process management and CPU scheduling.

1. Overview of the Five-State Process Model

  • Core Concept: At any given instant, a process must reside in one of five distinct operational states: New, Ready, Running, Waiting (Blocked), or Terminated.
  • OS Tracking: The operating system uses data structures called Process Control Blocks (PCBs) to record the current state of every active process in the system.
  • Dynamic Nature: Processes constantly shift between these states in response to interrupts, scheduler dispatches, and I/O requests.

2. Visualizing the Five-State Model (Text-Based Diagram)

  [New] 
    |
    v (Admitted)
  [Ready] <====== (Interrupt / Time-out) =====+
    |                                         |
    | (Dispatcher / Scheduler Dispatch)       |
    v                                         |
  [Running]                                   |
    |      \                                  |
    |       \ (I/O or Event Completion)       |
    |        +--------------------------------+
    |
    | (I/O or Event Wait)
    v
  [Waiting / Blocked]
    |
    v (Exit / Completed)
  [Terminated]

3. The New State

  • Definition: The initial state of a process when it has just been created (e.g., a user double-clicks an application icon) but has not yet been admitted to the main memory pool by the operating system.
  • Resource Allocation: The OS is typically setting up the process control block and preparing memory management structures for the program.
  • Everyday Example: Selecting a video editor installation file and clicking "Open"; the program exists on the hard drive and is starting its initialization phase.

4. The Ready State

  • Definition: The process has been loaded into main memory and possesses all necessary resources to execute, but it is currently waiting for the CPU scheduler to assign it processor time.
  • Queue Placement: Ready processes reside in a specialized data structure called the Ready Queue.
  • Everyday Example: Several background utility apps are open on your smartphone, loaded in RAM, and waiting patiently for the processor core to handle their tasks.

5. The Running State

  • Definition: The process has been selected by the CPU scheduler (dispatcher), and its instructions are currently being executed by the processor core.
  • Single-Core Limit: On a single-core CPU, only **one** process can be in the running state at any exact microsecond.
  • Everyday Example: The active browser tab where you are currently typing text is being actively executed by the CPU.

6. The Waiting (or Blocked) State

  • Definition: A process temporarily halts execution because it is waiting for an external event to occur or for an I/O operation (like reading a file from disk or waiting for network packets) to complete.
  • CPU Efficiency: By moving an idle process to the waiting state, the OS frees up the CPU to run other ready processes.
  • Everyday Example: Downloading a large file in a browser; the download task blocks until data packets arrive from the remote internet server.

7. The Terminated (or Exit) State

  • Definition: The process has finished executing all its instructions or has been forcefully aborted by the operating system due to an error.
  • Cleanup Phase: The OS removes the process from active memory, closes its open file handles, and deletes its Process Control Block.
  • Everyday Example: Closing a completed document in Microsoft Word and clicking "Don't Save"; the application process is completely wiped from active memory.

8. State Transition: New to Ready (Admitted)

  • Trigger Event: Long-term scheduler admission.
  • Explanation: When the operating system determines there is enough memory capacity to accommodate a newly created process, it moves the process from the New state into the Ready state.

9. State Transition: Ready to Running (Dispatcher / Scheduler Dispatch)

  • Trigger Event: CPU Scheduler selection.
  • Explanation: When the currently running process finishes its time slice or blocks, the dispatcher selects the highest-priority process from the ready queue and loads its registers into the CPU.

10. State Transition: Running to Ready (Interrupt / Time-out)

  • Trigger Event: Timer interrupt expiration.
  • Explanation: In time-sharing systems, if a process exceeds its allocated time quantum (e.g., 10 milliseconds), a hardware timer interrupts the CPU, forcing the running process back to the Ready queue.

11. State Transition: Running to Waiting (I/O or Event Request)

  • Trigger Event: System call for I/O or resource wait.
  • Explanation: If a running process requests a slow disk read, user keyboard input, or network transmission, it cannot proceed further, so it voluntarily moves to the Waiting state.

12. State Transition: Waiting to Ready (I/O or Event Completion)

  • Trigger Event: Hardware interrupt indicating task completion.
  • Explanation: Once the requested disk read or network packet finishes arriving, an interrupt alerts the OS, which moves the process from Waiting back to the Ready queue.

13. State Transition: Running to Terminated (Exit)

  • Trigger Event: Program completion or fatal error.
  • Explanation: When the final instruction of the program executes successfully or encounters an unhandled fatal error (like division by zero), the process enters the Terminated state.

Summary / Exam Conclusion

The five-state process model is the backbone of modern operating system design. By categorizing processes into New, Ready, Running, Waiting, and Terminated states, the OS can maintain optimal CPU utilization, ensure fair resource distribution, and handle multiple concurrent user programs smoothly. Mastering these state transitions is essential for understanding advanced computing concepts like thread management, multitasking, and scheduling algorithms.

Long Question: Compare and contrast FCFS, Shortest Job First (SJF), and Round Robin CPU scheduling algorithms with suitable examples and calculate their average waiting times.

CPU scheduling is a vital operating system function that decides which process in the ready queue is allocated to the CPU next. Efficient scheduling maximizes processor utilization, minimizes response times, and ensures fairness among user applications. To understand how scheduling works, we must analyze and compare three classic scheduling algorithms: First-Come, First-Served (FCFS), Shortest Job First (SJF), and Round Robin (RR), complete with practical numerical calculations.

1. Introduction to CPU Scheduling Algorithms

  • Objective: CPU schedulers choose from among the ready processes in memory and allocate a CPU core to one of them.
  • Non-Preemptive vs. Preemptive: Non-preemptive algorithms let a process keep the CPU until it finishes or blocks, whereas preemptive algorithms can forcibly yank the CPU away from a running process.
  • Evaluation Metrics: Algorithms are evaluated using metrics such as Waiting Time (time spent waiting in the ready queue) and Turnaround Time (total time from submission to completion).

2. First-Come, First-Served (FCFS) Scheduling

  • Definition: FCFS is the simplest CPU scheduling algorithm where the process that requests the CPU first gets allocated the CPU first.
  • Implementation: It is naturally implemented using a simple First-In, First-Out (FIFO) queue data structure.
  • Non-Preemptive Nature: Once a process enters the CPU, it runs to completion without interruption, which can lead to the infamous Convoy Effect (short processes stuck behind long ones).

3. FCFS Numerical Example and Waiting Time Calculation

  • Problem Setup: Consider three processes with CPU burst times given in milliseconds (ms), arriving at time $t = 0$:
    • Process $P_1$: Burst Time = 24 ms
    • Process $P_2$: Burst Time = 3 ms
    • Process $P_3$: Burst Time = 3 ms
  • Execution Order: $P_1 \rightarrow P_2 \rightarrow P_3$
  • Waiting Time Calculations:
    • Waiting time for $P_1 = 0$ ms
    • Waiting time for $P_2 = 24$ ms (waits for $P_1$ to finish)
    • Waiting time for $P_3 = 24 + 3 = 27$ ms (waits for $P_1$ and $P_2$)
  • Average Waiting Time: $(0 + 24 + 27) / 3 = 51 / 3 = \mathbf{17.0\text{ ms}}$.

4. Shortest Job First (SJF) Scheduling

  • Definition: SJF associates each process with the length of its next CPU burst. The algorithm schedules the process with the smallest burst time first.
  • Optimality: SJF is mathematically proven to give the minimum average waiting time for a given set of processes.
  • Variants: SJF can be non-preemptive (current job finishes) or preemptive (also known as Shortest Remaining Time First or SRTF).
  • Practical Limitation: It is impossible to know exact future CPU burst lengths in advance, making SJF difficult to implement in general-purpose operating systems.

5. SJF Numerical Example and Waiting Time Calculation

  • Problem Setup: Consider the same three processes arriving at time $t = 0$:
    • Process $P_1$: Burst Time = 6 ms
    • Process $P_2$: Burst Time = 8 ms
    • Process $P_3$: Burst Time = 7 ms
    • Process $P_4$: Burst Time = 3 ms
  • Execution Order (Sorted by Shortest Burst): $P_4 \rightarrow P_1 \rightarrow P_3 \rightarrow P_2$
    • $P_4$ runs from 0 to 3 ms.
    • $P_1$ runs from 3 to 9 ms.
    • $P_3$ runs from 9 to 16 ms.
    • $P_2$ runs from 16 to 24 ms.
  • Waiting Time Calculations:
    • Waiting time for $P_4 = 0$ ms
    • Waiting time for $P_1 = 3$ ms
    • Waiting time for $P_3 = 3 + 6 = 9$ ms
    • Waiting time for $P_2 = 3 + 6 + 7 = 16$ ms
  • Average Waiting Time: $(0 + 3 + 9 + 16) / 4 = 28 / 4 = \mathbf{7.0\text{ ms}}$ (significantly lower than FCFS).

6. Round Robin (RR) Scheduling

  • Definition: Round Robin is designed specifically for time-sharing systems. It is similar to FCFS, but preemption is added to switch between processes.
  • Time Quantum: A small unit of CPU time, called a time quantum or time slice (typically 10 to 100 milliseconds), is defined.
  • Circular Queue: The ready queue is treated as a circular FIFO queue. The CPU scheduler goes around the queue, allocating the CPU to each process for a maximum of one time quantum.

7. Round Robin Numerical Example and Waiting Time Calculation

  • Problem Setup: Consider three processes arriving at $t = 0$ with a Time Quantum = 4 ms:
    • Process $P_1$: Burst Time = 24 ms
    • Process $P_2$: Burst Time = 3 ms
    • Process $P_3$: Burst Time = 3 ms
  • Execution Sequence:
    • $P_1$ runs for 4 ms (Remaining: 20 ms)
    • $P_2$ runs for 3 ms and finishes at $t = 7$ ms (Remaining: 0 ms)
    • $P_3$ runs for 3 ms and finishes at $t = 10$ ms (Remaining: 0 ms)
    • $P_1$ resumes and runs for its remaining 20 ms, finishing at $t = 30$ ms.
  • Waiting Time Calculations:
    • $P_1$ waited from time 0 to 4 (while $P_2$ and $P_3$ ran), so Waiting Time = $10 - 4 = 6$ ms.
    • $P_2$ waited from time 4 to 7, so Waiting Time = $4$ ms.
    • $P_3$ waited from time 7 to 10, so Waiting Time = $7$ ms.
  • Average Waiting Time: $(6 + 4 + 7) / 3 = 17 / 3 = \mathbf{5.67\text{ ms}}$.

8. Detailed Comparison of FCFS, SJF, and Round Robin

  • Preemption: FCFS and standard SJF are non-preemptive; Round Robin and Shortest Remaining Time First are strictly preemptive.
  • Fairness: Round Robin offers the highest interactivity and fairness; FCFS suffers from convoy effects penalizing short jobs; SJF penalizes long jobs.
  • Overhead: FCFS has minimal overhead; Round Robin requires context-switching overhead dependent on the chosen time quantum size.

Summary / Exam Conclusion

CPU scheduling algorithms dictate how effectively a computer utilizes its processor resources. While FCFS is easy to implement, it leads to poor waiting times. SJF achieves optimal average waiting times but remains practically difficult due to unknown future burst times. Round Robin strikes an ideal balance for modern interactive operating systems by employing a time quantum to ensure fair, responsive multitasking for all active users and applications.

Long Question: Define deadlock. Discuss the strategies used by operating systems to handle deadlocks, focusing on deadlock prevention and deadlock avoidance techniques.

In operating systems, resource management is a complex balancing act. When multiple concurrent processes compete for limited system resources (such as memory blocks, disk drives, printers, or communication channels), a catastrophic blocking state known as deadlock can occur. A deadlock halts system productivity entirely, locking processes in a permanent state of waiting. Operating systems employ sophisticated strategies—specifically prevention and avoidance—to neutralize this threat.

1. Definition of Deadlock

  • Formal Definition: A deadlock is a permanent blocking of a set of processes because each process is holding a resource and waiting for another resource acquired by some other process in the same set.
  • Classic Analogy: Imagine two cars meeting on a single-lane bridge from opposite directions. Neither car can move forward because the other is blocking the path, and neither car can back up due to traffic behind them. Both drivers wait forever.
  • Deadlock vs. Starvation: Starvation means a process waits indefinitely because other processes keep taking priority, whereas deadlock means a group of processes is permanently frozen in circular dependence.

2. The Four Necessary Conditions for Deadlock

According to research by E.G. Coffman Jr., a deadlock can only occur if all four of the following conditions hold simultaneously in the system:

  • Mutual Exclusion: At least one resource must be held in a non-shareable mode; only one process can use the resource at any given time.
  • Hold and Wait: A process must currently hold at least one resource while waiting to acquire additional resources that are being held by other processes.
  • No Preemption: Resources cannot be forcibly taken away from a process; a resource can be released only voluntarily by the process holding it after task completion.
  • Circular Wait: A closed chain of processes must exist, where process $P_0$ waits for a resource held by $P_1$, $P_1$ waits for $P_2$, and $P_N$ waits for $P_0$.

3. Overview of Operating System Deadlock Strategies

Operating systems deal with the deadlocks using three primary approaches:

  • Ignorance (Ostrich Algorithm): Pretend deadlocks never occur and let the user reboot if one happens (used by Windows and Linux for general user tasks).
  • Detection and Recovery: Let deadlocks happen, detect them using resource allocation graphs, and recover by aborting processes or rolling back transactions.
  • Prevention and Avoidance: Design the system protocol to actively prevent or avoid deadlocks before they can ever form.

4. Deadlock Prevention: Attacking Mutual Exclusion

  • Spooling Resources: By making resources shareable, we eliminate mutual exclusion.
  • Everyday Example: Printers enforce mutual exclusion, causing job blocks. However, operating systems use print spoolers to intercept print jobs and write them to a hard disk queue. The printer daemon then feeds the files sequentially, eliminating direct printer lockouts.

5. Deadlock Prevention: Attacking Hold and Wait

  • Protocol Rule: The operating system requires each process to request and be allocated all its required resources at once before it begins execution.
  • Alternative Rule: A process is only allowed to request new resources when it currently holds zero resources (it must release everything first).
  • Drawback: Resource utilization is very low because a process might tie up a printer for hours while waiting for a rare file scanner to become free.

6. Deadlock Prevention: Attacking No Preemption

  • Protocol Rule: If a process holding certain resources requests another resource that cannot be immediately allocated to it, the OS forcibly preempts (takes away) all currently held resources.
  • State Restoration: The preempted resources are added to the waiting list of resources, and the process restarts only when it regains all old and new resources.
  • Application: This works well for easily saved and restored states, such as CPU registers and memory contents.

7. Deadlock Prevention: Attacking Circular Wait

  • Global Resource Ordering: Assign a unique numerical integer index to every resource type in the system.
  • Strict Request Rule: Processes can only request resources in an strictly increasing order of enumeration indices.
  • Mathematical Proof: If resource $R_i$ has index $i$ and $R_j$ has index $j$, a process cannot request $R_i$ if it already holds $R_j$ where $j \geq i$, breaking the circular wait chain completely.

8. Deadlock Avoidance: The Safe State Concept

  • Definition: Deadlock avoidance requires the operating system to have a priori information about how resources will be requested throughout the lifetime of every process.
  • Safe vs. Unsafe States: A state is safe if the operating system can allocate resources to each process in some strict order without entering a deadlock. An unsafe state is not necessarily a deadlock, but it can lead to one if processes request their maximum declared resources.
  • Core Objective: The OS must refuse any resource request that would transition the system from a safe state into an unsafe state.

9. Deadlock Avoidance: The Banker’s Algorithm

  • Algorithm Name: Named after banking systems where a banker will never allocate cash loans in a way that leaves the bank unable to satisfy all customers' maximum credit limits.
  • Data Structures Maintained:
    • *Available*: Vector of currently free resources of each type.
    • *Max*: Matrix defining the maximum demand of each process.
    • *Allocation*: Matrix of currently allocated resources to each process.
    • *Need*: Matrix indicating the remaining resource needs of each process ($\text{Need} = \text{Max} - \text{Allocation}$).
  • Execution Safety Check: Before approving any resource request, the Banker's algorithm runs a simulation to find a "safe sequence" of processes. If a safe sequence exists, the request is granted; otherwise, the process must wait.

Summary / Exam Conclusion

Deadlocks represent a severe threat to multi-processing stability, freezing resources and paralyzing system performance. By understanding the four Coffman conditions (Mutual Exclusion, Hold and Wait, No Preemption, and Circular Wait), operating system architects can implement robust defense mechanisms. Deadlock prevention disables at least one of these four conditions, while deadlock avoidance uses predictive algorithms like the Banker's algorithm to ensure the system never enters an unsafe state, guaranteeing smooth and reliable computing operations.

Part 4: Solved Multiple Choice Questions (MCQs)

MCQ #1 What is the primary role of an Operating System?

To provide word processing
To manage hardware and software resources
To design website layouts
To compile high-level code

MCQ #2 Which of the following was a feature of early batch operating systems?

Interactive user interface
Real-time data processing
Execution of jobs in groups without manual intervention
Graphical user interface

MCQ #3 Which OS service is responsible for loading a program into memory and running it?

Program execution
I/O operations
File-system manipulation
Accounting

MCQ #4 What does a Command Line Interface (CLI) rely on for user interaction?

Icons and mouse clicks
Touch gestures
Text commands typed by the user
Voice recognition

MCQ #5 What is a 'Process' in the context of operating systems?

A physical computer chip
A program in execution
A storage device partition
A type of system cable

MCQ #6 Which process state indicates that a process is waiting for some event to occur, such as I/O completion?

Running
Ready
Waiting (Blocked)
Terminated

MCQ #7 Which CPU scheduling algorithm assigns the CPU to the process with the smallest CPU burst time?

First-Come, First-Served (FCFS)
Shortest-Job-First (SJF)
Round Robin
Priority Scheduling

MCQ #8 In the Round Robin scheduling algorithm, what is allocated to each process?

Permanent CPU ownership
A fixed time quantum
The highest priority level
Unlimited memory space

MCQ #9 What is a Deadlock in an operating system?

When a computer crashes permanently due to a virus
A situation where processes are blocked waiting for resources held by each other
When the CPU runs too fast
A failure in the power supply unit

MCQ #10 Which of the following is NOT one of the four necessary conditions for a deadlock?

Mutual exclusion
Hold and wait
Preemption
Circular wait

MCQ #11 What is the primary purpose of Memory Management in an OS?

To speed up internet connectivity
To allocate and deallocate memory space efficiently
To clean dust from RAM sticks
To increase monitor resolution

MCQ #12 What is Virtual Memory?

Memory created inside the CPU cache
A technique that uses secondary storage as an extension of main memory
RAM made of plastic instead of silicon
Cloud storage accessible via Wi-Fi

MCQ #13 What is 'Thrashing' in virtual memory management?

When the CPU spends more time paging than executing instructions
When hard disks spin too fast
When a user deletes too many files
When the system runs out of power

MCQ #14 Which hardware component manages the translation of virtual addresses to physical addresses?

Arithmetic Logic Unit (ALU)
Memory Management Unit (MMU)
Graphics Processing Unit (GPU)
Control Unit (CU)

MCQ #15 Which scheduling algorithm can suffer from the 'convoy effect', where short processes wait behind a long CPU-bound process?

Round Robin
Shortest-Job-First
First-Come, First-Served (FCFS)
Priority Scheduling

Manage Cookie Preferences

Strictly Necessary Cookies

Required for consent storage and site security.

Always Active

View full details in our Cookies Policy & Privacy Policy.