An Operating System (OS) acts as an intermediary between the user and computer hardware. It manages resources like CPU, memory, and storage. Examples: Windows, Linux, macOS.
A process is a program in execution. It has its own memory space. A thread is a lightweight unit within a process that shares memory.
#include
void* thread_func(void* arg) {
printf("Thread running\n");
return NULL;
}
// Creating a thread in C
CPU scheduling decides which process runs next. Common algorithms: First-Come-First-Served (FCFS), Round-Robin, Shortest Job First.
OS allocates memory to processes. Techniques include paging (dividing memory into fixed-size pages) and segmentation.
A deadlock occurs when processes wait for each other forever. Conditions: mutual exclusion, hold and wait, no preemption, circular wait.
File systems organize data on disk. Common types: FAT, NTFS, ext4. They handle directories, permissions, and access.
Virtual memory allows programs to use more memory than physically available by using disk space as swap.