Podcast
Questions and Answers
What is the primary goal of multiprogramming?
What is the primary goal of multiprogramming?
- To have multiple processes waiting
- To ensure some process is always running (correct)
- To minimize the number of processes
- To decrease CPU utilization
In which process state is a process immediately after being created?
In which process state is a process immediately after being created?
- waiting
- ready
- running
- new (correct)
Which component of the Process Control Block (PCB) holds the memory location of the next instruction to be executed?
Which component of the Process Control Block (PCB) holds the memory location of the next instruction to be executed?
- CPU registers
- Memory-management information
- I/O status information
- Program counter (correct)
Within the process control block, which category contains information about the CPU usage time of a process?
Within the process control block, which category contains information about the CPU usage time of a process?
A process that is waiting for an I/O operation is in what state?
A process that is waiting for an I/O operation is in what state?
What is the main goal of time-sharing systems with respect to CPU usage?
What is the main goal of time-sharing systems with respect to CPU usage?
Which data in the process control block is directly involved in the context switch operation?
Which data in the process control block is directly involved in the context switch operation?
In priority scheduling, what does a lower integer value typically indicate?
In priority scheduling, what does a lower integer value typically indicate?
Which of the following is an example of an internally defined priority?
Which of the following is an example of an internally defined priority?
What is a primary disadvantage of using priority scheduling?
What is a primary disadvantage of using priority scheduling?
What is the purpose of 'aging' in the context of priority scheduling?
What is the purpose of 'aging' in the context of priority scheduling?
If a system uses a preemptive priority scheduling algorithm, what happens when a new process enters and has a higher priority than the currently running process?
If a system uses a preemptive priority scheduling algorithm, what happens when a new process enters and has a higher priority than the currently running process?
What is the primary role of the kthreadd
process?
What is the primary role of the kthreadd
process?
Which process manages clients that connect to the system using secure shell (SSH)?
Which process manages clients that connect to the system using secure shell (SSH)?
What does the login
process primarily handle?
What does the login
process primarily handle?
What resources might a child process require from the operating system?
What resources might a child process require from the operating system?
In terms of resource sharing between parent and child processes, which is NOT a typical model?
In terms of resource sharing between parent and child processes, which is NOT a typical model?
What are the two primary possibilities for the execution of a child process?
What are the two primary possibilities for the execution of a child process?
In UNIX systems, which system call is used to duplicate a process creating a child process?
In UNIX systems, which system call is used to duplicate a process creating a child process?
In UNIX, after a fork()
, which system call is typically used to replace the child process' memory space with a new program?
In UNIX, after a fork()
, which system call is typically used to replace the child process' memory space with a new program?
What is the purpose of the wait()
system call in the context of process creation?
What is the purpose of the wait()
system call in the context of process creation?
What happens to child processes when a parent process terminates without invoking wait()
?
What happens to child processes when a parent process terminates without invoking wait()
?
Which process in Linux/UNIX is responsible for adopting orphaned processes?
Which process in Linux/UNIX is responsible for adopting orphaned processes?
What is the main function of the init process regarding orphaned processes?
What is the main function of the init process regarding orphaned processes?
Which scenario describes an 'independent process'?
Which scenario describes an 'independent process'?
What defines a 'cooperating process'?
What defines a 'cooperating process'?
Which of the following is NOT a reason for providing an environment that supports process cooperation?
Which of the following is NOT a reason for providing an environment that supports process cooperation?
What is the main purpose of Inter-Process Communication (IPC)?
What is the main purpose of Inter-Process Communication (IPC)?
Which of the following is NOT a fundamental model of interprocess communication?
Which of the following is NOT a fundamental model of interprocess communication?
What is the primary mechanism employed in the shared-memory model of IPC?
What is the primary mechanism employed in the shared-memory model of IPC?
What is a disadvantage of shared memory model of interprocess communication?
What is a disadvantage of shared memory model of interprocess communication?
In a bounded buffer, what condition indicates that the buffer is full?
In a bounded buffer, what condition indicates that the buffer is full?
What is a critical advantage of message passing systems, especially in distributed environments?
What is a critical advantage of message passing systems, especially in distributed environments?
In message passing, which operations are fundamental for communication?
In message passing, which operations are fundamental for communication?
What is a characteristic of direct communication in message passing?
What is a characteristic of direct communication in message passing?
In direct communication, how is a communication link established?
In direct communication, how is a communication link established?
What is the implication of symmetry in addressing in direct communication?
What is the implication of symmetry in addressing in direct communication?
What is the main difference between symmetric and asymmetric addressing in the send primitive?
What is the main difference between symmetric and asymmetric addressing in the send primitive?
How does asymmetric addressing differ from symmetric addressing during message reception?
How does asymmetric addressing differ from symmetric addressing during message reception?
What is the purpose of the 'id' parameter in the receive(id, message)
primitive, under asymmetric addressing?
What is the purpose of the 'id' parameter in the receive(id, message)
primitive, under asymmetric addressing?
Under direct communication, how many links can exist between exactly two process pairs?
Under direct communication, how many links can exist between exactly two process pairs?
Flashcards
New Process State
New Process State
A process is in the "new" state when it is being created and not yet ready to be executed.
Running Process State
Running Process State
A process is in the "running" state when its instructions are being executed by the CPU.
Waiting Process State
Waiting Process State
A process is in the "waiting" state when it is paused and waiting for an event to occur, such as I/O completion or resource availability.
Ready Process State
Ready Process State
Signup and view all the flashcards
Terminated Process State
Terminated Process State
Signup and view all the flashcards
Process Control Block (PCB)
Process Control Block (PCB)
Signup and view all the flashcards
CPU Scheduling
CPU Scheduling
Signup and view all the flashcards
Orphan Process
Orphan Process
Signup and view all the flashcards
Init Process
Init Process
Signup and view all the flashcards
Independent Processes
Independent Processes
Signup and view all the flashcards
Cooperating Processes
Cooperating Processes
Signup and view all the flashcards
Interprocess Communication (IPC)
Interprocess Communication (IPC)
Signup and view all the flashcards
Shared Memory
Shared Memory
Signup and view all the flashcards
Message Passing
Message Passing
Signup and view all the flashcards
Priority Scheduling
Priority Scheduling
Signup and view all the flashcards
Preemptive Priority Scheduling
Preemptive Priority Scheduling
Signup and view all the flashcards
Non-preemptive Priority Scheduling
Non-preemptive Priority Scheduling
Signup and view all the flashcards
Starvation in Priority Scheduling
Starvation in Priority Scheduling
Signup and view all the flashcards
Aging in Priority Scheduling
Aging in Priority Scheduling
Signup and view all the flashcards
What is the kthreadd process?
What is the kthreadd process?
Signup and view all the flashcards
What is the sshd process?
What is the sshd process?
Signup and view all the flashcards
What is the login process?
What is the login process?
Signup and view all the flashcards
What are the resource sharing options for parent and child processes?
What are the resource sharing options for parent and child processes?
Signup and view all the flashcards
What are the two execution possibilities when a parent process creates a child?
What are the two execution possibilities when a parent process creates a child?
Signup and view all the flashcards
What are the two address-space possibilities for a child process?
What are the two address-space possibilities for a child process?
Signup and view all the flashcards
What are the fork() and exec() system calls used for?
What are the fork() and exec() system calls used for?
Signup and view all the flashcards
What is the wait() system call used for?
What is the wait() system call used for?
Signup and view all the flashcards
How many times will the provided program print 'yes'?
How many times will the provided program print 'yes'?
Signup and view all the flashcards
Bounded Buffer
Bounded Buffer
Signup and view all the flashcards
Empty Buffer
Empty Buffer
Signup and view all the flashcards
Full Buffer
Full Buffer
Signup and view all the flashcards
Send/Receive operations
Send/Receive operations
Signup and view all the flashcards
Direct Communication
Direct Communication
Signup and view all the flashcards
send(P, message)
send(P, message)
Signup and view all the flashcards
receive(Q, message)
receive(Q, message)
Signup and view all the flashcards
Asymmetric Communication
Asymmetric Communication
Signup and view all the flashcards
send(P, message)
send(P, message)
Signup and view all the flashcards
receive(id, message)
receive(id, message)
Signup and view all the flashcards
Study Notes
Introduction to KTU Notes
- KTU Notes is a learning companion providing KTU study materials, syllabus, live notifications, and solved question papers.
- The website address is www.ktunotes.in.
Module II: Processes and Process Scheduling
- This module covers processes, process control blocks, threads, scheduling, operations on processes, process creation, termination, inter-process communication, shared memory systems, and message passing systems.
- Basic concepts of process scheduling including scheduling criteria and algorithms are included.
- Specific algorithms covered include First Come First Served (FCFS), Shortest Job First (SJF), Priority Scheduling, and Round Robin Scheduling.
Processes
- A process is a program in execution.
- It includes program counter values, register contents, and variables.
- Conceptually, each process has its own virtual CPU.
- In reality, the CPU rapidly switches between processes, a concept called multiprogramming.
- Batch systems execute jobs, while time-shared systems handle user programs or tasks.
- A process has a text section (program code), current activity (program counter and processor registers), a stack (for temporary data like function parameters), a data section (for global variables), and a heap (for dynamically allocated memory).
Process Concept (Continued)
- A program becomes a process when the executable file is loaded into memory.
- Processes can be created through GUI clicks, command-line entries, or other methods.
- Multiple instances of a single program can run concurrently as separate processes.
- The data, heap, and stack sections of a process vary even if the text sections are equivalent.
Process State
- Processes change states as they execute: new, running, waiting, ready, and terminated.
- A diagram illustrating process states and transitions is included.
Process Control Block (PCB)
- Each process is represented by a PCB (also called a task control block).
- The PCB contains process state, process number, program counter, registers, memory limits, and a list of open files.
- The PCB also holds CPU-scheduling information (priority, pointers to scheduling queues) and memory-management information (base and limit registers or page tables).
- Additional information includes I/O status (allocated I/O devices, open files), accounting information (CPU and real time used, job/process numbers), and so on.
Process Control Block (Context Switch)
- A diagram illustrates the context switch process, where the operating system saves the state of the running process into its PCB and loads the state of the next process to run.
Process Scheduling
- Multiprogramming aims for maximum CPU utilization.
- Time-sharing allows multiple users to interact with programs concurrently.
- The process scheduler selects an available process for CPU execution.
- Only one process can run at a time on a single-processor system.
Scheduling Queues
- Processes enter the system into a job queue.
- Ready processes reside in a ready queue.
- Other queues exist for different devices (e.g., I/O device queues).
- A diagram of scheduling queues and their interactions is provided.
Scheduling Queues (Events)
- A process in execution may issue an I/O request, create a new child process, or be interrupted requiring it to be returned to the ready queue.
Schedulers
- The operating system uses different schedulers:
- Long-term scheduler (job scheduler): For batch systems; it selects processes from a pool and loads them into memory.
- Short-term scheduler (CPU scheduler): Selects processes from the ready queue to run on the CPU.
- Medium-term scheduler: Adds processes from memory to a swap area and back to memory, a technique called swapping.
Schedulers (Distinction)
- Short-term schedulers run more frequently than long-term schedulers.
- The CPU-bound processes may influence I/O-bound processes in a system.
Schedulers (I/O and CPU Bound)
- A process is either I/O-bound or CPU-bound.
- I/O-bound processes spend more time waiting for I/O, while CPU-bound processes use more CPU time.
- An appropriate mix of I/O-bound and CPU-bound processes leads to optimal system performance.
Medium-Term Scheduler
- The medium-term scheduler temporarily removes processes from memory (swapping).
- This creates space and allows other processes to run.
Context Switch
- When an interrupt occurs, the current process's context is saved, allowing the system to resume the process at a later time.
- The context includes CPU registers, process state, and memory-management information.
- Context switching is purely overhead.
Operations on Processes
- The operating system supports process creation and termination.
Process Creation
- A parent process creates child processes.
- A process tree illustrates the hierarchical relationship between processes.
- Each process has a unique process identifier (PID).
- Processes might share or not share resources (memory, files, etc.).
Process Termination
- A process ends by completing its final statement and using the exit() system call.
- The parent process can be notified of the child's exit status.
- The operating system deallocates the child's resources.
Process Termination-Cascading Termination
- Some systems require a child process to terminate when the parent terminates.
Process Termination-Zombie Process
- A terminated process whose parent hasn't yet received its exit status remains in the process table as a zombie process.
Process Termination-Orphans
- Orphans are child processes whose parent terminates without calling wait.
- The init process adopts orphans in Linux/UNIX systems.
Interprocess Communication
- Processes may be independent or cooperate.
- Independent processes are unaffected by each other; cooperating processes might share data.
- Mechanisms for cooperating processes include shared memory and message passing.
Shared-Memory Systems
- Shared memory allows processes to communicate by reading/writing to a common area of memory.
- The producer-consumer problem highlights the need for synchronization when multiple processes access shared resources.
- Two types of buffers for shared memory are unbounded and bounded.
Message-Passing Systems
- In message passing, processes communicate by exchanging messages.
- Two fundamental models for message passing: - direct and indirect.
- Message passing can be blocking or non-blocking, and buffering methods are used for communication.
CPU Scheduling
- The CPU scheduler selects a waiting process when the CPU is idle. This scheduler uses different scheduling algorithms.
- Common criteria include increasing CPU utilization, throughput, turnaround time, waiting time, and response time.
CPU Scheduling: Preemptive vs. Non-preemptive
- Preemptive scheduling allows interruption of running processes.
- Non-preemptive scheduling requires the process to release the CPU voluntarily.
- The dispatcher gives the CPU to the selected process. Specific scheduling algorithms exist for prioritizing processes, such as based on arrival time and burst time.
Scheduling Algorithms (FCFS)
- First-Come, First-Served (FCFS): Processes are executed in the order they arrive.
- FCFS can lead to the convoy effect if one long-running process blocks many shorter processes.
Scheduling Algorithms (SJF)
- Shortest Job First (SJF): The process with the shortest burst time is selected next.
- SJF can be either preemptive or non-preemptive.
Scheduling Algorithms (SRTF)
- Shortest Remaining Time First (SRTF) is a preemptive version of SJF.
- It prioritizes processes with the shortest remaining time.
Scheduling Algorithms (Priority)
- Priority scheduling gives higher priority to specific processes based on an assigned priority.
- Priority scheduling might lead to starvation of low-priority processes if they are consistently interrupted.
Scheduling Algorithms (Round Robin)
- Round Robin (RR): A time-slicing approach; each process gets a fixed time quantum.
- If a process's burst time is longer than q, it's moved to the end of the ready queue.
Threads
- A thread is a lightweight unit of execution within a process.
- Multiple threads within the same process share common resources (e.g., code, data, open files).
- Context switching between threads is faster than between processes.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge on key concepts of operating systems, focusing on multiprogramming, process control blocks, and scheduling algorithms. This quiz covers essential topics that are fundamental for understanding OS behavior and performance. Challenge yourself with questions about process states, CPU usage, and prioritization in scheduling.