CS21004 - Operating Systems

0.0(0)
studied byStudied by 16 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/203

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

204 Terms

1
New cards

Name the five-state process model

New, Ready, Running, Blocked, Exit

2
New cards

List the primary process states managed by the Kernel. 

Running, Ready, Blocked, Ready Suspend, Blocked Suspend, Terminated 

3
New cards

In a single core processor how many processes can run at once?

One

4
New cards

What happens in the suspend state?

A process is temporarily removed from the main memory and stored in secondary storage, allowing the system to allocate memory for other processes. It can be resumed later.

5
New cards

When does a process need to go into the suspend state?

When there is not enough RAM available

6
New cards

Where is virtual memory useful?

When swapping processes

7
New cards

What is needed to get out of blocked suspend?

RAM and to become unblocked

8
New cards

What is needed to get out of ready suspend?

RAM (only)

9
New cards

What should processes not share?

Resources

10
New cards

What is recommended for threads but not processes?

Switching

11
New cards

Why is process switching not recommended?

It is relatively slow as it is a kernel-mode operation

12
New cards

How are CPU resources allocated?

With priority scheduling

13
New cards

Name 8 process scheduling algorithms

First-Come First-Served, Shortest Job First/Next, Round Robin, Priority Scheduling, Multilevel Queue Scheduling, Multilevel Feedback Queue, Lottery Scheduling, Earliest Deadline First

14
New cards

Describe First-Come First-Served (FCFS)

Processes are executed in the order they arrive

15
New cards

Advantage of First-Come First-Served (FCFS)

Simple to implement

16
New cards

Disadvantage of First-Come First-Served (FCFS)

Can lead to long waiting times if a long process is scheduled first (the "convoy effect")

17
New cards

Describe Shortest Job First/Next (SJF/SJN)

The OS selects the process with the shortest estimated execution time

18
New cards

Advantage of Shortest Job First/Next (SJF/SJN)

Minimises average waiting time

19
New cards

Disadvantage of Shortest Job First/Next (SJF/SJN)

Requires knowing/estimating process lengths and can lead to starvation of longer processes

20
New cards

Describe Round Robin (RR)

Each process is assigned a fixed time slice (quantum). After its time expires, the process is preempted, and the next one in the queue is run

21
New cards

Advantage of Round Robin

Ensures all processes get CPU time, improving fairness and responsiveness

22
New cards

Disadvantage of Round Robin

Inefficiency due to frequent context switching if the time quantum is too small

23
New cards

Describe Priority Scheduling

Each process is assigned a priority, and the OS runs the highest-priority next

24
New cards

Advantage of Priority Scheduling

Allows important tasks to be completed first

25
New cards

Disadvantage of Priority Scheduling

Lower-priority processes may experience starvation. Solutions like aging (increasing a process’ priority over time) help prevent this

26
New cards

Describe Multilevel Queue Scheduling

Processes are divided into different queues based on characteristics (e.g. foreground, background). Each queue may have a different scheduling algorithm

27
New cards

Advantage of Multilevel Queue Scheduling

Customisable for different types of processes

28
New cards

Disadvantages of Multilevel Queue Scheduling

Complex to implement and balance

29
New cards

Describe Multilevel Feedback Queue

Similar to multilevel queue scheduling but processes can move between queues based on their behaviour and time spent waiting

30
New cards

Advantage of Multilevel Feedback Queue

Dynamically adjusts to the needs of processes, balancing between CPU-bound and I/O-bound tasks

31
New cards

Disadvantage of Multilevel Feedback Queue

Complex to configure and manage

32
New cards

Describe Shortest Remaining Time (SRT)

A preemptive version of SJF. The OS runs the process with the shortest remaining time to completion, preempting if a shorter job arrives

33
New cards

Advantage of Shortest Remaining Time (SRT)

Minimises the average time to complete processes

34
New cards

Disadvantages of Shortest Remaining Time (SRT)

Requires knowing/estimating the remaining execution time (can result in frequent context switching)

35
New cards

Describe Lottery Scheduling

Each process is given a certain number of tickets and the OS randomly selects a ticket to decide which process to run

36
New cards

Advantage of Lottery Scheduling

Provides probabilistic fairness and allows for flexible allocation of resources

37
New cards

Disadvantage of Lottery Scheduling

Randomness may cause some unpredictability in process scheduling

38
New cards

Describe Earliest Deadline First (EDF)

Processes are scheduled based on their deadlines, with the earliest deadline getting the highest priority

39
New cards

Advantage of Earliest Deadline First (EDF)

Ideal for real-time systems where meeting deadlines is critical

40
New cards

Disadvantage of Earliest Deadline First

Can be difficult to predict or manage system load when many processes have close deadlines

41
New cards

What does the "New" process state mean?

The process is not yet added to the system

42
New cards

What does the "Ready" process state mean?

The process is available to be executed by the processor

43
New cards

What does the "Blocked" process state mean?

The process is fully in main memory but waiting for something (e.g. I/O)

44
New cards

What does the "Suspended" process state mean?

The process is partially in secondary memory

45
New cards

What does the "Blocked Suspended" state mean?

The process is suspended and waiting for something

46
New cards

What does the "Ready Suspended" state mean?

The process is suspended but otherwise ready to execute

47
New cards

What should scheduling balance between?

User-oriented criteria and system-oriented criteria

48
New cards

What are examples of user-oriented scheduling criteria?

Low response times and meeting event deadlines

49
New cards

