[go: up one dir, main page]

0% found this document useful (0 votes)
11 views7 pages

Aos

Uploaded by

a90685766
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

Aos

Uploaded by

a90685766
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

General Viva Questions

1. What are the key differences between a process and a thread?

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.

2. Explain the role of a file descriptor in file I/O operations.

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.

3. How does the kernel handle interprocess communication? Provide examples.

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.

4. What is a race condition? How can it be prevented in operating systems?

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 A regular file stores data like text or binary.


A directory file stores filenames and pointers to their metadata.
A symbolic link is a special file that points to another file or directory.

File and Directory I/O

6. Explain the significance of the stat structure in file management.

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.

Buffer Block and Free List Allocation

11. What is the purpose of a buffer header in a buffer pool?

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.

o A buffer pool is a collection of in-memory buffers managed by the kernel. It optimizes


disk I/O by caching frequently accessed disk blocks.

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.

Process Environment and Control

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.

19. Explain the purpose of the atexit() function in process management.

o atexit() registers a function to be executed when the program terminates, ensuring


cleanup operations are performed.

20. Describe the different sections of a process (stack, heap, text, data).

o Stack: Temporary data like function calls and variables.


Heap: Dynamically allocated memory.
Text: Executable code.
Data: Global and static variables.

Memory Management

21. How is memory allocated dynamically in C using malloc and free?

o malloc allocates a block of memory on the heap, while free releases it to prevent
memory leaks.

22. What is the significance of shared memory in interprocess communication?

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 Using the signal() or sigaction() function to define a handler function.

28. Explain the purpose of the kill system call.

o The kill system call sends a specific signal to a process or group of processes.

29. What is the role of sigprocmask in signal handling?

o sigprocmask modifies the signal mask, blocking or unblocking specific signals.

30. How can signals be used to suspend and resume processes?

o Signals like SIGSTOP suspend a process, while SIGCONT resumes it.

Virtualization

31. What is virtualization, and how does it differ from containerization?

o Virtualization abstracts hardware to run multiple operating systems on a single machine.


Containerization isolates applications using shared OS resources.

32. Describe the types of virtualization (e.g., server, network, and storage virtualization).

o Server virtualization abstracts physical servers.


Network virtualization creates virtual network devices.
Storage virtualization pools physical storage into a virtual resource.

33. What is a hypervisor? Explain the difference between bare-metal and hosted hypervisors.

o A hypervisor manages virtual machines.


Bare-metal runs directly on hardware, while hosted runs on an existing OS.

34. What are the advantages and disadvantages of virtualization?

o Advantages: Efficient hardware use, scalability, disaster recovery.


Disadvantages: Overhead, licensing costs, complexity.

35. Explain the concept of virtual machine migration in a virtualized environment.

o Migration moves a running VM from one host to another for load balancing or
maintenance.

Containerization

36. What is containerization, and why is it important in modern software development?


o Containerization packages applications and dependencies into isolated environments,
ensuring consistency and portability across platforms.

37. Explain the key components of Docker (e.g., Docker Engine, Docker Image, Docker Hub).

o Docker Engine runs containers.


Docker Image contains app dependencies.
Docker Hub is a repository for sharing images.

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.

39. How does Docker Compose facilitate multi-container applications?

o Docker Compose defines and manages multiple containers in a single YAML


configuration file.

40. Describe the states of a Docker container.

o Created: Defined but not running.


Running: Active.
Paused: Temporarily stopped.
Stopped: Completed or halted.

Zoning

41. What is zoning, and how is it implemented in an operating system?

o Zoning is a lightweight virtualization technique that provides isolated environments


within a single OS instance. Each zone acts as an independent user space with its own
processes, files, and configurations, implemented using OS-level features like containers.

42. What are the benefits and challenges of 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.

43. Why is zoning used in virtual memory management?

o Zoning separates memory spaces for different processes or tenants, ensuring isolation,
preventing interference, and optimizing resource allocation.

44. What are some use cases for zones?

o Development and testing environments, multi-tenant application hosting, isolated


network services, and resource-efficient server management.
45. What is the difference between Zones and Virtual Machines (VMs)?

o Zones share a single OS kernel, offering lightweight isolation and efficiency.


VMs virtualize the entire hardware stack, running independent OS instances with greater
overhead but stronger isolation.

Lab Assignments and Key Concepts

46. Explain the concept of a free list in buffer management.

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.

47. What is a delayed write in buffer allocation?

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?

o bwrite: Writes buffer data to disk.


getblk: Allocates a buffer for a disk block.
brelse: Releases a buffer back to the free list.

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

51. What is a hypervisor, and why is it essential in virtualization?

o A hypervisor is software that enables multiple operating systems to run on shared


hardware by virtualizing the underlying resources. It is crucial for creating and managing
virtual machines.

52. Describe the differences between containerization and traditional VMs.

o Containers are lightweight, share the host OS kernel, and are faster to deploy. VMs
virtualize hardware, have greater isolation, and are resource-intensive.

53. What is the significance of Docker Compose?


o Docker Compose simplifies the management of multi-container applications by defining
services, networks, and volumes in a single YAML file.

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.

55. What are the states of processes in Linux?

o Running: Actively using CPU.


Waiting: Waiting for a resource.
Stopped: Suspended by a signal.
Zombie: Process has terminated but is not yet reaped by the parent.

Practical Viva Scenarios

56. How would you troubleshoot insufficient balance issues in a banking application?

o Verify interprocess communication using semaphores or mutexes to ensure race


conditions do not lead to incorrect balance updates.

57. What are the advantages of using LRU in buffer management?

o LRU ensures the most recently accessed buffers are retained, optimizing performance by
reducing disk I/O for frequently accessed data.

58. What system calls are used for signal handling?

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?

o Synchronization is managed using semaphores or mutexes, ensuring that only one


process modifies the balance at a time, avoiding race conditions.

60. What are some real-world applications of zoning?

o Hosting multiple applications on shared infrastructure, isolating development


environments, and securing multi-tenant systems.

You might also like