What is operating systems Flashcards
What is an Operating System (OS)?
An Operating System (OS) is a software that acts as an intermediary between the hardware of a computer and the user or application programs. It manages hardware resources and provides a platform for applications to run.
Why do we need an Operating System?
We need an OS to manage hardware resources like memory, CPU, storage, and I/O devices. Without an OS, users would have to manually handle these tasks, which would be inefficient and impractical. The OS abstracts these complexities and provides a user-friendly interface.
What are the key functions of an Operating System?
The key functions of an OS include: 1) Process Management, 2) Memory Management, 3) File System Management, 4) Device Management, 5) Security and Access Control, 6) Networking, and 7) User Interface.
What is Process Management in an OS?
Process Management involves managing running processes (programs in execution). It handles CPU scheduling, multitasking, and ensures efficient use of the processor.
What is Memory Management in an OS?
Memory Management involves allocating and deallocating memory to processes. It handles virtual memory to optimize RAM usage and prevents processes from accessing each other’s memory (isolation).
What is File System Management in an OS?
File System Management organizes files and directories on storage devices. It manages file creation, deletion, and access permissions.
What is Device Management in an OS?
Device Management involves managing communication with hardware devices like printers, disks, etc. It provides device drivers to interact with hardware.
What is Security and Access Control in an OS?
Security and Access Control protect the system from unauthorized access. It manages user permissions and authentication.
What is Networking in an OS?
Networking enables communication between computers over a network. It manages protocols like TCP/IP, HTTP, etc.
What is a User Interface in an OS?
A User Interface provides a way for users to interact with the system, such as a Graphical User Interface (GUI) or Command-Line Interface (CLI).
What is the difference between a Process and a Thread?
A Process is an independent program in execution with its own memory space, while a Thread is a lightweight unit of execution within a process that shares the same memory space. Multithreading allows multiple threads to run concurrently within a single process.
What are Scheduling Algorithms in an OS?
Scheduling Algorithms determine how the CPU is allocated to processes. Common algorithms include: 1) First-Come-First-Serve (FCFS), 2) Shortest Job First (SJF), 3) Round Robin, and 4) Priority Scheduling.
What is Synchronization in an OS?
Synchronization ensures that multiple processes or threads do not simultaneously access shared resources, which could lead to race conditions. Tools like semaphores and mutexes are used to achieve synchronization.
What is a Deadlock in an OS?
A Deadlock is a situation where two or more processes are unable to proceed because each is waiting for the other to release a resource. The four conditions for deadlock are: 1) Mutual Exclusion, 2) Hold and Wait, 3) No Preemption, and 4) Circular Wait.
How can Deadlocks be prevented or avoided?
Deadlocks can be prevented by breaking one of the four conditions: 1) Avoid Mutual Exclusion, 2) Eliminate Hold and Wait, 3) Allow Preemption, or 4) Break Circular Wait. Deadlock Avoidance uses algorithms like the Banker’s Algorithm to ensure safe resource allocation.
What is Paging in Memory Management?
Paging is a memory management technique where physical memory is divided into fixed-size blocks called pages. Logical memory is also divided into pages of the same size. The OS maps logical pages to physical frames using a page table.
What is Virtual Memory?
Virtual Memory is a memory management technique that allows a system to use more memory than physically available by temporarily transferring data from RAM to disk storage. It enables efficient multitasking and prevents out-of-memory errors.
What is a File System in an OS?
A File System is a method used by an OS to organize and store files on a storage device. It manages file creation, deletion, access permissions, and directory structures.
What are the types of File Allocation Methods?
The types of File Allocation Methods are: 1) Contiguous Allocation, 2) Linked Allocation, and 3) Indexed Allocation. Each method has its own advantages and disadvantages in terms of efficiency and fragmentation.
What is I/O Management in an OS?
I/O Management involves handling input/output operations between the CPU and peripheral devices like keyboards, mice, printers, and disks. The OS uses device drivers and interrupt mechanisms to manage I/O operations efficiently.
What is a Kernel in an OS?
The Kernel is the core component of an OS. It manages system resources, communication between hardware and software, and ensures security and stability. It operates in kernel mode, which has unrestricted access to hardware.
What are the types of Operating Systems?
The types of Operating Systems include: 1) Batch OS, 2) Time-Sharing OS, 3) Distributed OS, 4) Network OS, 5) Real-Time OS, and 6) Embedded OS. Each type is designed for specific use cases.
What is Multitasking in an OS?
Multitasking is the ability of an OS to run multiple processes or tasks concurrently. It is achieved by rapidly switching the CPU between processes, giving the illusion of simultaneous execution.
What is Context Switching?
Context Switching is the process of saving the state of a currently running process and loading the state of another process so that it can be executed. It is essential for multitasking and is managed by the OS.
What is a Semaphore?
A Semaphore is a synchronization tool used to control access to shared resources. It is an integer variable that can be accessed only through two atomic operations: wait()
and signal()
. Semaphores can be binary (0 or 1) or counting.
What is a Mutex?
A Mutex (Mutual Exclusion) is a synchronization primitive used to prevent multiple threads from accessing a shared resource simultaneously. It ensures that only one thread can enter a critical section at a time.
What is a Critical Section?
A Critical Section is a segment of code in a program where shared resources are accessed. To prevent race conditions, only one process or thread can execute the critical section at a time. Synchronization tools like mutexes and semaphores are used to enforce this.
What is Thrashing in an OS?
Thrashing occurs when a system spends more time swapping pages between RAM and disk than executing processes. It happens when there is insufficient physical memory, leading to severe performance degradation.
What is a Page Fault?
A Page Fault occurs when a program tries to access a page that is not currently in physical memory (RAM). The OS handles page faults by loading the required page from disk into RAM.
What is the Banker’s Algorithm?
The Banker’s Algorithm is a deadlock avoidance algorithm. It checks if allocating resources to a process will leave the system in a safe state (where all processes can complete without causing a deadlock). It is used in resource allocation systems.
What is the difference between Preemptive and Non-Preemptive Scheduling?
In Preemptive Scheduling, the OS can interrupt a running process to allocate the CPU to another process. In Non-Preemptive Scheduling, a process retains the CPU until it completes or voluntarily releases it. Preemptive scheduling is more flexible but requires careful handling of shared resources.
What is a Shell in an OS?
A Shell is a user interface that allows users to interact with the OS. It can be a Command-Line Interface (CLI) or a Graphical User Interface (GUI). The shell interprets user commands and executes them.
What is an Interrupt in an OS?
An Interrupt is a signal sent to the CPU by hardware or software to request immediate attention. The OS handles interrupts by pausing the current process, executing an interrupt handler, and then resuming the process.
What is a System Call?
A System Call is a mechanism by which a program requests a service from the OS. It acts as an interface between user programs and the OS kernel. Examples include file operations, process control, and communication.