What should a scheduling mechanism be in terms of cost?

It should be “cheap” (i.e., efficient) to implement

50
New cards

Why should a scheduling mechanism favour short jobs?

To improve response time

51
New cards

Why should a scheduling mechanism favour I/O-bound jobs?

To achieve good I/O device utilisation and better interactive performance

52
New cards

What should a scheduling mechanism determine about a job?

The nature of the job, and it should schedule it accordingly

53
New cards

What kinds of tasks are typically high priority?

System-critical tasks and real-time events

54
New cards

Give examples of high-priority processes.

Interrupt servicing, I/O operations, security monitoring, audio/video playback, and user interface tasks

55
New cards

What kinds of tasks are medium priority?

Regular user applications

56
New cards

Give examples of medium-priority processes.

Word processors, web browsers, and background data synchronisation

57
New cards

Give examples of low-priority processes.

System maintenance (e.g., disk defragmentation, file indexing) and large data backups

58
New cards

What is pre-emption in process scheduling?

When a high-priority process arrives while a lower-priority one is running, the lower-priority process is paused so the higher-priority process can execute

59
New cards

How does a multilevel queue scheduler decide which process to run?

It checks the highest-priority queue first

60
New cards

What are the base priority values in Windows?

Threads have base priority values from 1 to 31 - values 16-31 are reserved for real-time threads.

61
New cards

Who can change process priorities in Windows?

The user (with sufficient permissions) or the operating system

62
New cards

What are the scheduling priority ranges in Linux?

Real-time priorities: 0-99, static priorities 100-139

63
New cards

What is the range of niceness values in Linux?

-20 (highest priority) to +19 (lowest priority)

64
New cards

What do niceness values represent?

User-configurable hints that affect how much CPU time a process gets.

65
New cards

What does CFS stand for in Linux scheduling?

Completely Fair Scheduler

66
New cards

What is priority inversion?

A situation where a high-priority task is indirectly blocked by a low-priority task holding a resource, while a medium-priority task runs in between

67
New cards
Why does priority inversion happen?

A low-priority task holds a resource needed by a high-priority task, and a medium-priority task preempts the low-priority one

68
New cards
Why is it called "priority inversion"?

Because the priority order is effectively reversed (lower-priority tasks run before higher-priority ones)

69
New cards
What is priority inheritance?

The low-priority task temporarily inherits the high-priority task’s priority until it releases the shared resource

70
New cards
What are other solutions to priority inversion?

Priority ceiling protocols and reducing the length of critical sections

71
New cards

What is the arrival time?

The time in which a process arrives in the system

72
New cards

What is the burst/execution time?

The amount of CPU time a process needs to finish its current CPU work unit or job

73
New cards

What is the completion time?

Clock time when a job finishes

74
New cards

What is the turnaround time (formula)?

Completion time - Arrival time

75
New cards

What is the waiting time (formula)?

Turnaround time - Burst time

76
New cards

What is the response time?

The time from arrival until the first job is scheduled on the CPU (first run)

77
New cards

What is throughput?

The number of jobs completed per unit time

78
New cards

What is the advantage of short turnaround time?

Batch completion

79
New cards

What is the advantage of short response time?

Interactivity

80
New cards

What is the advantage of high throughput?

System capacity

81
New cards

What is preemption?

The OS interrupting (pausing) a running task and switching the CPU to another task with the intention to resume the first later

82
New cards

What are the benefits of preemption?

It enables time-sharing and priority-driven scheduling

83
New cards

Name 3 methods to mitigate starvation

Aging, hybrid policies, limit preemption depth

84
New cards

What is aging?

Gradually increasing priority (of effective weight) of waiting jobs

85
New cards

What are hybrid policies?

Giving long jobs guaranteed CPU slices before preemption

86
New cards

What is an example of limit preemption depth?

Only preempting if the remaining time difference is large

87
New cards

What does Windows do when a thread completes I/O and becomes runnable?

Windows temporarily boosts the thread’s dynamic priority so it can run immediately, helping it finish quickly and improving system responsiveness

88
New cards

What does Jain’s fairness index measure?

The equality of resource allocation among n processes with allocations x1, . . . , xn.

89
New cards

What are the worst and best values for Jain’s fairness index?

1/n (worst), 1 (perfect fairness)

90
New cards

What is the Dijkstra's Banker's Algorithm?

A deadlock avoidance algorithm used in operating systems to manage resource allocation safely

91
New cards

What is a safe state?

When a system can allocate resources to each process in such a way that all processes can complete without leading to deadlock

92
New cards

Why is system in a safe space important?

It guarantees that there exists a sequence of process execution that allows all processes to finish

93
New cards

What are inconsistencies known as?

Race condition

94
New cards

How to prevent race conditions?

Synchronisation mechanisms like locks, semaphores, and monitors are used

95
New cards

What does mutual exclusion do?

It prevents multiple processes or threads from accessing a shared resource simultaneously

96
New cards

What does a semaphore do?

Controls access to a shared resource by multiple processes or threads

97
New cards

Name the 2 types of semaphores

Binary and counting

98
New cards

How do you calculate the need matrix?

Max - Allocation

99
New cards

How can we tell if deadlock is possible using D Bankers algorithm?

If the need matrix is greater than the available matrix

100
New cards

What are the advantages of the Banker's Algorithm (5)?

Prevents deadlock by keeping the system in a safe state, allows efficient and fair resource allocation, prevents starvation, is flexible for different resource types and systems, and is conceptually simple to understand and implement