Interfaces and process scheduling Flashcards

1
Q

What are the state of xv6 processes?

A

Runnable - Process is ready to be executed by CPU.
Running- Process is being executed by CPU.
Sleeping- Process is not runnable, it is waiting for some input/output operation to finish.
Zombie - The process has terminated, but it is waiting for its exit code to be consumed by the parent process.

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

What is the “Round Robin Algorithim”?

A

Its a process scheduling algorithim where all processes are arranged in a loop, when a “CPU” is looking for the next process to run - it picks the next runnable process in the loop. It runs chosen process until timer interupt, time slice called the quantum usually around 20 ms.

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

what is “process sleep” ?

A

sometime input/output operation cannot be completed immediatly, i.e waiting for keyboard input, reading data from empty pipe (waiting for the pipe to get data) or even writing into a full pipe (needs to be freed first).
- in such situations the process is temporarly excluded from the scheduling loop(put to sleep)until required condition is fulfilled.

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

What does the process do before going to sleep?

A

Before going to sleep, the process releases (yeilds) the CPU to the next available
runnable process.

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

What are “blocking System calls”

A

System calls that do not return until the requested operation is completed and can put the calling process to sleep are called blocking system calls. They block execution of the program until the requested operation completes (or fails).

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

Advantages of round robin algorithim ?

A

-Simple implementation
-All ready to run processes will eventually be executed.
-Fairness

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

Disadvantages of round robin algorithim?

A

Poor-performance for Long-Running Process
High context switching overhead
Short Time Slices:

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

what happens in “_entry: In kernel/entry.S” ?

A

Initialises stack pointer (sp) and calls start(). Each CPU hart gets its own program stack area.

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

What happens in “start() In kernel/start.c” ?

A
  • Enables interrupts;
  • Delegates interrupt and exception processing to supervisor mode
    -Gives full memory access to supervisor mode;
  • Configures timer interrupts;
  • “jumps” to main() using mret instruction, which also switches the CPU hart to supervisor mode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens in “main() In kernel/main.c” ?

A
  • CPU hart #0 performs most system-wide initialisation work.
  • System-wide initialisation of drivers and OS subsystems.
  • All other CPU harts wait until the system-wide initialisation is finished and perform only hart-specific initialisations.
  • Eventually, all CPU harts
    enter scheduler loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens in “kinit() in kalloc.c” ?

A

Builds system-wide linked list of free memory pages

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

What is a device Driver?

A

A piece of software that allows the operating system to interact with a particular piece of hardware it is written for.

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

What is Dynamic Driver Loading?

A

Modern Linux-based operating systems have sophisticated mechanisms that allow them to load or unload driver code when new piece of hardware is connected to the computer

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

Where DL linux drivers stored?

A

Dynamically loadable Linux drivers are stored in .ko files (Kernel Object files).

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

Shell commands associated with Dynamically loaded linux drivers?

A

Shell commands lsmod, insmod, rmmod, and modprobe can be used to inspect drivers currently loaded (lsmod) and to remove (rmmod) or add (insmod / modprobe) drivers from Linux kernel “on the fly”.

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

What is RTOS?

A

Real-Time Operating Systems (RTOS) are tailored for applications with strict time constraints, such as industrial control systems and spaceflight control systems. Their key requirement is predictability in task completion time, with jitter representing variability. In hard real-time OS, any delay in task completion is unacceptable, while in soft real-time OS, occasional delays are acceptable as long as overall deadlines are met. RTOS prioritizes real-time performance guarantees over computational throughput

17
Q

Server OS?

A

Server OS

Back:

For network servers
Goals: Maximize throughput, requests served, resilience, scalability
Not prioritizing: Startup time, interactive response time
Computational throughput not priority, except in high-performance computing
Recent focus: Power dissipation, energy efficiency

18
Q

Desktop OS?

A

Typically optimised for rapid startup and rapid interactive response times.
For battery powered devices, energy efficiency is also essential, so avoiding unnecessary processing is a priority

19
Q

General-purpose operating systems?

A

General purpose OSes, such as Linux, Windows, and
macOS, have to provide certain level of configurability to adapt to the needs of specific application area, e.g.
– Server vs Desktop versions of Microsoft Windows
– Different scheduling algorithms in Linux

20
Q

What is preempptive scheduling?

A

Making interactive tasks higher-priority ensures their
responsiveness, while making housekeeping tasks lower priority ensures that they do not detract from business performance

21
Q

What is starvation?

A

The main problem of the “naive” preemptive scheduling with priority queues is that if the high-priority processes are always runnable, lower priority processes never get a chance to run
● This is called starvation and practical scheduling algorithms make efforts to avoid it

One scheme that avoids this problem is Multilevel Feedback Queue Scheduling (MFQS)

22
Q

What are the rules associated with MFQS?

A

Rule 1: If Priority(A) > Priority(B), A runs (B doesn’t).

Rule 2: If Priority(A) = Priority(B), A & B run in round-robin fashion using the time slice (quantum length) of the given queue.

Rule 3: When a job enters the system, it is placed at the highest priority(the topmost queue).

Rule 4: Once a job uses up its time allotment at a given level (re-gardless of how many times it has given up the CPU), its priority is reduced (i.e., it moves down one queue).

Rule 5: After some time period S, move all the jobs in the system to the
topmost queue

23
Q

MFQS attempts to distinguish between interactive and CPU-intensive processes using a heuristic: ????

A

if the process has consumed a lot of CPU time already, it is probably a CPU-intensive phase and its priority should be lowered.

24
Q

If a process enters interactive phase, its scheduling should be adapted accordingly right? hows does MFQS do this?

A

MFQS ensures that by periodically resetting
priorities of all processes back to the higest level

25
Q

What is Linux Completly fair Scheduling?

A

An example of modern scheduling algorithm

26
Q

hat is Virtual Runtime of a process?

A

Virtual runtime of a process is the total amount of CPU time it has received

“Completely Fair Scheduling” rule: when choosing the next process to run on a CPU, always choose the runnable process with the minimal virtual runtime.

27
Q

Weight Factor?

A

weighting factor = weight of process with nice value 0 / weight of current task;

where ‘weight’ is roughly equivalent to 1024 * (1.25)^(-nice)

28
Q
A