Interfaces and process scheduling Flashcards
What are the state of xv6 processes?
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.
What is the “Round Robin Algorithim”?
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.
what is “process sleep” ?
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.
What does the process do before going to sleep?
Before going to sleep, the process releases (yeilds) the CPU to the next available
runnable process.
What are “blocking System calls”
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).
Advantages of round robin algorithim ?
-Simple implementation
-All ready to run processes will eventually be executed.
-Fairness
Disadvantages of round robin algorithim?
Poor-performance for Long-Running Process
High context switching overhead
Short Time Slices:
what happens in “_entry: In kernel/entry.S” ?
Initialises stack pointer (sp) and calls start(). Each CPU hart gets its own program stack area.
What happens in “start() In kernel/start.c” ?
- 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
What happens in “main() In kernel/main.c” ?
- 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
What happens in “kinit() in kalloc.c” ?
Builds system-wide linked list of free memory pages
What is a device Driver?
A piece of software that allows the operating system to interact with a particular piece of hardware it is written for.
What is Dynamic Driver Loading?
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
Where DL linux drivers stored?
Dynamically loadable Linux drivers are stored in .ko files (Kernel Object files).
Shell commands associated with Dynamically loaded linux drivers?
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”.