OS Flashcards

1
Q

What is a process?

A

It is a program/application in execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a thread?

A

It is the unit of execution within a process. A process has at least one thread.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a PCB?

A
PCB stands for a Process Control Block. It is a block of memory which represents a process/task within OS.
Some items in the PCB:
- PID
- Process state
- CPU registers
- Program counter
- Memory limits
- List of opened files
- Kernel stack
- Trap frame
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a context switch in terms of OS?

A

It is a process of saving a state of currently executing process and restoring state of another process which is chosen to be executed on CPU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the some benefits of using threads?

A
  • Increasing responsiveness
  • Resource sharing
  • No overhead of creating separate processes in memory
  • Utilization of a multi-processor architecture
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What data an OS kernel keeps for each process in the system?

A
  1. Process Control Block of a process
  2. Kernel stack for the process
  3. Page tables for the process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is CPU burst and I/O burst?

A

CPU burst is the time of execution of the process on CPU.

I/O burst is the time when a process is waiting for I/O for further execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a short-term CPU scheduler?

A

It is a kernel service which selects a process from the processes in the READY queue and allocates the CPU for that process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a dispatcher in the context of CPU scheduling?

A

Dispatcher is a module that gives a control over CPU to the process selected by the short-term scheduler.

The time it takes for the dispatcher to stop one process and start another process is known as dispatch latency.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are criteria of a CPU scheduling algorithm?

A
  • CPU utilization, percentage of time CPU is busy working
  • Throughput, number of processes that are completed per unit of time
  • Turnaround time, sum of periods spent waiting to get in the memory, waiting in the ready queue, running on the CPU and doing I/O
  • Waiting time, sum of periods spent waiting in the ready queue
  • Response time, time from the submission of a process until end of the first execution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are states in a process lifecycle?

A
  • New
  • Ready
  • Running
  • Blocked/Waiting
  • Zombie/Terminated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an interrupt and what its purpose?

A

An interrupt is a type of event in a computer system produced by a hardware to notify about change in its state or about an error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Classify general events in a computer system?

A

Event types:

  1. Interrupts (also known as hardware interrupts)
  2. Traps (software interrupts like printing on the screen)
  3. Exceptions, faults (recoverable like page fault), aborts (non-recoverable like division by zero)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens when there is an interrupt?

A
  1. Hardware device emits interrupt
  2. After each instruction of a process CPU checks whether there is an interrupt occurred
  3. If CPU detected interrupt then it switches to kernel stack if necessary and switches to privileged mode
  4. CPU saves some CPU registers in the kernel stack and suspends execution of a current process
  5. CPU finds and executes Interrupt Handler Routine
  6. IRH saves rest of the current process states and responds to the interrupt
  7. CPU restores user’s task
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a state of CPU?

A

The state of CPU is a current content of all its registers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a process kernel stack and why it is needed?

A

A process kernel stack is a special block of memory in the process memory space which is used during system calls (kernel routines).
It is necessary to have a separate kernel stack for each process in the system so the system call can be resumed if context switch happens during its execution.

17
Q

What is preemptive scheduling of processes?

A

Preemptive scheduling is a type of scheduling when the system allocates CPU to a process for a limited time and then takes it away to another process.

Examples: Round Robin, Shortest Remaining Time First (SRTF), Priority (preemptive version)

18
Q

What is non-preemptive scheduling of processes?

A

In non-preemptive (cooperative) systems a process gets executed on CPU until its termination or transitioning to WAIT state due to I/O. In other words, a running process completely owns the CPU and the system doesn’t interrupt its execution.

Examples: Shortest Job First (SJF), Priority (non-preemptive version)

19
Q

When context switch occurs in OS?

A
  • timer interrupt occurs to preempt the currently running process
  • a process enters the kernel with a system call and has to wait on some resources
  • running process voluntarily yields the CPU
20
Q

What are two types of multi-tasking?

A
  1. Preemptive

2. Cooperative

21
Q

What is virtual memory?

A

VM is one of the two major abstractions in the modern computer systems which helps to solve several problems of the memory management.

22
Q

What are two major abstractions used in the computer systems?

A
  1. Logical Control Flow. Process execution is interleaved, so each process seems to have an exclusive use of the CPU
  2. Virtual Address Space. Address spaces are managed by the virtual memory system and each process gets its own private virtual memory space => each process seems to have an exclusive use of the main memory
23
Q

What problems Virtual Memory solves?

A
  • external fragmentation
  • fitting large virtual memory space into physical memory space which is order of magnitude smaller
  • managing a memory space of multiple processes
  • protecting processes’s memory space
  • allowing processes to share common parts of memory
24
Q

What is a Page Table?

A

PT is an array of page table entries (PTEs) that maps virtual pages to physical frames.