Operating System Concepts Flashcards
What is an Operating System (OS)?
An OS is system software that manages computer hardware, software resources, and provides various services for computer programs.
Describe User Mode and Kernel Mode.
User Mode and Kernel Mode are the two modes of operation of the CPU. User Mode is restricted and does not have access to hardware or memory, while Kernel Mode has full access to all hardware and all memory.
Define Cache
A cache is a hardware or software component that stores data so that future requests for that data can be served faster.
What is an Interrupt?
An interrupt is a signal to the processor indicating an event needing immediate attention.
What is a System Call?
A system call is the programmatic way a computer program requests a service from the kernel of the operating system.
Define a Process.
A process is a program in execution, with its own dedicated system resources.
Define a Program.
A program is a sequence of instructions that tell a computer what tasks to perform.
What is Address Space?
Address Space is a range of valid addresses in memory that a process or thread can use.
What is Multiprogramming?
Multiprogramming is the rapid switching of the CPU between multiple processes in memory. Allows multiple programs to share a CPU and run in (pseudo) parallel on a single CPU. Increases efficiency as it keeps CPU busy all the time.
Explain Process Creation.
Process creation is the act of creating a new process. This is typically done by a parent process, creating a child process.
System call in UNIX: fork()
Creates an exact clone of calling process
- Different address space
- Same memory image
- Same program counter, registers, open files
Explain Process Termination.
Process termination occurs when a process completes its execution or is explicitly killed.
Typical conditions which terminate a process:
1. Normal exit (voluntary)
2. Error exit (voluntary)
3. Fatal error (involuntary)
4. Killed by another process (involuntary)
What are the different Process States?
A process may be in one of three states:
1. Running: Using CPU
2. Ready: Runnable, but temporarily stopped
3. Blocked: unable to run until some external event happens
running -> blocked
running -> ready
ready -> running
blocked -> ready
Define Threads.
Threads are the smallest sequence of programmed instructions that can be managed independently by the scheduler, which is a part of the operating system. Threads are lighter than processes, and share the same memory space, allowing them to communicate with each other more easily. This is useful in programming when you want a program to perform multiple tasks simultaneously.
Compare Processes vs Threads.
Both are independent sequences of execution. The typical difference is that threads run in a shared memory space, while processes run in separate memory spaces.
What is Multi-threading?
Multi-threading is the ability of a central processing unit (CPU) to provide multiple threads of execution concurrently.
What is Interprocess Communication (IPC)?
IPC is a set of methods for the exchange of data among multiple threads in one or more processes.
Define Race Conditions.
A race condition occurs when two or more threads can access shared data and they try to change it at the same time.
What is a Critical Region?
A critical region is a piece of code in a process during which the process is accessing a shared resource, like a data structure, a peripheral device, or a network connection.
Explain Mutual Exclusion.
Mutual Exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions.
What is Busy Waiting?
Busy waiting is a method where a process repeatedly checks to see if a condition is true, such as whether keyboard input or a lock is available.
Define Blocking in OS.
Blocking is a state where a process is waiting for an event such as an I/O operation to complete.
What is a Mutex?
Mutex is a program object that allows multiple program threads to share the same resource, but not simultaneously.
Explain Deadlocks.
Deadlocks occur when two or more processes are unable to proceed because each is waiting for the other to release resources.
What is a Process Scheduler?
The process scheduler is an OS component which selects from among the processes that are in the ready state, and allocates the CPU to them.
Explain Preemption in OS.
Preemption is the ability of the operating system to interrupt and move a currently running process to the waiting state to allow another process to run.
Define Context Switch.
Context Switching is the procedure that a computer’s CPU (central processing unit) follows to change from one task (or process) to another while ensuring that the tasks do not conflict.
What are Scheduling Algorithms?
Scheduling Algorithms are methods to schedule processes in the OS based on criteria such as priority, shortest job first, round robin, etc.
Explain Nonpreemptive Scheduling.
In nonpreemptive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or switching to the waiting state.
Explain Nonpreemptive Scheduling.
In nonpreemptive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or switching to the waiting state.