10. When to Use `vfork()`In what specific scenarios would using `vfork()` be more beneficial than using `fork()`, and what precautions should you take when using `vfork()`?
9. Shared Address Space in `vfork()`How does `vfork()` handle the address space of the parent and child processes, and what are the implications of this sharing?
7. Interpreting Child Process StatusExplain how you can interpret the status of a terminated child process using the macros provided by the standard library (e.g., `WIFEXITED`, `WEXITSTATUS`).
20. Debugging and TracingDescribe how the kernel manages debugging and tracing for the child process if the parent process is being traced by a debugger during the `fork()` system call.
19. Handling Pending SignalsHow does the kernel handle pending signals for the parent and child processes before returning to user space after a `fork()` system call?
18. Architecture-Specific Considerations: RISC-VHow is the return to user space managed on RISC-V architectures? What is the function of the `sret` instruction?
16. Architecture-Specific Considerations: x86/x86_64How is the return to user space managed on x86/x86_64 architectures? Describe the use of the `iret` instruction in this context.
15. Detailed Example of Returning to User SpaceWalk through a detailed example of the steps involved in returning to user space after a `fork()` system call, from setting return values to continuing …
14. Execution of Parent and Child ProcessesAfter the CPU switches back to user mode, how do the parent and child processes continue their execution? What distinguishes their execution paths?
13. Switching Back to User ModeHow does the kernel switch the CPU from kernel mode back to user mode after setting up the CPU state for the parent and child processes?
12. Restoring CPU StateDescribe the process of restoring the CPU state for both the parent and child processes after a `fork()` system call. What elements are included in the CPU state?
11. Return Values of `fork()`Explain how the kernel sets the return values of `fork()` for the parent and child processes. Why are these return values different?
10. Load Balancing in Multiprocessor SystemsWhat is load balancing in the context of a multiprocessor system, and how does the scheduler achieve it? Why is load balancing important?
9. Priority ManagementHow does priority management influence the scheduling of processes in Linux? What factors are considered in calculating the priority of a task?
8. Scheduling Policies and AlgorithmsBriefly describe the Completely Fair Scheduler (CFS), Round Robin scheduling, and Real-Time scheduling. How does each policy determine the next process to run?
6. Scheduler Decision-MakingHow does the scheduler decide which process to run next? Mention some of the algorithms and factors involved in this decision-making process.
9. case with User SelectionWrite a Bash script that provides a simple menu with options to display the current date, list files in the current directory, or display the current user. Implement this u…
8. if-else with File ChecksWrite a Bash script that checks if a file exists and whether it is a directory or a regular file. Print an appropriate message for each case.
1. Simple if-else StatementWrite a Bash script that takes a number as input and checks if the number is positive, negative, or zero. Print the appropriate message.
20. Example Scenario of `fork()` ExecutionUsing a simple C program that calls `fork()`, explain the sequence of events that occurs from the parent process calling `fork()` to both the parent and chil…
19. Returning to User ModeDescribe the process by which the kernel returns control to user mode after setting up the child process context during `fork()`. What specific adjustments are made?
17. System Call Entry and HandlingOutline the steps that occur when the `fork()` system call is invoked, focusing on the transition from user mode to kernel mode.
16. Initialization of `task_struct`What is the `task_struct`, and what role does it play in process management? How is it initialized for the child process during `fork()`?
15. Handling Special RegistersHow does the kernel manage special registers (e.g., FPU, SIMD) when setting up the child process context during `fork()`? Why is this important?
14. Stack Pointer InitializationDescribe how the stack pointer (SP) is handled during the `fork()` system call. Why is it crucial for maintaining process execution context?
12. Return Values of `fork()`Explain how the return values of `fork()` differ for the parent and child processes. Why is this differentiation important?
11. Process Context DuplicationWhat elements constitute the context of a process in Linux, and how does the kernel duplicate this context for the child process during the `fork()` system call?
10. Close-on-Exec Flags ManagementExplain the `FD_CLOEXEC` flag. How does the kernel manage this flag for file descriptors during the `fork()` operation?
8. File Descriptor Table (`files_struct`)What is the `files_struct` in the context of the `fork()` system call? What are the key fields in this structure?
7. Consistency in File OperationsHow does sharing the `file` structure and managing reference counts ensure consistency in file operations between the parent and child processes?
6. Reference Count ManagementWhy does the kernel increment the reference count for each `file` structure during the `fork()` operation? How does this ensure proper resource management?
5. Duplicating File Descriptor TableWhen a process calls `fork()`, how does the kernel handle the duplication of the file descriptor table for the child process?
3. System-Wide File TableWhat is the file table, and how does it differ from the file descriptor table? What kind of information is stored in the file table?
20. Efficient Process CreationHow do the kernel mechanisms for managing address space during `fork()` contribute to efficient process creation? Discuss the roles of `mm_struct`, `vm_area_struct`, `du…
19. Memory Segment Attributes and BehaviorCompare the attributes and behaviors of the text, data, heap, and stack segments during the `fork()` system call. Why are these segments handled differently?
18. Page Fault Handling for Copy-on-WriteWhat happens when a process attempts to write to a shared page marked as read-only during the `fork()` operation? Describe the role of the `handle_pte_fault` …
17. Function `dup_mmap` in Copying Address SpaceExplain the purpose of the `dup_mmap` function in the `fork()` system call. How does it contribute to copying the parent’s address space to the child?
16. Virtual Memory Area (`vm_area_struct`)Describe the `vm_area_struct` and its significance in the context of the `fork()` system call. What key information does it contain?
15. Role of `mm_struct` in Address Space ManagementWhat is the `mm_struct` and what role does it play in managing a process's address space during the `fork()` system call?
14. Stack Segment DuplicationWhat steps does the kernel take to ensure that each process has its own independent stack segment after a `fork()` system call?
13. Heap Segment Copy-on-Write MechanismHow does the kernel handle the heap segment during the `fork()` system call? Explain the role of copy-on-write in managing the heap segment.
12. Data Segment and Copy-on-WriteDescribe the behavior of the data segment during `fork()`. How does the copy-on-write mechanism work for this segment?
11. Text Segment SharingExplain how the text segment is handled during the `fork()` system call. Why is it shared between the parent and child processes?
10. Returning to User SpaceWhat steps does the kernel take to return control to user space after the `fork()` system call? What are the return values for the parent and child processes?
9. Adding Child Process to Scheduler’s Run QueueDescribe the process of adding the newly created child process to the scheduler’s run queue. What role does the scheduler play in process execution?
7. Copy-on-Write Mechanism SetupExplain how the copy-on-write mechanism is set up during the `fork()` system call. Why is this mechanism important for process efficiency?
23. Execute a series of commandsImplement a program to execute a series of commands in a pipeline using `fork()` and `exec()` functions (e.g., `ls | grep "file"`).
22. Multiple child processesCreate a C program that uses `fork()` to create multiple child processes. Each child process should execute a different command (e.g., `date`, `ls -l`, `cal`) using `execl…
17. A shell-like program using exec()Implement a shell-like program that repeatedly takes user commands and executes them using appropriate `exec()` functions.
20. Benchmarking Pipe PerformanceWrite a program to measure the performance of pipe-based IPC by sending a large number of messages between the parent and child processes and timing the operation.
19. Parent and Child CoordinationImplement a mechanism for the parent to signal the child to perform a specific task using the pipe, and the child process performs the task and acknowledges it.
18. Inter-process Communication in a DaemonModify the program to run the child process as a daemon process that communicates with the parent process through a pipe.
16. Pipes with Multiple ChildrenWrite a program where the parent process creates multiple child processes, each reading from the same pipe. Ensure proper synchronization and resource management.
14. Sending Structs Through PipesWrite a program where the parent process sends a struct containing multiple data types to the child process through the pipe. The child process reads and prints the s…
12. Using `poll()` for MultiplexingUse the `poll()` system call to monitor the pipe for readability before attempting to read from it, ensuring non-blocking reads.
5. Allocating Process Control Block (PCB)How does the kernel allocate a new `task_struct` for the child process during `fork()`? What information is contained in the `task_struct`?
4. Kernel Function Execution: `do_fork()`What is the purpose of the `do_fork()` function in the kernel, and what key tasks does it perform during process creation?
2. System Call InvocationWhat happens during the system call invocation phase when `fork()` is called? Which specific CPU instruction is typically used for this transition?
1. User Space to Kernel Space TransitionExplain the transition from user space to kernel space when a process calls `fork()`. Why is this transition necessary?
20. Returning to User SpaceWhat steps does the kernel take to return control to user space after creating a child process using `fork()`, and what are the return values for the parent and child proce…
19. Scheduler's Run QueueDescribe how the newly created child process is added to the scheduler’s run queue and its significance in process management.