{"id":22793880,"url":"https://github.com/codewithjaspreet/company-wise","last_synced_at":"2025-04-17T14:18:24.683Z","repository":{"id":113572225,"uuid":"585536813","full_name":"codewithjaspreet/Company-Wise","owner":"codewithjaspreet","description":"Collections of Company Wise DSA questions done during my job hunt \u0026 Core Subject Materials ","archived":false,"fork":false,"pushed_at":"2023-03-26T14:22:24.000Z","size":4102,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T06:11:26.517Z","etag":null,"topics":["algorithms","computer-networks","dbms","dsa","oops-in-java","operating-system"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithjaspreet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-05T12:27:27.000Z","updated_at":"2025-03-05T04:58:26.000Z","dependencies_parsed_at":"2023-03-16T05:00:55.736Z","dependency_job_id":null,"html_url":"https://github.com/codewithjaspreet/Company-Wise","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithjaspreet%2FCompany-Wise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithjaspreet%2FCompany-Wise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithjaspreet%2FCompany-Wise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithjaspreet%2FCompany-Wise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithjaspreet","download_url":"https://codeload.github.com/codewithjaspreet/Company-Wise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249347472,"owners_count":21255150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","computer-networks","dbms","dsa","oops-in-java","operating-system"],"created_at":"2024-12-12T03:42:22.596Z","updated_at":"2025-04-17T14:18:24.671Z","avatar_url":"https://github.com/codewithjaspreet.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Operating System InterviewQuestions\n\n## Microsoft SDE sheet : \n\nhttps://docs.google.com/document/d/1uY8U4JFndDC0gDxqrGxQSL5a8EViVy5eKBA8jTQYyNs/edit?usp=sharing\n## Gfg Last Minutes Notes:\n\nhttps://www.geeksforgeeks.org/last-minute-notes-operating-systems/\n\n## Basic OS Interview Questions\n\n### 1.    Why is the operating system important?\n\n### 2.    What's the main purpose of an OS? What are the different types of OS?\n\n### 3.    What are the benefits of a multiprocessor system?\n\n### 4.    What is RAID structure in OS? What are the different levels of RAID configuration?\n\n### 5.    What is GUI?\n\n### 6.    What is a Pipe and when it is used?\n\n### 7.    What are the different kinds of operations that are possible on semaphore?\n\n### 8.    What is a bootstrap program in OS?\n\n### 9.    Explain demand paging?\n\n### 10.    What do you mean by RTOS?\n\n### 11.    What do you mean by process synchronization?\n\n### 12.    What is IPC? What are the different IPC mechanisms?\n\n### 13.    What is different between main memory and secondary memory.\n\n### 14.    What do you mean by overlays in OS?\n\n### 15.    Write top 10 examples of OS?\n\n## Intermediate OS Interview Questions\n\n### 16.    What is virtual memory?\n\n### 17.    What is thread in OS?\n\n### 18.    What is a process? What are the different states of a process?\n\n# Contents\n\n### Intermediate OS Interview Questions (.....Continued)\n\n### 19.    What do you mean by FCFS?\n\n### 20.    What is Reentrancy?\n\n### 21.    What is a Scheduling Algorithm? Name different types of scheduling algorithms.\n\n### 22.    What is the difference between paging and segmentation?\n\n### 23.    What is thrashing in OS?\n\n### 24.    What is the main objective of multiprogramming?\n\n### 25.    What do you mean by asymmetric clustering?\n\n### 26.    What is the difference between multitasking and multiprocessing OS?\n\n### 27.    What do you mean by Sockets in OS?\n\n### 28.    Explain zombie process?\n\n### 29.    What do you mean by cascading termination?\n\n### 30.    What is starvation and aging in OS?\n\n### Advanced OS Interview Questions\n\n### 31.    What do you mean by Semaphore in OS? Why is it used?\n\n### 32.    What is Kernel and write its main functions?\n\n### 33.    What are different types of Kernel?\n\n### 34.    Write difference between micro kernel and monolithic kernel?\n\n### 35.    What is SMP (Symmetric Multiprocessing)?\n\n### 36.    What is a time-sharing system?\n\n### Advanced OS Interview Questions (.....Continued)\n\n### 37.    What is Context Switching?\n\n### 38.    What is difference between Kernel and OS?\n\n### 39.    What is difference between process and thread?\n\n### 40.    What are various sections of the process?\n\n### 41.    What is a deadlock in OS? What are the necessary conditions for a deadlock?\n\n### 42.    What do you mean by Belady’s Anomaly?\n\n### 43.    What is spooling in OS?\n\n##### What do you mean by an operating system? What are its basic\n\n##### functions?\n\nOperating System (OS) is basically a soware program that manages and handles all\nresources of a computer such as hardware and soware. The first OS was introduced\nin the early 1950s known as GMOs. An OS is responsible for managing, handling, and\ncoordinating overall activities and sharing of computer resources. It acts as an\nintermediary among users of computer and computer hardware.\n\n**Functions of OS:**\nThere are many functions of the OS. Some of the important functions of OS are given\nbelow:\n\n# Let's get Started\n\n```\nMemory and Processor Management\nProviding user interface to users\nFile Management and Device Management\nScheduling of resources and jobs\nError Detection\nSecurity\n```\n\n### Basic OS Interview Questions\n\n#### 1.   Why is the operating system important?\n\nOS is the most essential and vital part of a computer without which it is considered\nuseless. It enables an interface or acts like a link for interaction between computer\nsoware that is installed on OS and users. It also helps to communicate with\nhardware and also maintains balance among hardware and CPU. It also provides\nservices to users and a platform for programs to run on. It performs all common tasks\napplications require.\n\n#### 2.   What's the main purpose of an OS? What are the different\n\n#### types of OS?\n\nThe main purpose of an OS is to execute user programs and make it easier for users\nto understand and interact with computers as well as run applications. It is specially\ndesigned to ensure that the computer system performs better by managing all\ncomputational activities. It also manages computer memory, processes, and\noperation of all hardware and soware.\n\n**Types of OS:**\n\n```\nBatched OS (Example: Payroll System, Transactions Process, etc.)\nMulti-Programmed OS (Example: Windows O/S, UNIX O/S, etc.)\nTimesharing OS (Example: Multics, etc.)\nDistributed OS (LOCUS, etc.)\nReal-Time OS (PSOS, VRTX, etc.)\n```\n\n#### 3.   What are the benefits of a multiprocessor system?\n\nA Multiprocessor system is a type of system that includes two or more CPUs. It\ninvolves the processing of different computer programs at the same time mostly by a\ncomputer system with two or more CPUs that are sharing single memory.\n\n**Benefits:**\n\n```\nSuch systems are used widely nowadays to improve performance in systems\nthat are running multiple programs concurrently. \nBy increasing the number of processors, a greater number of tasks can be\ncompleted in unit time. \nOne also gets a considerable increase in throughput and is cost-effective also as\nall processors share the same resources.\nIt simply improves the reliability of the computer system.\n```\n\n#### 4.   What is RAID structure in OS? What are the different levels of\n\n#### RAID configuration?\n\nRAID (Redundant Arrays of Independent Disks) is a method used to store data on\nMultiple hard disks therefore it is considered as data storage virtualization\ntechnology that combines multiple hard disks. It simply balances data protection,\nsystem performance, storage space, etc. It is used to improve the overall\nperformance and reliability of data storage. It also increases the storage capacity of\nthe system and its main purpose is to achieve data redundancy to reduce data loss.\n\n**Different levels of RAID**\n\nNowadays, RAID is available in various schemes or RAID level as given below:\n\n```\nRAID 0 - Non-redundant striping: This level is used to increase the performance\nof the server.\nRAID 1 - Mirroring and duplexing: This level is also known as disk mirroring and is\nconsidered the simplest way to implement fault tolerance.\nRAID 2 - Memory-style error-correcting codes: This level generally uses dedicated\nhamming code parity I.e., a liner form of error correction code.\nRAID 3 - Bit-interleaved Parity: This level requires a dedicated parity drive to\nstore parity information.\nRAID 4 - Block-interleaved Parity: This level is similar to RAID 5 but the only\ndifference is that this level confines all parity data to a single drive.\nRAID 5 - Block-interleaved distributed Parity: This level provides far better\nperformance than disk mirroring and fault tolerance.\nRAID 6 - P+Q Redundancy: This level generally provides fault tolerance for two\ndrive failures.\n```\n\n#### 5.   What is GUI?\n\nGUI (Graphical User Interface) is basically a type of user interface that allows users to\nuse graphics to interact with OS. GUI is created because it is more user-friendly, less\ncomplex, and easier to understand rather than a command-line interface. Its main\ngoal is to increase efficiency and ease of use. Instead of having to memorize\ncommands, users can just click on a button to simply execute the procedure.\nExamples of GUI include Microso Windows, macOS, Apple’s iOS, etc.\n\n#### 6.   What is a Pipe and when it is used?\n\nThe pipe is generally a connection among two or more processes that are\ninterrelated to each other. It is a mechanism that is used for inter-process\ncommunication using message passing.  One can easily send information such as the\noutput of one program process to another program process using a pipe. It can be\nused when two processes want to communicate one-way i.e., inter-process\ncommunication (IPC).\n\n#### 7.   What are the different kinds of operations that are possible\n\n#### on semaphore?\n\nThere are basically two atomic operations that are possible:\n\n```\nWait()\nSignal()\n```\n\n#### 8.   What is a bootstrap program in OS?\n\nIt is generally a program that initializes OS during startup i.e., first code that is\nexecuted whenever computer system startups. OS is loaded through a bootstrapping\nprocess or program commonly known as booting. Overall OS only depends on the\nbootstrap program to perform and work correctly. It is fully stored in boot blocks at a\nfixed location on the disk. It also locates the kernel and loads it into the main\nmemory aer which the program starts its execution.\n\n#### 9.   Explain demand paging?\n\nDemand paging is a method that loads pages into memory on demand. This method\nis mostly used in virtual memory. In this, a page is only brought into memory when a\nlocation on that particular page is referenced during execution. The following steps\nare generally followed:\n\n```\nAttempt to access the page.\nIf the page is valid (in memory) then continue processing instructions as normal.\nIf a page is invalid then a page-fault trap occurs.\nCheck if the memory reference is a valid reference to a location on secondary\nmemory. If not, the process is terminated ( illegal memory access ). Otherwise,\nwe have to page in the required page.\nSchedule disk operation to read the desired page into main memory.\nRestart the instruction that was interrupted by the operating system trap.\n```\n\n#### 10.   What do you mean by RTOS?\n\nReal Time Operating System (RTOS) is an operating system that is used for real-time\napplications i.e., for those applications where data processing should be done in a\nfixed and small measure of time. It performs much better on tasks that are needed to\nbe executed within a short time. It also takes care of execution, monitoring, and all-\ncontrolling processes. It also occupies less memory and consumes fewer resources.\n\n**Types of RTOS:**\n\n```\nHard Real-Time\nFirm Real-Time\nSo Real-Time\n```\n\nRTOS is used in Air traffic control systems, Anti-lock Brake Systems, and Heart\npacemakers.\n\n#### 11.   What do you mean by process synchronization?\n\nProcess synchronization is basically a way to coordinate processes that use shared\nresources or data. It is very much essential to ensure synchronized execution of\ncooperating processes so that will maintain data consistency. Its main purpose is to\nshare resources without any interference using mutual exclusion. There are two\ntypes of process synchronization:\n\n```\nIndependent Process\nCooperative Process\n```\n\n#### 12.   What is IPC? What are the different IPC mechanisms?\n\nIPC (Interprocess Communication) is a mechanism that requires the use of resources\nlike a memory that is shared between processes or threads. With IPC, OS allows\ndifferent processes to communicate with each other. It is simply used for exchanging\ndata between multiple threads in one or more programs or processes. In this\nmechanism, different processes can communicate with each other with the approval\nof the OS.\n\n**Different IPC Mechanisms:**\n\n```\nPipes\nMessage Queuing\nSemaphores\nSocket\nShared Memory\nSignals\n```\n\n#### 13.   What is different between main memory and secondary\n\n#### memory.\n\n**Main memory:** Main memory in a computer is RAM (Random Access Memory). It is\nalso known as primary memory or read-write memory or internal memory. The\nprograms and data that the CPU requires during the execution of a program are\nstored in this memory.\n**Secondary memory:** Secondary memory in a computer are storage devices that can\nstore data and programs. It is also known as external memory or additional memory\nor backup memory or auxiliary memory. Such storage devices are capable of storing\nhigh-volume data. Storage devices can be hard drives, USB flash drives, CDs, etc.\n\n```\nPrimary Memory Secondary Memory\n```\n\n```\nData can be directly\naccessed by the processing\nunit.\n```\n\n```\nFirstly, data is transferred to\nprimary memory and aer\nthen routed to the processing\nunit.\n```\n\n```\nIt can be both volatile and\nnon-volatile in nature.\n```\n\n```\nIt is non-volatile in nature.\n```\n\n```\nIt is more costly than\nsecondary memory.\n```\n\n```\nIt is more cost-effective or less\ncostly than primary memory.\n```\n\n```\nIt is temporary because\ndata is stored temporarily.\n```\n\n```\nIt is permanent because data\nis stored permanently.\n```\n\n```\nIn this memory, data can be\nlost whenever there is a\npower failure.\n```\n\n```\nIn this memory, data is stored\npermanently and therefore\ncannot be lost even in case of\npower failure.\n```\n\n```\nIt is much faster than\nsecondary memory and\nsaves data that is currently\nused by the computer.\n```\n\n```\nIt is slower as compared to\nprimary memory and saves\ndifferent kinds of data in\ndifferent formats.\n```\n\n```\nIt can be accessed by data. It can be accessed by I/O\nchannels.\n```\n\n#### 14.   What do you mean by overlays in OS?\n\nOverlays is basically a programming method that divides processes into pieces so\nthat instructions that are important and need can be saved in memory. It does not\nneed any type of support from the OS. It can run programs that are bigger in size than\nphysical memory by only keeping only important data and instructions that can be\nneeded at any given time.\n\n#### 15.   Write top 10 examples of OS?\n\nSome of the top OS’s that are used mostly are given below:\n\n```\nMS-Windows\nUbuntu\nMac OS\nFedora\nSolaris\nFree BSD\nChrome OS\nCentOS\nDebian\nAndroid\n```\n\n### Intermediate OS Interview Questions\n\n#### 16.   What is virtual memory?\n\nIt is a memory management technique feature of OS that creates the illusion to users\nof a very large (main) memory. It is simply space where a greater number of programs\ncan be stored by themselves in the form of pages. It enables us to increase the use of\nphysical memory by using a disk and also allows us to have memory protection. It can\nbe managed in two common ways by OS i.e., paging and segmentation. It acts as\ntemporary storage that can be used along with RAM for computer processes.\n\n#### 17.   What is thread in OS?\n\nThread is a path of execution that is composed of a program counter, thread id,\nstack, and set of registers within the process. It is a basic unit of CPU utilization that\nmakes communication more effective and efficient, enables utilization of\nmultiprocessor architectures to a greater scale and greater efficiency, and reduces\nthe time required in context switching. It simply provides a way to improve and\nincrease the performance of applications through parallelism. Threads are\nsometimes called **lightweight processes** because they have their own stack but can\naccess shared data.\n\nMultiple threads running in a process share: Address space, Heap, Static data, Code\nsegments, File descriptors, Global variables, Child processes, Pending alarms, Signals,\nand signal handlers.\n\nEach thread has its own: Program counter, Registers, Stack, and State.\n\n#### 18.   What is a process? What are the different states of a\n\n#### process?\n\nThe process is basically a program that is currently under execution. The main\nfunction of an OS is to manage and handle all of these processes. When a program is\nloaded into the memory and it becomes a process, it can be divided into four\nsections ─ stack, heap, text, and data. There are two types of processes:\n\n```\n1. Operating System Processes\n2. User Processes\n```\n\n**States of Process:**\n\nDifferent states of the process through which process goes are given below:\n\n```\nNew State : In this state, a process is just created.\nRunning: In this state, the CPU starts working on the process’s instructions.\nWaiting: In this state, the process cannot run because it just waits for some\nevent to occur\nReady: In this state, the process has all resources available that are required to\nrun but it waits to get assigned to a processor because CPUs are not working\ncurrently on instructions passed by the process.\nTerminate: In this state, the process is completed I.e., the process has finished\nexecution.\n```\n\n#### 19.   What do you mean by FCFS?\n\n**FCFS** (First Come First Serve) is a type of OS scheduling algorithm that executes\nprocesses in the same order in which processes arrive. In simple words, the process\nthat arrives first will be executed first. It is non-preemptive in nature. FCFS scheduling\nmay cause the problem of starvation if the burst time of the first process is the\nlongest among all the jobs. Burst time here means the time that is required in\nmilliseconds by the process for its execution. It is also considered the easiest and\nsimplest OS scheduling algorithm as compared to others. Implementation of FCFS is\ngenerally managed with help of the FIFO (First In First Out) queue.\n\n#### 20.   What is Reentrancy?\n\nReentrant is simply a function in which various clients can use and shares a single\ncopy of a program during a similar period. This concept is generally associated with\nOS code and does not deal with concurrency. It has two major functions:\n\n```\nProgram code cannot change or modify itself.\nLocal data for every client process needs to be stored in different disks.\n```\n\n#### 21.   What is a Scheduling Algorithm? Name different types of\n\n#### scheduling algorithms.\n\nA scheduling algorithm is a process that is used to improve efficiency by utilizing\nmaximum CPU and providing minimum waiting time to tasks. It simply deals with the\nproblem of deciding which of outstanding requests is to be allocated resources. Its\nmain aim is to reduce resource starvation and to ensure fairness amongst parties\nthat are utilizing the resources. In simple words, it is used to allocate resources\namong various competing tasks.\n\n**Types of Scheduling Algorithm**\n\nThere are different types of scheduling algorithms as given below:\n\n#### 22.   What is the difference between paging and segmentation?\n\n**Paging:** It is generally a memory management technique that allows OS to retrieve\nprocesses from secondary storage into main memory. It is a non-contiguous\nallocation technique that divides each process in the form of pages. \n**Segmentation:** It is generally a memory management technique that divides\nprocesses into modules and parts of different sizes. These parts and modules are\nknown as segments that can be allocated to process.\n\n**Paging Segmentation**\n\nIt is invisible to a\nprogrammer.\n\n```\nIt is visible to a programmer.\n```\n\nIn this, the size of pages\nis fixed.\n\n```\nIn this, the size of segments is not\nfixed.\n```\n\nProcedures and data\ncannot be separated in\npaging.\n\n```\nProcedures and data can be\nseparated in segmentation.\n```\n\nIt allows a cumulative\ntotal of virtual address\nspaces to cross physical\nmain memory.\n\n```\nIt allows all programs, data, and\ncodes to break up into\nindependent address spaces.\n```\n\nIt is mostly available on\nCPUs and MMU chips.\n\n```\nIt is mostly available on Windows\nservers that may support\nbackward compatibility, while\nLinux has limited support.\n```\n\nIt is faster for memory\naccess as compared to\nsegmentation.\n\n```\nIt is slower as compared to paging.\n```\n\nIn this, OS needs to\nmaintain a free frame.\n\n```\nIn this, OS needs to maintain a list\nof holes in the main memory.\n```\n\nIn paging, the type of\nfragmentation is\ninternal.\n\n```\nIn segmentation, the type of\nfragmentation is external.\n```\n\nThe size of the page is\ndetermined by\navailable memory.\n\n```\nThe size of the page is determined\nby the user.\n```\n\n#### 23.   What is thrashing in OS?\n\nIt is generally a situation where the CPU performs less productive work and more\nswapping or paging work. It spends more time swapping or paging activities rather\nthan its execution. By evaluating the level of CPU utilization, a system can detect\nthrashing. It occurs when the process does not have enough pages due to which the\npage-fault rate is increased. It inhibits much application-level processing that causes\ncomputer performance to degrade or collapse.\n\n#### 24.   What is the main objective of multiprogramming?\n\nIt refers to the ability to execute or perform more than one program on a single\nprocessor machine. This technique was introduced to overcome the problem of\nunderutilization of CPU and main memory. In simple words, it is the coordination of\nexecution of various programs simultaneously on a single processor (CPU). The main\nobjective of multiprogramming is to have at least some processes running at all\ntimes. It simply improves the utilization of the CPU as it organizes many jobs where\nthe CPU always has one to execute.\n\n#### 25.   What do you mean by asymmetric clustering?\n\nAsymmetric Clustering is generally a system in which one of the nodes among all\nnodes is in hot standby mode whereas the rest of all nodes run different applications.\nIt simply uses whole or entire hardware resources therefore it is considered a more\nreliable system as compared to others.\n\n#### 26.   What is the difference between multitasking and\n\n#### multiprocessing OS?\n\n**Multitasking:** It is a system that allows more efficient use of computer hardware.\nThis system works on more than one task at one time by rapidly switching between\nvarious tasks. These systems are also known as time-sharing systems.\n\n**Multiprocessing:** It is a system that allows multiple or various processors in a\ncomputer to process two or more different portions of the same program\nsimultaneously. It is used to complete more work in a shorter period of time.\n\n```\nMultitasking Multiprocessing\n```\n\n```\nIt performs more than one\ntask at a time using a single\nprocessor.\n```\n\n```\nIt performs more than one\ntask at a time using multiple\nprocessors.\n```\n\n```\nIn this, the number of CPUs is\nonly one.\n```\n\n```\nIn this, the number of CPUs\nis more than one.\n```\n\n```\nIt is more economical. It is less economical.\n```\n\n```\nIt is less efficient than\nmultiprocessing.\n```\n\n```\nIt is more efficient than\nmultitasking.\n```\n\n```\nIt allows fast switching among\nvarious tasks.\n```\n\n```\nIt allows smooth processing\nof multiple tasks at once.\n```\n\n```\nIt requires more time to\nexecute tasks as compared to\nmultiprocessing.\n```\n\n```\nIt requires less time for job\nprocessing as compared to\nmultitasking.\n```\n\n#### 27.   What do you mean by Sockets in OS?\n\nThe socket in OS is generally referred to as an endpoint for IPC (Interprocess\nCommunication). Here, the endpoint is referred to as a combination of an IP address\nand port number.  Sockets are used to make it easy for soware developers to create\nnetwork-enabled programs. It also allows communication or exchange of\ninformation between two different processes on the same or different machines. It is\nmostly used in client-server-based systems.\n\n**Types of Sockets**\n\nThere are basically four types of sockets as given below:\n\n```\nStream Sockets\nDatagram Sockets\nSequenced Packet Sockets\nRaw Sockets\n```\n\n#### 28.   Explain zombie process?\n\nZombie process, referred to as a defunct process, is basically a process that is\nterminated or completed but the whole process control block is not cleaned up from\nthe main memory because it still has an entry in the process table to report to its\nparent process. It does not consume any of the resources and is dead, but it still\nexists. It also shows that resources are held by process and are not free.\n\n#### 29.   What do you mean by cascading termination?\n\nCascading termination is a process termination in which if the parent process is\nexiting or terminating then the children process will also get terminated. It does not\nallow the child to continue processing as its parent process terminates. It is generally\ninitiated by OS.\n\n#### 30.   What is starvation and aging in OS?\n\n**Starvation:** It is generally a problem that usually occurs when a process has not been\nable to get the required resources it needs for progress with its execution for a long\nperiod of time. In this condition, low priority processes get blocked and only high\npriority processes proceed towards completion because of which low priority\nprocesses suffer from lack of resources.\n\n**Aging:** It is a technique that is used to overcome the situation or problem of\nstarvation. It simply increases the priority of processes that wait in the system for\nresources for a long period of time. It is considered the best technique to resolve the\nproblem of starvation as it adds an aging factor to the priority of each and every\nrequest by various processes for resources. It also ensures that low-level queue jobs\nor processes complete their execution.\n\n### Advanced OS Interview Questions\n\n#### 31.   What do you mean by Semaphore in OS? Why is it used?\n\nSemaphore is a signaling mechanism. It only holds one positive integer value. It is\nsimply used to solve the problem or issue of critical sections in the synchronization\nprocess by using two atomic operations i.e., wait() and signal().\n\n**Types of Semaphore**\nThere are usually two types of semaphores as given below:\n\n```\nBinary Semaphore\nCounting Semaphore\n```\n\n```\nBinary Semaphore Mutex\n```\n\n```\nIt allows various process threads\nto get the finite instance of the\nresource until resources are\navailable.\n```\n\n```\nIt allows various process\nthreads to get single\nshared resource only at\na time.\n```\n\n```\nIts functions are based upon\nsignaling mechanisms.\n```\n\n```\nIts functions are based\nupon a locking\nmechanism.\n```\n\n```\nBinary semaphores are much\nfaster as compared to Mutex.\n```\n\n```\nMutex is slower as\ncompared to binary\nsemaphores.\n```\n\n```\nIt is basically an integer. It is basically an object.\n```\n\n#### 32.   What is Kernel and write its main functions?\n\nThe kernel is basically a computer program usually considered as a central\ncomponent or module of OS. It is responsible for handling, managing, and\ncontrolling all operations of computer systems and hardware. Whenever the system\nstarts, the kernel is loaded first and remains in the main memory. It also acts as an\ninterface between user applications and hardware.\n\n**Functions of Kernel:**\n\n```\nIt is responsible for managing all computer resources such as CPU, memory,\nfiles, processes, etc.\nIt facilitates or initiates the interaction between components of hardware and\nsoware.\nIt manages RAM memory so that all running processes and programs can work\neffectively and efficiently.\nIt also controls and manages all primary tasks of the OS as well as manages\naccess and use of various peripherals connected to the computer.\nIt schedules the work done by the CPU so that the work of each user is executed\nas efficiently as possible.\n```\n\n#### 33.   What are different types of Kernel?\n\nThere are basically five types of Kernels as given below:\n\n```\nMonolithic Kernel\nMicroKernel\nHybrid Kernel \nNano Kernel\nExo Kernel\n```\n\n#### 34.   Write difference between micro kernel and monolithic\n\n#### kernel?\n\n**MicroKernel** : It is a minimal OS that executes only important functions of OS. It only\ncontains a near-minimum number of features and functions that are required to\nimplement OS. \nExample: QNX, Mac OS X, K42, etc.\n\n**Monolithic Kernel:** It is an OS architecture that supports all basic features of\ncomputer components such as resource management, memory, file, etc. \nExample: Solaris, DOS, OpenVMS, Linux, etc.\n\n```\nMicroKernel Monolithic Kernel\n```\n\n```\nIn this soware or program,\nkernel services and user\nservices are present in\ndifferent address spaces.\n```\n\n```\nIn this soware or program,\nkernel services and user\nservices are usually present in\nthe same address space.\n```\n\n```\nIt is smaller in size as\ncompared to the\nmonolithic kernel.\n```\n\n```\nIt is larger in size as compared\nto a microkernel.\n```\n\n```\nIt is easily extendible as\ncompared to a monolithic\nkernel.\n```\n\n```\nIt is hard to as extend as\ncompared to a microkernel.\n```\n\n```\nIf a service crashes, it does\naffect on working of the\nmicrokernel.\n```\n\n```\nIf a service crashes, the whole\nsystem crashes in a\nmonolithic kernel.\n```\n\n```\nIt uses message queues to\nachieve inter-process\ncommunication.\n```\n\n```\nIt uses signals and sockets to\nachieve inter-process\ncommunication.\n```\n\n#### 35.   What is SMP (Symmetric Multiprocessing)?\n\nSMP is generally referred to as computer architecture in which the processing of\nprograms is done by multiple processors that share a common OS and memory. SMP\nis very much required if you want to take advantage of multiprocessor hardware. It\nsimply enables any processor to work on any of the tasks no matter where data or\nresources for that particular task are located in memory. These systems are more\nreliable than single-processor systems.\n\n#### 36.   What is a time-sharing system?\n\nIt is a system that allows more than one user to access the resources of a particular\nsystem in many locations. In simple words, it performs multiple tasks on a single\nprocessor or CPU. As the name suggests, it means to share time into multiple slots in\nseveral processes. It also allows different users from different locations to use a\nparticular computer system at the same time therefore it is considered one of the\nimportant types of OS.\n\n#### 37.   What is Context Switching?\n\nContext switching is basically a process of saving the context of one process and\nloading the context of another process. It is one of the cost-effective and time-saving\nmeasures executed by CPU the because it allows multiple processes to share a single\nCPU. Therefore, it is considered an important part of a modern OS. This technique is\nused by OS to switch a process from one state to another i.e., from running state to\nready state. It also allows a single CPU to handle and control various different\nprocesses or threads without even the need for additional resources.\n\n#### 38.   What is difference between Kernel and OS?\n\n**Kernel:** Kernel is a system program that controls all programs running on the\ncomputer. The kernel is basically a bridge between the soware and hardware of the\nsystem.\n\n**Operating System:** Operating system is a system program that runs on the computer\nto provide an interface to the computer user so that they can easily operate on the\ncomputer.\n\n```\nKernel OS\n```\n\n```\nIt is considered a central\ncomponent of OS\n```\n\n```\nIt is considered system soware.\n```\n\n```\nIt is generally\nresponsible for\nconverting user\ncommands into\nmachine-level\ncommands.\n```\n\n```\nIt is generally responsible for\nmanaging the resources of\nsystem.\n```\n\n```\nIt simply acts as an\ninterface between\nhardware and\napplications.\n```\n\n```\nIt simply acts as an interface\nbetween hardware and user.\n```\n\n```\nIt also performs\nfunctions like process\nmanagement, file\nmanagement, device\nmanagement, I/O\ncommunication, etc.\n```\n\n```\nIt also performs functions like\nproviding security to data and\nfiles in the the system, providing\naccess controls to users,\nmaintaining the system privacy,\netc.\n```\n\n```\nIts type includes\nMicrokernel, Monolithic\nkernel, etc.\n```\n\n```\nIts type includes Single and\nMultiprogramming batch\nsystems, Distributed OS, Real-\ntime OS.\n```\n\n#### 39.   What is difference between process and thread?\n\n**Process:** It is basically a program that is currently under execution by one or more\nthreads. It is a very important part of the modern-day OS.\n\n**Thread:** It is a path of execution that is composed of the program counter, thread id,\nstack, and set of registers within the process.\n\n**Process Thread**\n\nIt is a computer program\nthat is under execution.\n\n```\nIt is the component or entity\nof the process that is the\nsmallest execution unit.\n```\n\nThese are heavy-weight\noperators.\n\n```\nThese are lightweight\noperators.\n```\n\nIt has its own memory space. It uses the memory of theprocess they belong to.\n\nIt is more difficult to create a\nprocess as compared to\ncreating a thread.\n\n```\nIt is easier to create a thread\nas compared to creating a\nprocess.\n```\n\nIt requires more resources as\ncompared to thread.\n\n```\nIt requires fewer resources as\ncompared to processes.\n```\n\nIt takes more time to create\nand terminate a process as\ncompared to a thread.\n\n```\nIt takes less time to create\nand terminate a thread as\ncompared to a process.\n```\n\nIt usually run-in separate\nmemory space.\n\n```\nIt usually run-in shared\nmemory space.\n```\n\nIt does not share data. It shares data with eachother.\n\nIt can be divided into\nmultiple threads.\n\n```\nIt can’t be further\nsubdivided.\n```\n\n#### 40.   What are various sections of the process?\n\nThere are basically four sections in the process as given below:\n\n```\nStack: It is used for local variables and returns addresses. \nHeap: It is used for dynamic memory allocation.\nData : It stores global and static variables.\nCode or text: It comprises compiled program code.\n```\n\n#### 41.   What is a deadlock in OS? What are the necessary conditions\n\n#### for a deadlock?\n\nDeadlock is generally a situation where a set of processes are blocked as each process\nis holding resources and waits to acquire resources held by another process. In this\nsituation, two or more processes simply try to execute simultaneously and wait for\neach to finish their execution because they are dependent on each other. We can see\na hand problem in our system whenever a deadlock occurs in a program. It is one of\nthe common problems you can see in multiprocessing.\n\n**Necessary Conditions for Deadlock**\n\nThere are basically four necessary conditions for deadlock as given below:\n\n```\nMutual Exclusion\nHold and Wait\nNo Pre-emption\nCircular Wait or Resource Wait\n```\n\n#### 42.   What do you mean by Belady’s Anomaly?\n\nIn the Operating System, process data is loaded in fixed-sized chunks and each chunk\nis referred to as a page. The processor loads these pages in the fixed-sized chunks of\nmemory called frames. Belady’s Anomaly is a phenomenon in which if we increase\nthe number of frames in memory, then the number of page faults also increases. It is\ngenerally experienced when we use FIFO (First in First out) page replacement\nalgorithm.\n\n#### 43.   What is spooling in OS?\n\nSpooling simply stands for Simultaneous peripheral operations online. It is referred\nto as putting data of various I/O jobs in a buffer. Here, buffer means a special area in\nmemory or hard disk that can be accessible to an I/O device. It is used for mediation\nbetween a computer application and a slow peripheral. It is very useful and\nimportant because devices access or acquire data at different rates. This operation\nalso uses disk as a very large buffer and is capable of overlapping I/O operations for\none task with processor operations for another task.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithjaspreet%2Fcompany-wise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithjaspreet%2Fcompany-wise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithjaspreet%2Fcompany-wise/lists"}