module 2 Flashcards

1
Q

Q26-2: How is the Gantt chart built in FCFS?

A

Order processes strictly by arrival time and run each to completion before the next.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Q15-6: How does the PCB track I/O status?

A

It keeps track of I/O devices assigned to the process and the status of pending I/O requests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Q19-6: How do processes synchronize in IPC?

A

They use semaphores, mutexes, condition variables, or blocking message calls.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Q26-3: Why can FCFS lead to the convoy effect?

A

Long processes arriving first can delay all shorter processes behind them, increasing waiting times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q23-4: What is bounded waiting?

A

There must be a limit on the number of times other processes can enter their critical sections before a waiting process gets a turn.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Q23-6: Give an example of a race condition.

A

Two processes incrementing a shared counter simultaneously could overwrite each other’s updates if not synchronized.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q17-1: What is a process in an OS context?

A

A process is a program in execution, consisting of code, data, and its current state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Q22-7: What are common pitfalls with semaphores?

A

Improper usage can cause deadlocks, starvation, or priority inversion if signals and waits are not carefully managed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Q20-6: Which model is simpler to implement in distributed systems?

A

Message passing is simpler for distributed environments, as it doesn’t rely on shared physical memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Q28-3: How do we handle arrival times in non-preemptive SJF?

A

We pick the shortest job from the ready queue once the current job finishes; we only look at processes that have arrived.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Q17-5: What is the data section of a process?

A

It contains global variables and static data used by the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Q23-2: Why is mutual exclusion needed?

A

Without mutual exclusion, concurrent access can lead to inconsistent data or race conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Q17-4: How is the execution state maintained?

A

Registers, program counter, and other CPU states define the current execution context.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Q27-1: What is Round Robin (RR) scheduling?

A

Round Robin uses a time quantum and cycles through processes in the ready queue, giving each a small CPU slice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Q25-6: What is turnaround time?

A

Turnaround time is the total time from process arrival to its completion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Q21-7: Why might a system have both schedulers?

A

Using both allows fine-grained control of CPU allocation (short-term) and overall workload balance (long-term).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Q20-4: Which model requires more synchronization?

A

Shared memory requires explicit synchronization to avoid race conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Q28-7: Why do we need to estimate burst times?

A

Exact burst times may be unknown, so we rely on historical or predicted CPU usage for SJF.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Q23-5: How can we implement mutual exclusion?

A

Using locks, semaphores, monitors, or hardware instructions like Test-and-Set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Q22-5: How do semaphores achieve mutual exclusion?

A

