Personal Notes Gate Smashers
Personal Notes Gate Smashers
1. Process vs Thread
A process is an independent program in execution with its own memory space,
system resources, and state information. A thread is a lightweight execution
unit within a process that shares the process's resources (memory and files)
but has its own registers and stack. Multiple threads in a process can run
concurrently, improving performance through parallelism while using fewer
system resources than multiple processes.
2. Process States vs PCB
Process states refer to the various conditions a process can be in:
• New: Process being created
• Ready: Process waiting to be assigned to a processor
• Running: Process executing instructions
• Blocked/Waiting: Process waiting for an event/resource
• Terminated: Process finished execution
The Process Control Block (PCB) is a data structure maintained by the OS that
contains all information about a process, including:
• Process ID
• Process state
• Program counter
• CPU registers
• CPU scheduling information
• Memory management information
• I/O status information
• Accounting information
3. Mutex vs Binary Semaphore
A Mutex (mutual exclusion) is a locking mechanism used to synchronize access
to a resource. Only one thread can acquire the mutex at a time, and only the
owner can release it.
A Binary Semaphore can also be used for mutual exclusion but is more flexible
as it can be signaled by any thread, not just the one that acquired it. While
functionally similar to a mutex in many cases, binary semaphores are designed
for signaling between threads rather than resource ownership.
4. Monolithic vs Microkernel
A Monolithic Kernel includes all OS services in the kernel space, providing
direct communication between different services. Examples include Linux and
older Unix systems. It offers better performance but is larger and less modular.
A Microkernel contains only essential services (like memory management and
IPC) in kernel space, while other services run in user space. It's more reliable
and maintainable, but performance may be slower due to increased
communication overhead. Examples include QNX and MINIX.
From <https://claude.ai/chat/28463ecf-ca64-435b-ba8d-6e52ac215fd3>