What is a Process?
A process is a program that is executed
- It is a basic unit of execution in an OS
What is Process Scheduling (time-sharing)?
Each process is scheduled and executed withing their time share. Where the number of processes can be much larger than that of the CPU
- For process scheduling, It is about how the operating system
schedules processes for execution on CPUs and the scheduling is time sharing based or what we
say, known as a multiplex manner
- So, this is similar to CPU virtualization that we have discussed in the last lecture.
So, each process is scheduled and executed within the time
shared.
- For each CPU, Processes are waiting in line. To be scheduled for execution. So the number Processes Can be much larger than that of the physical CPUs.
REFER TO SLIDES FOR DIAGRAM
How does Process Scheduling work?
How does Process Scheduling work - Job Queue?
○ This queue holds all the processes that have entered the system (submitted by users or programs).
○ These are not yet ready to run — they are waiting for allocation of resources (e.g., memory).
○ Scheduler (often long-term scheduler) picks some of these to move to the Ready Queue.
How does Process Scheduling work - Ready Queue?
○ This holds all processes that are ready to run but are waiting for CPU time.
○ These processes have all required resources except the CPU.
○ The short-term scheduler picks a process from this queue and assigns it to the CPU.
How does Process Scheduling work - CPU?
○ This is where the actual execution of instructions happens.
○ The process can:
§ Complete execution → Go to Exit.
§ Request I/O → Move to the I/O Waiting Queue.
§ Be pre-empted (e.g., time slice ends or higher priority process arrives) → Go back to Ready Queue.
○ Note: 1 CPU can only serve one process at a time
○ They are using their given time share to finish their execution, it will then exit the system or once the time share has expired
How does Process Scheduling work - Exit?
○ Represents the end of a process’s life — the process has completed its execution and is terminated.
How does Process Scheduling work - I/O Waiting Queue?
○ If a process needs input/output operations (e.g., reading a file), it cannot use the CPU.
○ It moves to this queue and waits for the I/O device to be available.
How does Process Scheduling work - I/O?
○ When the I/O device is available, the process moves from the I/O Waiting Queue to the I/O operation block.
○ Once I/O is completed, the process goes back to the Ready Queue to await CPU time again.
What are the X86 Protecting Rings (CPL)?
When the programme is executed on the CPU, it becomes a process.
- Where the code and data will be decoded as low-level assembly instructions
x86 has four protecting levels (rings)/CPU privilege levels (CPLs)
- Ring 0 - Kernal mode (most privileged)
- Ring 1 and 2 - Other
- Ring 3 - User mode
Modern Oses such as Linux, Windows and MacOS only use ring 0 and 3
- Kernal vs user mode
NOTE: the process schedule that was just mentioned is in ring 0 as this is where we allocated the privilege
REFER TO SLIDES FOR DIAGRAMS
What is Virtual Memory?
The size of VM is decided by the virtual address, for example the OS might use 32 or 64
What are the general components for Virtual Memory?
REFER TO NOTES
Define on-demand paging?
So, in the kernel mode, the CPU will allocate an empty physical page like this and load the code from the disc into this physical page. So this is what we call on-demand paging.
- If there is a physical page has recently been used its content can be swapped out back to the disk
- We use swapping in and swapping out to maximise the usage of the physical memory space
Note physical memory is faster than the disk
Shared Memory
REFER TO SLIDES FOR DIAGRAM
Memory Map implementation - MMU
REFER TO SLIDES FOR DIAGRAM
MMU is Memory Management Unit used for translation of memory from virtual to physical
What is a page table in relation to memory mapping?
Page Table: In a modern OS, the OS uses a set of page tables to map/translate virtual memory within a process to their corresponding physical memory in main memory
- VA refers to virtual address, pointing to a page-aligned memory location in a virtual page
- PA refer to physical address, pointing to a apge-aligned memory location in a physical page
MMU: Memory Management Unit - handles the mapping or translation of memory
What do we mean by page aligned address
REFER TO SLIDES
Memory Map Implementation: x86-32
REFER TO SLIDES
What is Virtualisation (hardware virtualisation)?
What are the Characteristics of Virtual Machine Monitor?
What are the VMM types?
What is the VMM implementation on x86-64
Main stream architecture
- Hardware support: Intel and AMD assist virtualisation
○ Intel VT-x and AMD SVM: CPU and memory virtualization
○ Intel VT-d and AMD Vi: Device virtualization
REFER TO SLIDES FOR DIAGRAMS
What is CPU Virtualisation?
REFER TO SLIDES
What is Memory Virtualisation?
REFER TO SLIDES