By ensuring only one process can decrement a binary semaphore to 0, blocking others from entering the critical section.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
26
Q22-6: How do semaphores solve the producer-consumer problem?
They use two semaphores to track empty and full slots, plus a mutex for mutual exclusion of the buffer.
27
Q21-1: What is the long-term (job) scheduler?
It decides which jobs are admitted to the system for processing and controls the degree of multiprogramming.
28
Q18-1: What are the main process states?
Common states include New, Ready, Running, Waiting (Blocked), and Terminated.
29
Q27-4: How is waiting time calculated in RR?
It is the total time a process spends in the ready queue, considering all preemptions.
30
Q25-3: In a priority scheduling example, what is needed?
We need each process's arrival time, burst time, and priority to construct a Gantt chart.
31
Q29-5: Can SJF cause starvation?
Yes; longer jobs may never run if short jobs keep arriving, especially in preemptive mode.
32
Q18-4: Describe the Running state.
A process is actively executing on the CPU in the Running state.
33
Q18-5: When does a process enter the Waiting state?
It enters Waiting when it must wait for an event, such as I/O completion or a signal.
34
Q15-5: What memory info is found in the PCB?
It may store base and limit registers, page tables, or segment tables used for memory management.
35
Q15-1: What is a Process Control Block (PCB)?
A PCB is a data structure that stores information about a specific process; it includes process state, PID, CPU registers, and more.
36
Q27-2: How does the time quantum affect RR?
A small quantum improves response time but increases context switches; a large quantum behaves like FCFS.
37
Q27-3: What is context switching in RR?
When a process's time quantum expires, the CPU context switches to the next ready process.
38
Q29-7: How to choose between FCFS and SJF?
FCFS is simple but less efficient; SJF is more efficient but needs burst time estimation and may cause starvation.
39
Q15-3: Which key fields are stored in a PCB?
It typically contains process state, process ID, program counter, CPU registers, memory management info, accounting info, and I/O status.
40
Q16-4: What is shared memory in IPC?
Shared memory allows multiple processes to access a common memory segment; synchronization primitives prevent conflicts.
41
Q22-1: What is a semaphore?
A semaphore is a synchronization tool used to manage concurrent processes and control resource access.
42
43
Q22-4: How does the signal (V) operation work?
It increments the semaphore; if processes are waiting, one is unblocked.
44
Q18-6: What leads to the Terminated state?
A process enters Terminated after finishing execution or being killed by the OS.
45
Q17-2: What key components define a process?
A process has program code, data section, stack, heap, and PCB with execution context.
46
Q16-7: How is synchronization handled in IPC?
Synchronization is achieved through blocking sends and receives, semaphores, mutexes, or condition variables to avoid race conditions.
47
Q29-4: Which algorithm typically yields lower waiting times?
SJF usually achieves lower waiting times, especially for short jobs.
48
Q19-7: Give an example of an IPC use-case.
A producer-consumer system uses shared memory or message queues to pass data between processes safely.
49
Q29-1: What is FCFS scheduling?
FCFS serves processes in arrival order, without preemption; can lead to long average waiting times.
50
Q26-4: How do we calculate waiting time in FCFS?
Waiting time = Start time - Arrival time, or TAT - Burst time.
51
Q16-6: When are sockets used for IPC?
Sockets are used for network communication or inter-process communication on the same or different machines.
52
Q17-3: Why is resource ownership important for a process?
A process may own resources like CPU time, memory, and I/O devices, which are tracked and protected by the OS.
53
Q27-6: What happens if a process finishes before its time quantum?
It releases the CPU early, and the scheduler picks the next process without waiting for the quantum to end.
54
Q25-5: What is waiting time in scheduling?
Waiting time is the time a process spends in the ready queue before executing.
55
56
Q21-5: What is the difference in selection criteria?
Long-term focuses on job mix and resource requirements; short-term focuses on CPU burst times, priority, etc.
57
Q24-2: How does a monitor enforce mutual exclusion?
Only one process can be active inside the monitor at a time, enforced by the compiler or runtime.
58
Q26-6: What happens if two processes arrive simultaneously?
They are typically scheduled in the order they appear in the queue or by PID if not specified.
59
Q25-2: How is priority determined?
It can be set by the system, user, or dynamically adjusted based on factors like CPU usage or aging.
60
Q21-3: What is the short-term (CPU) scheduler?
It selects from the ready queue which process gets the CPU next.
61
Q18-3: What happens in the Ready state?
A process is ready to run but waiting for CPU scheduling.
62
Q24-6: Give a common example of a monitor.
The bounded buffer monitor, which controls producer-consumer interactions using condition variables.
63
Q20-5: How is synchronization handled in message passing?
Often built-in with blocking sends/receives or non-blocking with explicit checks.
64
Q20-1: What is shared memory in IPC?
Shared memory allows multiple processes to access the same region of physical memory.
65
Q18-7: How do transitions occur between these states?
Transitions occur via events like scheduler dispatch (Ready to Running), I/O completion (Waiting to Ready), or process exit (Running to Terminated).
66
Q26-1: What is FCFS scheduling?
First Come First Served schedules processes in the order they arrive; no preemption occurs.
67
Q24-3: What are condition variables in a monitor?
They allow processes to wait and signal within the monitor, controlling when certain conditions are met.
68
Q27-7: How do we construct the Gantt chart in RR?
We simulate each time slice in order, updating remaining burst times and rotating processes in a queue.
69
70
Q25-1: What is priority scheduling?
Priority scheduling selects the next process based on priority; lower numbers often mean higher priority.
71
Q19-1: What is Inter-Process Communication (IPC)?
IPC is a set of mechanisms that allow processes to exchange data and synchronize their actions.
72
Q19-5: How does shared memory differ from message passing?
Shared memory allows direct data sharing; message passing sends copies of data via system calls.
73
Q22-3: How does the wait (P) operation work?
It decrements the semaphore; if the result is negative, the process is blocked until the semaphore is signaled.
74
Q15-2: Why is the PCB important in an OS?
The PCB allows the OS to manage processes effectively; it provides all the details needed for scheduling, context switching, and resource tracking.
75
Q19-2: Why is IPC necessary?
IPC enables information sharing, modular design, faster execution through concurrency, and system convenience.
76
Q28-2: Why is SJF considered optimal for average waiting time?
By always running the shortest burst first, it reduces the waiting time of shorter tasks.
77
Q24-7: How do monitors differ from semaphores?
Monitors encapsulate data and synchronization in one structure, while semaphores are lower-level and more error-prone.
78
Q25-7: How do we compute average waiting and turnaround times?
We sum up each process's waiting or turnaround time, then divide by the number of processes.
79
Q23-1: What is the critical section problem?
It is the problem of ensuring no two processes access shared data simultaneously in a way that causes conflicts.
80
Q16-1: What are IPC mechanisms?
IPC mechanisms are methods for processes to communicate and synchronize; examples include message passing, shared memory, pipes, and sockets.
81
Q24-5: How is signal used with condition variables?
Signal wakes up one process waiting on that condition variable, if any.
82
83
Q18-2: What is the New state?
New is when a process is being created and not yet admitted to the ready queue.
84
Q26-5: How do we calculate turnaround time in FCFS?
Turnaround time = Completion time - Arrival time.
85
Q21-2: How often does the long-term scheduler run?
It runs infrequently, usually when a new job is submitted or a job completes.
86
Q19-3: Which IPC methods are commonly used?
Methods include message passing, shared memory, pipes, and sockets.
87
Q16-5: How do pipes facilitate IPC?
Pipes create a unidirectional data channel between processes; typically used for parent-child communication.
88
89
Q20-2: What is message passing in IPC?
Message passing involves sending/receiving discrete messages via the kernel or communication channels.
90
Q28-6: What is turnaround time in SJF?
TAT = completion time - arrival time; we compute it after constructing the Gantt chart.
91
Q16-3: What is message passing in IPC?
Message passing involves processes sending and receiving messages via system calls; it can be synchronous or asynchronous.
92
Q28-5: How do we calculate waiting time in SJF?
Waiting time = (start time - arrival time) or TAT - burst time for each process.
93
94
Q20-7: Give an example scenario for each model.
Shared memory is good for high-speed local communication; message passing is ideal for distributed or loosely coupled processes.
95
Q23-3: What is progress in the critical section problem?
If no process is in the critical section, a process that wishes to enter should not be indefinitely prevented.
96
Q25-4: How do we handle ties in priority?
Ties can be broken by arrival time or another secondary criterion.
97
Q29-3: How do FCFS and SJF differ in approach?
FCFS is strictly first-come, while SJF is based on predicted or known burst lengths.
98
Q19-4: What is the benefit of message passing?
Message passing simplifies data exchange by encapsulating information in discrete messages.
99
Q21-6: How do they impact system performance?
Long-term affects overall system load and job mix; short-term affects responsiveness and CPU utilization.
100
Q21-4: How frequently does the short-term scheduler run?
It runs very frequently, often on process completion, I/O interrupts, or time quantum expiration.
101
Q22-2: What are the types of semaphores?
There are counting semaphores for multiple resources and binary (mutex) semaphores for single resource access.
102
Q15-7: What is the role of accounting info in the PCB?
Accounting info records CPU usage, time limits, job or process number, and priority for scheduling and billing.
103
104
Q20-3: Compare speed between shared memory and message passing.
Shared memory is typically faster due to direct access; message passing can be slower due to data copying.
105
Q17-6: How does the process stack differ from the heap?
The stack holds function calls, local variables, and return addresses; the heap stores dynamically allocated data.
106
107
Q16-2: Why do processes need IPC?
Processes require IPC to share data, coordinate tasks, improve performance, and build modular systems.
108
Q23-7: What is a simple semaphore-based solution?
Use a binary semaphore; processes call wait(mutex) before entering and signal(mutex) after leaving the critical section.
109
Q24-1: What is a monitor in process synchronization?
A monitor is a high-level construct that combines shared data, procedures, and synchronization in one module.
110
Q29-2: What is SJF scheduling?
SJF selects the process with the shortest burst time first; aims to minimize average waiting time.
111
Q29-6: Does FCFS cause starvation?
No; every process eventually runs in the order of arrival, so none is starved.
112
113
Q15-4: How does a PCB help with context switching?
During a context switch, the OS saves the current CPU context in the PCB of the running process and loads the context of the next process.
114
Q24-4: How is wait used with condition variables?
Wait suspends the calling process until another process signals the same condition variable.
115
Q26-7: Why is FCFS easy to implement?
It uses a simple FIFO queue, making it straightforward but not optimal for all scenarios.
116
Q28-4: What is a potential downside of SJF?
Longer jobs may starve if many short jobs keep arriving; preemptive SJF (SRTF) can exacerbate this.
117
Q27-5: Why is RR good for time-sharing systems?
It ensures every process gets regular CPU attention, improving interactive performance.
118
Q28-1: What is Shortest Job First (SJF)?
SJF is a scheduling algorithm that picks the process with the smallest burst time next; can be preemptive or non-preemptive.
119
Q17-7: What is the role of the PCB in a process?
The PCB holds essential info about the process, enabling scheduling, context switching, and resource management.