OS Lab VIVA-2
OS Lab VIVA-2
o It changes file permissions (read, write, execute) for the owner, group, or others.
o cp: Copies files/directories; mv: Moves or renames files; rm: Deletes files.
o It reposi ons the read/write file offset, allowing access to a specific posi on in a file.
o >: Redirects output to a file; <: Takes input from a file; >>: Appends output.
7. What is the difference between if, elif, and else statements in shell scrip ng?
o if: First condi on check; elif: Addi onal condi on; else: Executes if all condi ons fail.
12. Describe the flow of opening, reading, and closing a file using system calls.
execlp() replaces the current process image; fork() creates a new process.
15. What are threads, and how are they created using pthread in Linux?
16. What are environment variables and how can they be accessed?
Variables that affect process behavior, accessed with getenv() or $VAR in shell.
Pipes allow data flow between processes; created using pipe() system call.
Unit 6: Synchroniza on
20. What is a race condi on and how can it be avoided using semaphores or mutexes?
Semaphores and mutexes ensure only one process/thread accesses the cri cal sec on at a
me.