Key Topics for DBMS, OS, and CN Interviews
Key Topics for DBMS, OS, and CN Interviews
Deadlock occurs when a set of processes become blocked because each process is holding a resource and waiting for another resource acquired by another process. Strategies to handle deadlocks include prevention (eliminating one of the four necessary conditions: mutual exclusion, hold and wait, no preemption, and circular wait), avoidance (using algorithms like Banker’s that require additional information about resource allocation), and detection (periodically checking for cycles in resource allocation graphs) followed by recovery through resource preemption or process termination .
Normalization is a database design technique that reduces redundancy and dependency by organizing fields and table relations. First Normal Form (1NF) eliminates repeating groups, Second Normal Form (2NF) removes subsets of data that apply to multiple rows, Third Normal Form (3NF) eliminates columns not dependent on primary keys, and Boyce-Codd Normal Form (BCNF) refines relationships to handle more complex dependencies. BCNF is necessary when a table has two candidate keys and attempts to enhance data integrity by ensuring that every determinant is a candidate key .
Preemptive scheduling allows the operating system to interrupt a currently running task to replace it with a new higher-priority task, which is ideal for real-time systems where tasks require strictly defined response times. Non-preemptive scheduling, on the other hand, allows a running task to complete its CPU burst before another task can use the CPU, which is better suited for batch systems where task turnaround time is more important, and priority conflicts are minimal .
DBMS (Database Management Systems) and RDBMS (Relational Database Management Systems) differ mainly in their implementation of relationships among data. DBMS handles data as a file while RDBMS uses tables where data is stored in a structured format using rows and columns. RDBMS enforces ACID properties (Atomicity, Consistency, Isolation, Durability) to ensure transaction reliability, which is crucial for maintaining database integrity in critical applications .
ACID properties—Atomicity, Consistency, Isolation, and Durability—ensure reliable database operations by providing a framework for transaction reliability. Atomicity guarantees that transactions are fully completed or not at all, Consistency ensures that databases remain in a valid state post-transaction, Isolation prevents concurrent transactions from interfering with each other, and Durability ensures persistence upon transaction completion. Without ACID, databases can encounter incomplete transactions, data anomalies, or loss during failures, severely affecting data accuracy and reliability .
TCP (Transmission Control Protocol) is connection-oriented and provides reliable data transfer with error checking and flow control, while UDP (User Datagram Protocol) is connectionless, allowing for faster data transfer at the cost of potential data loss. TCP is suitable for applications where data integrity is critical, such as file transfers and web pages, while UDP is preferred for real-time applications like video streaming or online gaming where speed is more crucial than reliability .
Semaphores and mutexes are synchronization tools to control access to shared resources in multi-threaded environments. A semaphore is a signaling mechanism, allowing or blocking access based on resource availability, and can allow multiple entities to access limited resources concurrently. A mutex is a locking mechanism, ensuring mutual exclusion by allowing only one entity to access a shared resource at a time. Mutexes are suited for situations requiring strict access control, while semaphores are more flexible for managing access across multiple threads by signaling .
Parity Bit error detection adds a single bit to a data sequence to ensure that the number of '1' bits is even (even parity) or odd (odd parity). It provides simple error detection but is not very robust. CRC (Cyclic Redundancy Check) performs polynomial division of the data and appends the resulting remainder to the data. It detects burst errors more effectively than parity bits. Parity is simple and quick but may miss errors, whereas CRC is computationally more intensive but can detect a wider range of errors .
Dijkstra’s algorithm is a link-state routing algorithm that computes the shortest paths from a source node to all nodes by progressively expanding nodes, applying the greedy approach. It requires knowledge of the entire network topology but provides fast, accurate path calculations. Distance Vector routing assigns each node a vector that holds the distance to all network nodes and uses Bellman-Ford algorithm principles to update paths based on information from neighboring nodes. It requires less initial data but can be slower in convergence and less accurate in larger, dynamic networks compared to Dijkstra's .
The OSI model organizes network communication into seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. The Physical layer transmits raw bit streams over physical medium, the Data Link layer provides node-to-node data transfer and error detection/correction, the Network layer handles routing and forwarding of data, the Transport layer provides end-to-end communication and error recovery, the Session layer manages sessions between applications, the Presentation layer ensures data is in a usable format, and the Application layer supports network services directly to applications .