Podcast
Questions and Answers
What does the function e.getpid() return?
What does the function e.getpid() return?
- The ID of the currently loaded program
- The current process ID of the calling process (correct)
- The ID of the last terminated process
- The process ID of the parent process
Which command is used to copy a file named 'source.txt' to 'destination.txt'?
Which command is used to copy a file named 'source.txt' to 'destination.txt'?
- mv source.txt destination.txt
- copy source.txt destination.txt
- duplicate source.txt destination.txt
- cp source.txt destination.txt (correct)
What mechanism allows a parent process to check how a child process terminated?
What mechanism allows a parent process to check how a child process terminated?
- The terminate() function
- The wait() function (correct)
- The getppid() function
- The exit() function
What option with the ls command lists all files including hidden ones?
What option with the ls command lists all files including hidden ones?
Which command would you use to permanently delete a file named 'file.txt'?
Which command would you use to permanently delete a file named 'file.txt'?
What is the main function of the mkdir command?
What is the main function of the mkdir command?
Which of the following commands is used to view currently running processes?
Which of the following commands is used to view currently running processes?
Which of these options allows the output of a command to be saved into a file?
Which of these options allows the output of a command to be saved into a file?
What happens when the buffer is full in the producer-consumer problem?
What happens when the buffer is full in the producer-consumer problem?
Which function is used to signal the consumer after an item has been produced?
Which function is used to signal the consumer after an item has been produced?
What is the role of the mutex in the producer-consumer problem?
What is the role of the mutex in the producer-consumer problem?
What will happen if the consumer tries to consume an item when the buffer is empty?
What will happen if the consumer tries to consume an item when the buffer is empty?
What is the primary purpose of condition variables in this implementation?
What is the primary purpose of condition variables in this implementation?
In the context of this code, what is a race condition?
In the context of this code, what is a race condition?
What is the purpose of the deletion flag in a file structure?
What is the purpose of the deletion flag in a file structure?
Which allocation method requires that each file occupies a set of contiguous blocks?
Which allocation method requires that each file occupies a set of contiguous blocks?
What does the 'blocks' array signify in the file allocation method?
What does the 'blocks' array signify in the file allocation method?
What is indicated by a return value of 0 in the allocateContiguous function?
What is indicated by a return value of 0 in the allocateContiguous function?
What does the allocateContiguous function primarily check before allocating blocks?
What does the allocateContiguous function primarily check before allocating blocks?
Which of the following statements is true about Linked Allocation?
Which of the following statements is true about Linked Allocation?
What is a major advantage of Contiguous Allocation?
What is a major advantage of Contiguous Allocation?
In the context of file operations, what does 'Display File' functionality accomplish?
In the context of file operations, what does 'Display File' functionality accomplish?
What function is used to create a new thread in POSIX threads?
What function is used to create a new thread in POSIX threads?
What is the primary purpose of using mutexes in multithreading?
What is the primary purpose of using mutexes in multithreading?
Which of the following statements about pthread_join is true?
Which of the following statements about pthread_join is true?
In the provided mutex example, what happens when pthread_mutex_lock is called?
In the provided mutex example, what happens when pthread_mutex_lock is called?
What issue does the producer-consumer problem illustrate in multithreading?
What issue does the producer-consumer problem illustrate in multithreading?
What is the result of a race condition in a multithreaded program?
What is the result of a race condition in a multithreaded program?
Which function correctly locks a mutex before accessing a shared resource?
Which function correctly locks a mutex before accessing a shared resource?
Where would you typically use thread joins in a multithreaded application?
Where would you typically use thread joins in a multithreaded application?
What is the purpose of the isSafe() function in the Banker's Algorithm?
What is the purpose of the isSafe() function in the Banker's Algorithm?
In the context of the program, what does the need[][] array represent?
In the context of the program, what does the need[][] array represent?
Why is the finish[] array used in the isSafe() function?
Why is the finish[] array used in the isSafe() function?
What method is used to update the work[] vector in isSafe()?
What method is used to update the work[] vector in isSafe()?
If the count variable in isSafe() reaches the value of P, what can be concluded?
If the count variable in isSafe() reaches the value of P, what can be concluded?
What condition would result in the isSafe() function returning false?
What condition would result in the isSafe() function returning false?
In the context of the Resource Allocation Graph (RAG), what do the nodes represent?
In the context of the Resource Allocation Graph (RAG), what do the nodes represent?
What is the primary function of the calculateNeed() function in the program?
What is the primary function of the calculateNeed() function in the program?
What is the primary purpose of the fork() function in the provided code?
What is the primary purpose of the fork() function in the provided code?
What happens if the fork() function fails?
What happens if the fork() function fails?
In the child process, what exit status does it return before terminating?
In the child process, what exit status does it return before terminating?
Which function is used to wait for the child process to finish executing?
Which function is used to wait for the child process to finish executing?
What function is called to check if the child process exited normally?
What function is called to check if the child process exited normally?
What will happen if the exec() function is successful?
What will happen if the exec() function is successful?
What does the printf statement in the parent process output after the child exits normally?
What does the printf statement in the parent process output after the child exits normally?
What is the purpose of getpid() in the child process?
What is the purpose of getpid() in the child process?
Which signal indicates that the child process was terminated abnormally?
Which signal indicates that the child process was terminated abnormally?
In the exec() example, which command is executed if exec() is successful?
In the exec() example, which command is executed if exec() is successful?
Study Notes
Subject: Lab Assignment - Operating System
- Student name: Suwarnika Srivastava
- Registration number: 23BSA10092
- Course code: CSE3003
- Slot: A21 + A22 + A2
- Assignment ID: 3
Question 1: Process Creation and Management
- Objective: Understand process creation, termination, and management in the operating system.
- Tasks: Write a C program to create a new process using
fork()
.- Implement the parent-child process relationship.
- Demonstrate process termination.
- Use
exec()
to replace a process image. - Demonstrate the use of process IDs and status handling.
Question 2: Basic OS Commands
- Objective: Learn and practice basic operating system commands.
- Tasks:
- File management (e.g., ls, cp, mv, rm, touch).
- Process management (e.g., ps, kill, top).
- Directory navigation (e.g., cd, pwd, mkdir).
- I/O redirection and piping (e.g., |, >, >>).
Question 3: CPU Scheduling Algorithms
- Objective: Simulate different CPU scheduling algorithms.
- Tasks:
- Write a program to simulate First-Come-First-Served (FCFS) scheduling.
- Implement Shortest Job First (SJF) scheduling (with or without preemption).
- Simulate Round Robin (RR) scheduling and calculate turnaround and waiting times.
- Implement Priority Scheduling and test with different sets of priorities.
Question 4: Inter-Process Communication (IPC)
- Objective: Implement communication between processes.
- Tasks:
- Write a program using pipes for IPC between parent and child processes.
- Implement shared memory for communication between multiple processes.
- Use message queues to exchange data between processes.
- Demonstrate use of semaphores for synchronization.
Question 5: Thread Creation and Synchronization
- Objective: Work with multithreading in an operating system.
- Tasks:
- Create multiple threads using POSIX threads (pthreads) in C.
- Implement thread synchronization using mutexes or semaphores.
- Write a program to demonstrate race conditions and resolve them using locks.
- Simulate the producer-consumer problem using multithreading.
Question 6: Deadlock Detection and Prevention
- Objective: Implement deadlock avoidance and detection techniques.
- Tasks:
- Write a program to simulate a system with multiple resources and processes.
- Implement Banker's Algorithm for deadlock avoidance.
- Demonstrate deadlock detection using a resource allocation graph.
- Analyze a situation where deadlock occurs and suggest ways to resolve it.
Question 7: Memory Management Techniques
- Objective: Implement and simulate different memory management techniques.
- Tasks:
- Simulate paging and segmentation using C or Java.
- Implement page replacement algorithms (FIFO, LRU, Optimal).
- Write a program to simulate allocation and deallocation of memory blocks using First Fit, Best Fit, and Worst Fit algorithms.
Question 8: File System Implementation
- Objective: Understand file system operations and implement basic file management.
- Tasks:
- Write a program to simulate the creation, deletion, and manipulation of files in a directory.
- Implement file allocation methods (Contiguous, Linked, Indexed).
- Simulate disk scheduling algorithms (FCFS, SSTF, SCAN, C-SCAN).
Question 9: Virtual Memory Management
- Objective: Work with virtual memory and page management.
- Tasks:
- Implement a simulation of virtual memory using paging.
- Write a program to simulate the demand paging concept.
- Simulate page replacement policies (FIFO, LRU).
- Implement a program to track page faults during process execution.
Question 10: Disk Scheduling Algorithms
- Objective: Understand and implement various disk scheduling algorithms.
- Tasks:
- Simulate First-Come-First-Served (FCFS) disk scheduling.
- Implement Shortest Seek Time First (SSTF) disk scheduling.
- Write a program to simulate SCAN, C-SCAN disk scheduling.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.