Aos
Aos
o A process is an independent unit of execution with its own memory space, while a
thread is a lightweight sub-unit of a process that shares the same memory space.
Threads have faster creation and termination times compared to processes.
o A file descriptor is an integer that uniquely identifies an open file in a process. It is used
by system calls to read, write, or perform other operations on the file.
o The kernel uses mechanisms like pipes, message queues, shared memory, and signals for
interprocess communication (IPC). For instance, a pipe allows a parent and child process
to exchange data.
o A race condition occurs when multiple processes access shared data simultaneously,
leading to unpredictable behavior. It can be prevented using synchronization techniques
like semaphores, mutexes, or monitors.
5. Define and differentiate between a regular file, a directory file, and a symbolic link.
o The stat structure provides metadata about a file, such as its size, type, permissions,
timestamps, and ownership. It is crucial for file system management and auditing.
7. What are the different file types supported in Unix-based systems? Describe their use cases.
o Regular files, directories, character special files (e.g., keyboard), block special files (e.g.,
disks), FIFOs (named pipes), sockets (network communication), and symbolic links.
8. How do file access permissions work? Explain the concept of UID and GID.
o Permissions determine who can read, write, or execute a file. UID specifies the file's
owner, and GID specifies the group associated with the file. Access levels are assigned
for the owner, group, and others.
9. Describe how you can create a file with a "hole" in it.
o A file with a hole is created by seeking beyond the current end of the file and writing
data, leaving the gap unallocated. This can be done using system calls like lseek and
write.
10. How is a directory file different from a regular file in terms of kernel access?
o The kernel allows only the creation, deletion, or renaming of directory entries.
Directories cannot be directly written to or modified by user applications.
o A buffer header stores metadata about the buffer, such as its state, associated disk block,
and pointers for linked list management.
12. Explain the structure of the buffer pool and its importance.
13. Describe the least recently used (LRU) algorithm in buffer management.
o The LRU algorithm replaces the least recently used buffer when a new buffer is needed.
It ensures that recently accessed buffers are retained in the pool.
14. What happens when a kernel tries to allocate a buffer, but all buffers in the free list are
marked as "delayed write"?
o The kernel writes the "delayed write" buffer to disk and frees it for new allocations.
15. How does the kernel ensure that only one buffer maps to a disk block at a time?
o The kernel uses a hash queue to track buffers and ensures no duplicate mappings exist
for the same disk block.
16. What is the role of fork() in process creation? How does it work?
o fork() creates a new process (child) that is a copy of the parent process. The child
receives a return value of 0, while the parent gets the child's process ID.
17. Differentiate between execlp and execv. Provide use cases for each.
o execlp takes a list of arguments and uses the PATH variable to locate the program.
execv takes an array of arguments and requires an explicit path to the program.
18. How do parent and child processes communicate using a pipe?
o A pipe provides a unidirectional communication channel. The parent writes data to the
pipe, and the child reads it or vice versa.
20. Describe the different sections of a process (stack, heap, text, data).
Memory Management
o malloc allocates a block of memory on the heap, while free releases it to prevent
memory leaks.
o Shared memory provides a fast way for processes to share data by mapping the same
memory segment into their address spaces.
23. Explain the concept of memory leaks. How can they be detected and resolved?
o A memory leak occurs when allocated memory is not freed, leading to resource
exhaustion. Tools like Valgrind can detect leaks.
24. How does the kernel manage memory allocation during a fork() system call?
o The kernel uses a copy-on-write mechanism, where memory pages are shared until
modified by either process.
25. What is the difference between stack memory and heap memory?
o Stack memory is automatically managed and limited in size, while heap memory is
manually managed and larger.
Signal Handling
26. What are the differences between SIGINT, SIGTERM, and SIGHUP signals?
o SIGINT: Interrupts a process (Ctrl+C).
SIGTERM: Requests a process termination.
SIGHUP: Indicates terminal disconnection or reload configuration.
27. How can a process handle signals using custom signal handlers?
o The kill system call sends a specific signal to a process or group of processes.
Virtualization
32. Describe the types of virtualization (e.g., server, network, and storage virtualization).
33. What is a hypervisor? Explain the difference between bare-metal and hosted hypervisors.
o Migration moves a running VM from one host to another for load balancing or
maintenance.
Containerization
37. Explain the key components of Docker (e.g., Docker Engine, Docker Image, Docker Hub).
38. What are the benefits of using containers over virtual machines?
o Containers are lightweight, portable, and faster to start, sharing the host OS kernel.
Zoning
o Benefits: Efficient resource usage, security through isolation, ease of management, and
flexibility for running multiple applications.
Challenges: A kernel panic in the global zone affects all zones, and all zones share the
same kernel, limiting OS variety.
o Zoning separates memory spaces for different processes or tenants, ensuring isolation,
preventing interference, and optimizing resource allocation.
o A free list is a doubly linked circular list of available buffers. The kernel allocates buffers
from the head of the free list and reuses them based on the least recently used (LRU)
principle.
o A delayed write occurs when the kernel postpones writing buffer data to disk for
efficiency. Before reusing the buffer, the kernel ensures the data is written.
48. How does interprocess communication (IPC) work using shared memory?
o Shared memory maps a memory segment into the address spaces of multiple processes,
allowing them to read and write data directly without additional kernel intervention.
49. What is the role of system calls like bwrite, getblk, and brelse in buffer management?
50. How can signals be used to manage parent and child process interactions?
o Signals allow a parent process to control child processes (e.g., sending SIGINT to
interrupt or SIGKILL to terminate). Custom handlers enable specific responses.
Advanced Topics
o Containers are lightweight, share the host OS kernel, and are faster to deploy. VMs
virtualize hardware, have greater isolation, and are resource-intensive.
54. How does a kernel panic in the global zone affect non-global zones?
o Since all zones share the same kernel, a kernel panic in the global zone causes a system-
wide crash, affecting all non-global zones.
56. How would you troubleshoot insufficient balance issues in a banking application?
o LRU ensures the most recently accessed buffers are retained, optimizing performance by
reducing disk I/O for frequently accessed data.
o Common system calls include signal, sigaction, raise, kill, pause, and alarm.
59. How does the kernel manage synchronization between EMI and withdrawal processes in a
banking scenario?